Jump to content

Search and Replace in layers


Designer

Recommended Posts

Hi,

Is there a lisp that can search the layers name and then replace the name we want like, I have 5 layers that starts with CCF2 and i want to change it to CCF3, is this possible?

 

Cheers

Link to comment
Share on other sites

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • Designer

    8

  • Tharwat

    7

  • BlackBox

    3

  • BIGAL

    2

Top Posters In This Topic

Posted Images

I used the comand *rename*, then i selected the layers that i wanted to rename and wrote ccf3*

I wanted to rename eg_

ccf2_0_LT_house

ccf2_1_LT_garden

 

to

 

ccf3_0_LT_house

ccf3_1_LT_garden

Link to comment
Share on other sites

Try this buddy.

 

(defun c:test (/ old new)
 ;; Tharwat 26. 07. 2011
 (cond ((not
          (setq old (getstring T "\n Enter name of Existed Layer  :"))
        )
       )
       ((not (setq new
                    (getstring T "\n Enter The New name of Layer to rename :")
             )
        )
       )
       ((not (tblsearch "LAYER" old))
        (princ "\n Name of Layer is not existed ")
       )
       ((progn (command "_.-rename" "_Layer" old new)
               (princ "\n Well done >> ")
        )
       )
 )
 (princ)
)

Tharwat

Link to comment
Share on other sites

This works, but i have to do this layer by layer, is there a way to do this to all layers simultaneous? I have like 120 Layers to change :|

Link to comment
Share on other sites

This is like changing one by one :| that`s what i`ve been doing. I wanted to change all at the same time, like the rename comand but it with a replace comand integrated.

Link to comment
Share on other sites

RENAME definately allows wildcard changes as per my first post rename x* to Y* will only change the x to y takes seconds to do manually. let alone write a lisp etc.

 

Have a go at it.

Link to comment
Share on other sites

When i used rename comand it did not replaced the name it added the preffix to the existed layer eg:

I have the layer ccf2_0_LT_house and want to put ccf3_0_LT_house, when i used the rename comand it puts ccf3ccf2_0_LT_house

I want to do this for 120 layers at the same time, doing it one by one it takes times and its a little boring :)

Link to comment
Share on other sites

It takes to long to write all layers names and the new ones in a drawing.

 

So how the routine would search for the name of the required layer to be renamed ?

Link to comment
Share on other sites

Screen shot:

CT_rename.png

 

Command line output:

Command: ren
RENAME 1 Layer renamed

 

Edit: I don't know if you're aware of the risk you're taking by posting your email address in a forum, but you're begging for spammers to attack your inbox, dude. :ouch:

Edited by BlackBox
Link to comment
Share on other sites

I used the comand *rename*, then i selected the layers that i wanted to rename and wrote ccf3*

I wanted to rename eg_

ccf2_0_LT_house

ccf2_1_LT_garden

 

to

 

ccf3_0_LT_house

ccf3_1_LT_garden

 

 

In the rename dialog box, make sure Layer is highlighted in the Named Objects panel, then, WITHOUT SELECTING THE LAYERS, type in ccf2* in the Old Name:, and ccf3* in the Rename to.

 

 

^^Ohhmph, beat by 2 minutes.^^

Link to comment
Share on other sites

It was morning and i didn`t field the old name :oops: now it works like a charme hehehe.

Sorry guys. Going to remove that email :)

Link to comment
Share on other sites

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...