Lt Dan's legs Posted May 6, 2010 Share Posted May 6, 2010 I'm trying to get the attdia to toggle in a better way. If you hit escape when you're done the attdia will stay at 0. My coworkers are escape happy.. Any ideas? (defun c:RB (/ ip) (if (setq *count* (getint "\nStarting number: ")) (progn -[Do your thing here...] );progn );if (setvar 'attdia 0) (while (setq ip (getpoint "\nInsertion Point: ")) (command "_.insert" "WALLBALL3" ; your block name ip "1.4" "1.4" "0" ; scales/rotation defaults (strcat "R" (itoa *count*)) ); end command (setq *count* (1+ *count*)) ); end while (setvar 'attdia 1) ); _____ Previously named REID7800 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 6, 2010 Share Posted May 6, 2010 You could avoid the System Variable error using an error handler. I posted alternatives in your other thread. Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted May 6, 2010 Author Share Posted May 6, 2010 THANKS! That was an incredibly fast response. Quote Link to comment Share on other sites More sharing options...
alanjt Posted May 6, 2010 Share Posted May 6, 2010 A most excellent name! LoL Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted May 6, 2010 Author Share Posted May 6, 2010 I must be doing something wrong. My attdia doesn't turn off when i hit escape but my coworkers still have this problem. Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted May 6, 2010 Author Share Posted May 6, 2010 A most excellent name! LoL I have to admit I stole it from a local trivia team. I thought it was too great not to use. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 6, 2010 Share Posted May 6, 2010 Are you using my code? Did you change the command syntax at all? If so, did you reload it? Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted May 6, 2010 Author Share Posted May 6, 2010 Yes but I'm not sure what goes where. I don't know much about the language at all. There are no courses here at my local college so I'm trying to teach myself... it's not going so well. I thought I had some of it figured out but I see that I'm wrong. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 6, 2010 Share Posted May 6, 2010 If you were to use this code: (defun c:InsertBlock ( / block tag space point ) (vl-load-com) ;; Lee Mac ~ 05.05.10 (setq block "PANEL") ;; Block Name or nil (setq tag nil) ;; Tag Name or nil (setq space (if (or (eq AcModelSpace (vla-get-ActiveSpace (setq doc (vla-get-ActiveDocument (vlax-get-acad-object) ) ) ) ) (eq :vlax-true (vla-get-MSpace doc) ) ) (vla-get-ModelSpace doc) (vla-get-PaperSpace doc) ) ) (if (and (setq block (GetBlock block)) (setq *num* (1- (cond ( (getint (strcat "\nSpecify Starting Number <" (itoa (setq *num* (cond ( *num* ) ( 1 )) ) ) "> : " ) ) ) ( *num* ) ) ) ) ) (while (setq *num* (1+ *num*) point (getpoint "\nSpecify Point for Insertion: ")) (if (and (setq obj (InsertBlock space block point)) tag) (PutAttValue obj tag (itoa *num*)) ) ) ) (princ) ) (defun PutAttValue ( object tag value ) ;; Lee Mac ~ 05.05.10 (mapcar (function (lambda ( attrib ) (and (eq tag (vla-get-TagString attrib)) (vla-put-TextString attrib value) ) ) ) (vlax-invoke object 'GetAttributes) ) value ) (defun GetBlock ( block ) ;; Lee Mac ~ 05.05.10 (cond ( (not (and (or block (setq block (getfiled "Select Block" "" "dwg" 16) ) ) (or (and (vl-position (vl-filename-extension block) '("" nil) ) (or (tblsearch "BLOCK" block) (setq block (findfile (strcat block ".dwg") ) ) ) ) (setq block (findfile block)) ) ) ) nil ) ( block ) ) ) (defun InsertBlock ( Block Name Point ) (if (not (vl-catch-all-error-p (setq result (vl-catch-all-apply (function vla-insertblock) (list Block (vlax-3D-point point) Name 1. 1. 1. 0.) ) ) ) ) result ) ) You would just need to change the block/tag name at the very top - the rest shouldn't need to change. Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted May 6, 2010 Author Share Posted May 6, 2010 Yes I'm using this code but when I insert the block the number that should be counting does not show Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 6, 2010 Share Posted May 6, 2010 Did you make sure that the block/tag name at the top of the code are correct? All works for me Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted May 6, 2010 Author Share Posted May 6, 2010 When I did the code with "LONG WALL" it just removes all dynamic properties in the block. Why would that happen? I have another code that works great for me, I just accidently put "long wall" into this code and that's what happened (defun c:InsertBlock ( / block tag space point ) (vl-load-com) ;; Lee Mac ~ 05.05.10 (setq block "long wall") ;; Block Name or nil (setq tag nil) ;; Tag Name or nil (setq space (if (or (eq AcModelSpace (vla-get-ActiveSpace (setq doc (vla-get-ActiveDocument (vlax-get-acad-object) ) ) ) ) (eq :vlax-true (vla-get-MSpace doc) ) ) (vla-get-ModelSpace doc) (vla-get-PaperSpace doc) ) ) (if (and (setq block (GetBlock block)) (setq *num* (1- (cond ( (getint (strcat "\nSpecify Starting Number (itoa (setq *num* (cond ( *num* ) ( 1 )) ) ) "> : " ) ) ) ( *num* ) ) ) ) ) (while (setq *num* (1+ *num*) point (getpoint "\nSpecify Point for Insertion: ")) (if (and (setq obj (InsertBlock space block point)) tag) (PutAttValue obj tag (itoa *num*)) ) ) ) (princ) ) (defun PutAttValue ( object tag value ) ;; Lee Mac ~ 05.05.10 (mapcar (function (lambda ( attrib ) (and (eq tag (vla-get-TagString attrib)) (vla-put-TextString attrib value) ) ) ) (vlax-invoke object 'GetAttributes) ) value ) (defun GetBlock ( block ) ;; Lee Mac ~ 05.05.10 (cond ( (not (and (or block (setq block (getfiled "Select Block" "" "dwg" 16) ) ) (or (and (vl-position (vl-filename-extension block) '("" nil) ) (or (tblsearch "BLOCK" block) (setq block (findfile (strcat block ".dwg") ) ) ) ) (setq block (findfile block)) ) ) ) nil ) ( block ) ) ) (defun InsertBlock ( Block Name Point ) (if (not (vl-catch-all-error-p (setq result (vl-catch-all-apply (function vla-insertblock) (list Block (vlax-3D-point point) Name 1. 1. 1. 0.) ) ) ) ) result ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 6, 2010 Share Posted May 6, 2010 Why is the Tag name nil? Also, on a side note, read this Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted May 6, 2010 Author Share Posted May 6, 2010 THANKS!! I was wondering how everyone was doing that. I didn't know I had to change that. Thanks. I know very little about lisp. I'm sure it's showing now. What lisp strings I do have has been writen for me or I have had lots of help. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 6, 2010 Share Posted May 6, 2010 I'm not sure why it would strip the Dynamic Properties - there is nothing in the code to do that. But glad the lightbulb came on. Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted May 6, 2010 Author Share Posted May 6, 2010 . I figured it out. Thanks for all the help. better yet. \ | / Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 6, 2010 Share Posted May 6, 2010 You're welcome. Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted May 6, 2010 Author Share Posted May 6, 2010 While I have you here, I've checked out your " Incremental Numbering Suite" & I was thinking about doing something like this myself. I've wanted to do a window like this. It would create a box like this. See dwg. Where would I start? I'm not looking for something like this to be done for me. I'm just wondering if there was a place I could acquire the knowledge from. Like I said before the colleges around here do not offer a course on lisp. Would it be better to do this in VB? Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted May 6, 2010 Author Share Posted May 6, 2010 better yet, can this be done from an excel sheet? If so, school me please! Quote Link to comment Share on other sites More sharing options...
Guest capling006 Posted May 7, 2010 Share Posted May 7, 2010 x Not every man had actually left the United States get into the kind of fierce Puma large whiskers, the downcast, I, my husband decided to resume his light chin, turned and his long absence, electric shavers not, and wait until they finally confessed to his wife before that, the electric razor morning she lost, bad idea that Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.