
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have been using a lisp routine to xref overlay using standard settings for our office.
I now want to add a step to change the xref layer colors to 250 after the xref has been overlaid.
I found portions of code in other forums to make this work but my problem is the portion of the code below just after the break using "nentsel"
I inserted the xref: (command "-xref" "o" filepath "0,0,0" "1" "1" "0"),
and know the name of the xref: (setq filename (vl-filename-base filepath))
but I do not know how to use the name to avoid using "nentsel"
Please take a look at this code below and let me know how to use the "filename" or any other idea you may have to have the color change automatically without having to select the xref mid-routine.
Thank you.
(defun C:XR1 () (c:XREFLEVEL1))
(defun C:xreflevel1 ( / orglyr orgucs us)
(setq orglyr(getvar "clayer"))
(if(/=(getvar "WORLDUCS")1)
(progn
(command "ucs" "na" "d" "temp" "ucs" "na" "s" "temp")
(setq orgucs(getvar "UCSFOLLOW"))
(setvar "UCSFOLLOW" 0)
(command "ucs" "w")
(setq us T)))
(setq filepath (getfiled "Select XREF File" "P:/Shared Folders/Projects/" "dwg" 8))
(setq filename (vl-filename-base filepath))
(command "-layer" "m" "------XR" "lo" "------XR" "")
(command "-xref" "o" filepath "0,0,0" "1" "1" "0")
(setq EN (nentsel "\nSelect Xref: ")) ;original
(setq L (cdr (assoc 8 (entget (car EN))))) ;original
(setq X (substr L 1 (vl-string-position (ascii "|") L)) )
(setq AD (vla-get-ActiveDocument (vlax-get-Acad-Object)) layers (vla-get-Layers ad))
(if (/= (vl-string-search "|" L) nil)
(progn
(vlax-for layer layers
(if (/= (vl-string-search (strcat X "|") (vla-get-name layer)) nil)(vla-put-Color layer 250))
)
(command ".REGEN")
)
(alert "Not an Xref!")
)
Solved! Go to Solution.