A better check would be to have all the layers names capitol in the list, and then useOriginally Posted by kylec_edg
Code:(if (not (member (strcase layName) '("0" "DEFPOINTS" "MVIEW" "NONPRINT" "SCAN" "XREF" "XREF-REF" ) ) )
|
A better check would be to have all the layers names capitol in the list, and then useOriginally Posted by kylec_edg
Code:(if (not (member (strcase layName) '("0" "DEFPOINTS" "MVIEW" "NONPRINT" "SCAN" "XREF" "XREF-REF" ) ) )
Thanks for the clarification, guys.
File this under "You learn something new everyday...".
Another version.
Fixes the lowercase vs. capital problem also.Code:(defun C:LPFIX (/ acadDocument theLayers layName pre suf) (vl-load-com) (defun layer-mod (theLayer) (setq layName (vlax-get-property theLayer 'Name)) (if (not (member (strcase layName) '("0" "DEFPOINTS" "MVIEW" "NONPRINT" "SCAN" "XREF" "XREF-REF" ) ) ) (vla-put-Name thelayer (strcat pre layName suf)) ) ) (setq pre (getstring "\n Enter Layer Prefix: ")) (setq suf (getstring "\n Enter Layer Suffix: ")) (setq acadDocument (vla-get-activedocument (vlax-get-acad-object))) (setq theLayers (vla-get-layers acadDocument)) (vlax-map-collection theLayers 'layer-mod) (vlax-release-object theLayers) (vlax-release-object acadDocument) (princ) ) (prompt "\n Type LPFIX to run.........") (princ)
R.K. McSwain | CAD Panacea |
Ok i realize this is an old thread but can this layer prefix be modified to remove a prefix or is it going to be easier to just use the rename command?
I think it might be easier to use the command line version of rename instead of trying to change the code supplied to do what you want.
This routine is the closest to what I need. Can the routine be changed to keep the first letter of the objects layer and add a new letter after the first?
Example add 2 to the layer:
A-xxx = A2-xxx
This would only aply if the second character is a -. I could add to the layer filter "??-*".
Could I use vl-string-subst to change the - to 2-
Last edited by framedNlv; 2019-09-23 at 03:26 PM.