Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LISP: Add Prefix to Layers (but XREFS)

1 REPLY 1
SOLVED
Reply
Message 1 of 2
john.laidler
475 Views, 1 Reply

LISP: Add Prefix to Layers (but XREFS)

I have a lisp routine, shown below, that will add a prefix to all layers that are not standard.

What I need is, for all XREF layers to be ignored (not renamed).  Any help would be greatly appreciated.

 

 

(while (setq l (tblnext "Layer"
(not l)))
(if (and (not (member (setq nm (cdr (assoc 2 l))) standards))
(not (tblsearch "LAYER" (setq new (strcat pre nm))))
)
(entmod
(subst (cons 2 new)
(assoc 2 (setq e (entget (tblobjname "LAYER" nm))))
e
)
)
)
)

John Laidler
AutoCAD, Inventor and Vault



Please use "Accept as Solution" & give "Kudos" if this response helped you.
1 REPLY 1
Message 2 of 2

That could be written more efficiently but regardless of that.  Try the following 

 

(while (setq l (tblnext "Layer" (not l)))
  (if (and (not (member (setq nm (cdr (assoc 2 l))) standards))
	   (not (tblsearch "LAYER" (setq new (strcat pre nm))))
	   (not  (wcmatch (cdr (assoc 2 l)) "*|*"))
	   )
    (entmod
      (subst (cons 2 new)
	     (assoc 2 (setq e (entget (tblobjname "LAYER" nm))))
	     e
	     )
      )
    )
  )

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost