Help with an xref lisp

The Real JD

Usenet Archive
Joined
Jul 28, 2003
Messages
183
Reaction score
0
I have a lisp that will convert all xrefs in a drawing to layer color 9. Is it a big deal to change it, so i can pick the xref that I want changed instead of changing all of them? TIA

;;CADALYST 08/03 Tip1888: XREFTO9.LSP XREFS TO COLOR 9 (c) 2003 Jeff Mishler ;; Routine to set all model space Xref ;layers to color 9 ;; by Jeff Mishler, 5/3/03

(defun C:XREFTO9 (/ ssblk cnt blknames lay ename)
(setq ssblk (ssget "x" '((0 . "INSERT") (410 . "Model")))) (setq cnt 0) (setq blknames "") (repeat (sslength ssblk) ; create list of block names in Model space for filter list (setq blknames (strcat blknames (cdr (assoc 2 (entget (ssname ssblk cnt)))) "|*," ) ) (setq cnt (1+ cnt)) ) (setq lay (tblnext "layer" t)) ;get layer entity (command "undo" "be") (while (/= lay nil) (if (wcmatch (cdr (assoc 2 lay)) blknames) ;find xref layers, could use assoc 70 instead (progn (setq ename (tblobjname "layer" (cdr (assoc 2 lay)))) (setq lay (entget ename)) (if (> (cdr (assoc 62 lay)) 0) ; is the layer on? (setq lay (subst (cons 62 9) (assoc 62 lay) lay)) ; yes it is (setq lay (subst (cons 62 -9) (assoc 62 lay) lay)) ; no, it's off ) (entmod lay) ) ) (setq lay (tblnext "layer")) ; next layer ) (if ename (prompt "All xref layers in Model space (except \"0\" and \"defpoints\") now color 9!" ) (prompt "No xref layers found in Model Space!") ) (command "undo" "end") (princ)
)
 
Heh, That's mine! ;-)

Just remove the "x" from the line (setq ssblk (ssget "x" '((0 . "INSERT") (410 . "Model")))) and that should do it. Might want to change the prompt near the end to reflect "the selected xref layers ....."

Jeff
 
Thanks Jeff!

:-)

Jeff Mishler said:
Heh, That's mine! ;-)

Just remove the "x" from the line (setq ssblk (ssget "x" '((0 . "INSERT") (410 . "Model")))) and that should do it. Might want to change the prompt near the end to reflect "the selected xref layers ....."

Jeff
 

Latest threads

Back
Top