- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I was learning AutoLISP and have since been away from it for about 6 years. As such, I have forgotten.
I need help with someone else's program. If I could remember where I found it, I would ask them.
The Program;
(defun c:XR253 (/ xr1 xr2 xr3 xr4 xr5 xr6 tx1 tb1)
(if (setq
xr1 (entsel "\nSelect Xref to change all layers to color 253: ") ;; <--- Change color number as needed
) ;_ end of setq
(progn
(setq xr2 (entget (car xr1)))
(setq tx1 (cdr (assoc 0 xr2)))
(if (and (= tx1 "INSERT")
) ;_ end of and
(progn
(setq xr3 (cdr (assoc 2 xr2)))
(setq xr4 (tblsearch "block" xr3))
(if (setq xr5 (cdr (assoc 1 xr4)))
(progn
(setq xr6 (strcat xr3 "|*"))
(command "-layer" "c" "253" xr6 "") ;;; <---Change color number as needed
) ;_ end of progn
(prompt (strcat "\n" xr3 " is not an X-Ref."))
) ;_ end of if
) ;_ end of progn
(prompt "\nNo valid XREF selected")
) ;_ end of if
) ;_ end of progn
(princ " ...Nothing selected")
) ;_ end of if
(princ)
)
Could someone spell out what each line is suppose to do. I am currently looking up commands so that I might change this one in the future.
Currently, it "should" allow the user to select an "XREF" and it will change every layer to color 253. I need to be able to change it, to change specific layers to 253 but to also change the linetype to "Hidden2".
Later, I will expand the program to change a complete set of layers and linetypes to the various colors and linetypes that I need.
I know what "setq" does. But, when I see commands such as (setq xr2 (entget (car xr1), (setq tx1 (cdr (assoc 0 xr2) or (setq xr3 (cdr (assoc 2 xr2),
I really don't have a clue what I am facing.
So, I am asking for some help. Please help me to understand what this program is doing.
Thank you,
HD
Solved! Go to Solution.