pmxcad Posted September 26, 2011 Share Posted September 26, 2011 Hello, Is there a version of Lee Mac's numinc.lsp that can be used with block attributes. So run the lisp, it askes to pick a block, it returs a screen with the question witch tag from the block to use and rest the same as numinc lisp. After that pick the blocks in your order and set the attributes. Thanks, Pmxcad Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted September 27, 2011 Share Posted September 27, 2011 Here's a good start for you. (defun c:test ( / ss->lst ss n ) (vl-load-com) (defun ss->lst ( ss flag / id lst ) (if (eq 'PICKSET (type ss)) (repeat (setq id (sslength ss)) ( (lambda ( name ) (setq lst (cons (if flag (vlax-ename->vla-object name) name )lst ) ) )(ssname ss (setq id (1- id))) ) ) ) ) (if (and (setq ss (ss->lst (ssget '((0 . "insert")(66 . 1))) t) ) (setq n 0) ) (foreach x (reverse ss) (foreach p (vlax-invoke x 'GetAttributes) (if (eq (strcase (vla-get-textstring p)) "T") (vlax-put p 'TextString (itoa (setq n (1+ n)))) ) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
pBe Posted September 27, 2011 Share Posted September 27, 2011 Here is my version: (defun c:AdSel (/ aDoc TagSource ent Blk Var1 Var2) (vl-load-com) (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (cond ((and (setq TagSource (car (nentselp "\nSelect Attribute: "))) (eq (cdr (assoc 0 (setq ent (entget TagSource)))) "ATTRIB") (setq Vlt (list (cdr (assoc 2 ent))(cdr (assoc 1 ent)))) (setq i 0 AtVl (vlax-invoke (setq entV (vla-ObjectIdToObject aDoc (vla-get-OwnerId (vlax-ename->vla-object TagSource)) )) 'GetAttributes)) (while (not (and (eq (vla-get-tagstring (car AtVl)) (car Vlt)) (eq (vla-get-textstring (car AtVl)) (cadr Vlt)))) (setq i (1+ i) Atvl (cdr Atvl)) ) ) ) ) (setq pt1 (getpoint "\nPick Base Point:")) (while (setq pt2 (getpoint pt1 "\nNext Point")) (vlax-invoke (setq NewObj (vla-copy entV)) 'Move pt1 pt2) (setq At2Mod (nth i (vlax-invoke NewObj 'GetAttributes)) str (vla-get-textstring At2Mod) crtVal (atoi (substr str (+ (strlen (setq prf_t (vl-string-right-trim "1234567890" str))) 1)))) (vla-put-textstring At2Mod (strcat prf_t (itoa (1+ crtVal)))) (setq pt1 pt2 entv NewObj) ) ) The difference with this one is as you copy the block the attrinbute you select (on prompt) will be the one that increments Hope this helps Quote Link to comment Share on other sites More sharing options...
pmxcad Posted September 27, 2011 Author Share Posted September 27, 2011 The blocks are already in the drawing, and i want to pick the blocks one by one in my own order. I like the numinc lisp, i can set a frefix, suffix, etc etc........... Pmxcad Quote Link to comment Share on other sites More sharing options...
pBe Posted September 27, 2011 Share Posted September 27, 2011 No worries pmxcad, the routine i posted is especially usefull for blocks with multiple attributes but having the same TAG name. and like i said, its different in such a way that it creates new copies of the the block and increments it. i.e. 1 to 2 Box12 to Box13 Maybe one day i will modify it for existing blocks and add a prompt for suffix/prefix etc.. Cheers Quote Link to comment Share on other sites More sharing options...
VVA Posted September 27, 2011 Share Posted September 27, 2011 AsmiTools Renum? RENUM.LSP - This program converts TEXT, MTEXT and ATTRIBUTES in numbers with a prefix and a suffix. dwgru archive cadtutor archive Quote Link to comment Share on other sites More sharing options...
VVA Posted September 27, 2011 Share Posted September 27, 2011 maybe it will be just as useful AutoLabel Attributes Quote Link to comment Share on other sites More sharing options...
pmxcad Posted September 27, 2011 Author Share Posted September 27, 2011 Yep, RENUM.LSP comes very close. But in the numinc lisp from Lee Mac i can also choose alphanummeric characters to start with. I also like the dialogscreen. So renum.lsp is a good lisp but i like the options in the numinc lisp. Like layer, text high, text border, text style etc. PmxCAD Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted September 27, 2011 Share Posted September 27, 2011 dialog box http://web2.airmail.net/terrycad/Tutorials/MyDialogs.htm another great tool: (defun c:dump ( / e ) (vl-load-com) (if (setq e (car (entsel "\nSelect an object: "))) (progn (vlax-dump-object (vlax-ename->vla-object e) t) (textscr) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
pmxcad Posted September 27, 2011 Author Share Posted September 27, 2011 Oookay, it shows about everything of that block but i cannot change it. The dcl dialogs.......... lot of information to read and to learn. Ok, takes some time. Thanks Pmxcad 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.