TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Bart Henry on July 02, 2021, 12:45:45 PM
-
Hello all, I am using the ATTNUM lisp by Lee Mac... I would like to know 2 things. first how, how would I hard code the "tag" to always be "WIRE#", without having to type it in. 2nd how would i change the code to let me pick 2 blocks at a time. I am VERY new to lisp.
Here is the code.
(defun c:attnum
( / ent enx num tag
) (prompt "\nMissed, try again.") )
(prompt "\nThe selected object is not a block.") )
(prompt "\nThe selected block is not attributed.") )
)
)
)
)
)
(prompt (strcat "\nThe selected block does not contain the attribute \"" tag
"\".")) )
nil
)
( (prompt "\nUnable to edit attribute value.")) )
)
)
)
)
)
)
EDIT (John): Added code tags.
-
Try
1 (setq tag "WIRE#")
2 while and extra close bracket
(while (setq ent (car (entsel (strcat "\nSelect block number " (itoa num) " <exit>: "))))
...........
.................
( (prompt "\nUnable to edit attribute value."))
)
)
)
)
)
)
)
(princ)
-
So the IF statement should change from
(if (/= "" (setq tag (strcase (getstring "\nSpecify attribute tag <exit>: "))))
to
(if (/= "" (setq tag WIRE#)))
-
So the IF statement should change from
(if (/= "" (setq tag (strcase (getstring "\nSpecify attribute tag <exit>: "))))
to
(if (/= "" (setq tag WIRE#)))
Welcome to TheSwamp! :)
-
2nd how would i change the code to let me pick 2 blocks at a time.
Such that both are populated with the same value?
-
An alternative load the changed code then type (attnum "WIRE#") on command line, then can be used for any tagname. You can also do a simple defun that loads the code.
Change the 2 lines
(defun attnum (tag / ent enx num )
(if (/= "" tag)
Add at top of code, or any other tag names you want just make more defuns.
(defun c:wire ()
(if (not attnum)(load "attnum"))
(attnum "WIRE#")
)