Jump to content

Recommended Posts

Posted

I need to rename around 100 layers with a prefix. is there a lisp for this??

thanks for your response.

Posted

how about adding suffix, how do we do that ?

Posted
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

Posted

isnt it possible with using RENAME command ?

Posted
isnt it possible with using RENAME command ?

 

Interesting that you ask... have you tried it? :ouch:

 

To my surprise, it didn't work for me :o... that's why I quickly wrote the routines for you. :wink:

Posted

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.

Posted

I hope I did not offend :huh:; better to ask, rather than assume... You know? o:)

 

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:

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...