Hi everyone,
I need some help getting this code to work again and also to have it do a suffix as well.
it is design to add a prefix before existing layers in a drawing.
So if I have these existing layer names:
walk
drive, Etc...
run lpfix and I get this after I enter l-
l-walk
l-drive, Etc...
But for some reason I now getting
Command: (LOAD "Z:/EDGCustomFiles/LPFIX.lsp")
Type LPFIX to run.........
Command: lpfix
Enter Layer Prefix : d4
; error: bad argument type: stringp nil
Code:
(prompt "nType LPFIX to run.........")
(defun C:LPFIX ( / acadDocument theLayers layName pre)
(vl-load-com)
(setq pre (getstring "nEnter Layer Prefix : "))
(setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))
(setq theLayers (vla-get-layers acadDocument))
(vlax-map-collection theLayers 'layer-mod)
(princ)
);defun
(defun layer-mod (theLayer)
(setq layName (vlax-get-property theLayer 'Name))
(if (not (member layName '("0" "Defpoints" "MVIEW" "NONPRINT" "SCAN" "XREF" "XREF-REF")))
(vla-put-Name thelayer (strcat pre layName))
) ;if
);defun
(princ)
I now also need code that will place a suffix at the end of the existing layers.
l-walk
l-drive, Etc...
run LSUF and I get this after I enter 96
l-walk96
l-drive96, Etc...
I took a shot at writing the code but its not running.
Code:
prompt "nType LSUF to run.........")
(defun C:LSUF ( / acadDocument theLayers layName suf)
(vl-load-com)
(setq suf (getstring "nEnter Layer suffix : "))
(setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))
(setq theLayers (vla-get-layers acadDocument))
(vlax-map-collection theLayers 'layer-mod)
(princ)
);defun
(defun layer-mod (theLayer)
(setq layName (vlax-get-property theLayer 'Name))
(if (not (member layName '("0" "Defpoints" "MVIEW" "NONPRINT" "SCAN" "XREF" "XREF-REF")))
(vla-put-Name thelayer (strcat layName suffix ))
) ;if
);defun
(princ)
Therefore, I was hoping that someone could combined both lisps into one and have ask if you would like the text at the prefix or suffix.
Thanks as always
Kyle C.