Jump to content

Find and replace text...but only layout's name?


Recommended Posts

Posted

Hi,

 

It's possible to find this?

I need to rename a lot layout's name from a dwg (for sample):

 

 

Floor 00.1 ----> Floor 01.1

Floor 00.2 ----> Floor 01.2

Floor 00.3 ----> Floor 01.3

 

thanks!!

Posted

Hi,

 

Are you talking about specific layout names as in your example or ALL layouts to deduct the zero which is on the left side hand ?

 

Show an example.

Posted

As you can see here, i need to replace:

 

APP A1.xx to APP A2.xx (for 2nd floor)

APP A1.xx to APP A3.xx (for 3th floor) ...

 

474802image001.png

Posted

There must be a criteria to follow for renaming layouts, so what is the principle in your case?

Posted (edited)

Weel i find this on the net...it's look like working like a find replace only for layouts!

What do you think about this?

 

(defun c:FRlayout (/ #Find #Replace)
 (vl-load-com)
 (and
   (setq #Find (getstring T "\nFind what: "))
   (setq #Replace (getstring T "\nReplace with: "))
   (not (vl-position "" (list #Find #Replace)))
   (vlax-for x (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
     (vl-catch-all-apply 'vla-put-name (list x (vl-string-subst #Replace #Find (vla-get-name x))))
   ) ;_ vlax-for
 ) ;_ and
 (princ)
) ;_ defun

Edited by SLW210
Changed Quote Tags to Code Tags!
Posted

You need also something like lee-macs parse numbers when you get the layout name use parse numbers to return the 1.02 and check if its with in the range of layouts you want to change start ="App 1.03" end ="App 1.11" gives 1.031.11 etc then only change the correct layouts. The code you have is nearly there.

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