Hello all,
I'm new to AutoCAD LISP commands. I've come to learn and understand the basics, but I'm still learning the LISP functions and more detailed abilities. Which is why I'm hoping someone can assist me with the following:
Is there a way to script a LISP/Script so that the first operation is to select only my block "Callout_Revision" and move it to the "Revision_Tags" layer without requiring my team or myself manually fixing the issue?
I'll begin with describing the thought behind the question. There is a process I have developed that is a great way to manage revision clouds on shop drawings. The block that identifies the revision number is on layer "Revision_Tag" while the cloud(s) are on layer "Revision_[X]" where [X] is the revision number for that cloud. So when the enxt set of revisions need to be made, I run a script to turn off the previous revision layer to eliminate the human error in forgetting to delete/turn off the layer manually. I keep the previous revision marks on the drawings for documentation purposes. Also, it creates the next "Revision_[Y]" layer to again reduce human error; I keep track of revision numbers in an EXCEL spreadsheet, so there is no "Revision_[X+1]" in the script. Then, the team and myself can copy the block for the revision number and change the attribute (no risk of human error since it's on "Revision_Tags" already).
However, I fear that one day soon, I will or one of my team will accidentally put the block on the same layer as the clouds. Which will obviously be an issue when I run the script I described above. I've tried to experiment with all the various "select" commands, but they all require the user to pick the object via mouse input (manual user input).
Thanks for your time all and hope this is clear,
LFrost
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
Welcome to the Autodesk Discussion Community, LFrost!
If I understood correctly, and as a starting point...
To select only your "Callout_Revision" block (if not a Dynamic one and have attributes), and move to the "Revision_Tags" layer
(defun c:demo (/ cly ent i lay ss) (if (setq ss (ssget "_X" (list '(0 . "INSERT") '(2 . "Callout_Revision") '(66 . 1)))) (progn (setq cly (getvar 'CLAYER)) (command "_.layer" "_U" "Revision_Tags" "_T" "Revision_Tags" "_M" "Revision_Tags" "") (repeat (setq i (sslength sS)) (setq ent (entget (ssname ss (setq i (1- i)))) lay (cdr (assoc 8 ent)) ) (if (/= lay "Revision_Tags") (entmod (subst (cons 8 "Revision_Tags") (assoc 8 ent) ent)) ) ) (setvar 'CLAYER cly) ) (prompt "\n \"Callout_Revision\" block not found! ") ) (princ) )
Hope that helps
Henrique
Can't find what you're looking for? Ask the community or share your knowledge.