Jump to content

Find and Replace Question


Lawrst

Recommended Posts

Hello all, When using the find command, is there a way (i assume there is and Im missing something) that i can do the following.

 

Lets say i have a drawing full of numbers, wire numbers to be specific, that are along these lines:

 

XXYYZ

where XX is the page, YY is the line number and z is how many times that wire has changed (through a contact or switch etc).

 

If i am copying an existing drawing and duplicating it, or simply having to change the drawing number, we need to go through the process of replacing the page numbers in all of these wires. So far find and replace does a good job but there are a few problems:

 

The first problem with this, if i have a drawing that i page 30, on line 30, the first wire number on that line will be "30300". If i want to change that drawing number from 30 to 40 and do a find and replace, the previous wire number will become 40400, not 40300. Is there a way for me to replace only the first instance of 40?

The output I'm looking for is changing "30300" to "40300"

 

The other issue with this, is if i have a wire number that is "33050" (page 33, line 05, wire 0) that has comes from another drawing, find and replace it will change it to "34050".

 

Is there a way that i can limit my search to only return values with the starting string as "30" and it will ignore cases like "33050"?

 

This is only a basic example and they get more complicated and convoluted but i think if these can be done I will make my life easier going forward.

 

Thank you to anyone who is able to help. :D

Apologize if this is a bit long, but i didn't want to confuse anyone.

 

P.S. For the power users: I only use this on older drawings that we need to modify for our client.

For new drawings i have created a series of dynamic blocks in combination with fields that i use to avoid this issue. Currently I use a diesel expression that takes the sheet number from the DWG file name (it is always in the same spot, the last 2 numbers before ".dwg") and uses that. Am happy to hear anyone ideas on making this simpler or improving it.

Link to comment
Share on other sites

As Find & Replace is a global style routine you need a custom routine that has rules built in that looks for specific text patterns and changes them. In lisp the substr function can be used. This is a very simple Example not code.

 

(setq str "30300")
(substr str 1 2 ) = 30
(strcat "new" (substr str 3)) = new300

 

Search for Change prefix.

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