Changing text with multiple instances, but not all need changed

Changing text with multiple instances, but not all need changed

Anonymous
Not applicable
1,225 Views
8 Replies
Message 1 of 9

Changing text with multiple instances, but not all need changed

Anonymous
Not applicable

Hi,

I am still wet behind the ears when it comes to AutoCAD. My company runs 2012 and I need to run a script or a lisp that will change contact numbers without changing the line numbers.

Here's what I was using before, what do I need to change so that it only changes some of the text?

 

(load "srxtext.vlx")
(srxtext "Substring" "9" "5" "All")

 

Thanks,

Keith

0 Likes
Accepted solutions (1)
1,226 Views
8 Replies
Replies (8)
Message 2 of 9

rkmcswain
Mentor
Mentor
You'll need to show us "srxtext.lsp" (the raw lisp code, not the vlx).




R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 3 of 9

ВeekeeCZ
Consultant
Consultant

This routine was developed by CADstudio, so you can try the luck posting in here if @vladimir_michl does not catch it here.

Original routine... link here..

Message 4 of 9

vladimir_michl
Advisor
Advisor

Hearing chimes...

 

What are the texts you need to update? The srxText utility allows to use regular expressions to perform the replacements. If you give me examples of old and new/required texts, I can make the neccessary regular expression for your case.

 

Vladimir Michl, www.cadstudio.cz  www.cadforum.cz

0 Likes
Message 5 of 9

Anonymous
Not applicable

I need to change the contact number 9 to a 5, and a 10 to a 3 without changing the line numbers at the same time. They're both in the same layer as well.

I don't know whether the contact numbers are the first or second occurance in the drawing. I was using (srxtext "Substring" "TDM" "T0M" "All") to change the drawing name, and it worked well. The trouble is that there are 300+ drawing that need the number change, and no other characters to link to.

Thanks again,

Keith

0 Likes
Message 6 of 9

vladimir_michl
Advisor
Advisor

I really need the examples of your drawing texts, I do know what the text you call "contact numbers" look like - is it "Contact 5" or just "5" or "123/5" or "Line 123, contact 5"? Are the texts in different attributes? In a single one?

 

Vladimir Michl, www.cadstudio.cz  www.cadforum.cz

 

0 Likes
Message 7 of 9

Anonymous
Not applicable

Sorry,

I attached a pic of what I'm working on, I hope it helps. The text has exactly all hte same attributes and is in the same layer. I need to change the lower 9 and 10 to a 5 and 3 without changing the line numbers.

0 Likes
Message 8 of 9

vladimir_michl
Advisor
Advisor
Accepted solution

I see but I am not sure srxText will help you here - it cannot distinguish between the text "in the left column" and a text "near a line" unless they reside on different layers. You will probably need to use a plain replacement (not regular expressions) but a specific object selection to filter just the texts you want to proces - e.g. by layer, by a fixed window position, by text style or similar. Only in this case you will be able to perform the batch replacement.

 

Vladimir Michl, www.cadstudio.cz  www.cadforum.cz

 

Message 9 of 9

Anonymous
Not applicable

I see, thanks very much for your time and help!

 

0 Likes