T704 Posted August 20, 2010 Posted August 20, 2010 I need to rename around 100 layers with a prefix. is there a lisp for this?? thanks for your response. Quote
piscopatos Posted August 21, 2010 Posted August 21, 2010 how about adding suffix, how do we do that ? Quote
BlackBox Posted August 23, 2010 Posted August 23, 2010 how about adding suffix, how do we do that ? Perhaps like this: (defun c:SUFFIX (/ suffix oldLayerName) (vl-load-com) (cond (*activeDoc*) ((setq *activeDoc* (vla-get-activedocument (vlax-get-acad-object))))) (if (setq suffix (strcase (getstring "\n >> Enter Suffix for All Layers: "))) (vlax-for x (vla-get-layers *activeDoc*) (if (and (not (vl-position (setq oldLayerName (strcase (vla-get-name x))) '("0" "DEFPOINTS"))) (not (vl-string-search "|" oldLayerName))) (vla-put-name x (strcat oldLayerName suffix))))) (princ)) ;_end defun Or like this: (defun SUFFIX (arg / oldLayerName) [color=seagreen];; Example: (SUFFIX "-TEST")[/color] (vl-load-com) (cond (*activeDoc*) ((setq *activeDoc* (vla-get-activedocument (vlax-get-acad-object))))) (vlax-for x (vla-get-layers *activeDoc*) (if (and (not (vl-position (setq oldLayerName (strcase (vla-get-name x))) '("0" "DEFPOINTS"))) (not (vl-string-search "|" oldLayerName))) (vla-put-name x (strcat oldLayerName arg)))) (princ)) ;_end defun Quote
piscopatos Posted August 23, 2010 Posted August 23, 2010 isnt it possible with using RENAME command ? Quote
BlackBox Posted August 23, 2010 Posted August 23, 2010 isnt it possible with using RENAME command ? Interesting that you ask... have you tried it? To my surprise, it didn't work for me ... that's why I quickly wrote the routines for you. :wink: Quote
piscopatos Posted August 23, 2010 Posted August 23, 2010 good thing that u wrote those routins but it wont help me, maybe someone else out there will see some use of those, anyways ofcourse i tried it with RENAME but it didnt work for me either. i thought may be i did something wrong so it didnt work for me and may be someone figured it out tht there is a way to do it with RENAME and that is the reason why i asked if isnt it possible with using RENAME command, so no need to be surprised wise one, by the way thnx for ur effort to write those routins. Quote
BlackBox Posted August 23, 2010 Posted August 23, 2010 I hope I did not offend ; better to ask, rather than assume... You know? I think it is silly that the RENAME command has this failure to begin with. Wish I could have been more helpful... Maybe next time!? :wink: Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.