cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

quickly truncate callouts in IsoDraw?

ptc-4645014
1-Newbie

quickly truncate callouts in IsoDraw?

Have numerous callouts that have the part name and the "long version" of the part number, i.e.

WASHER

(01-030, 79-21-11)

would like to have a way to click on the callout, hit a macro or hit a button that quickly changes to the "short version" of the part number

WASHER

(01-030)

It will always be the same pattern. Find the comma, delete it and everthing after it until the paren.

have been playing with:

selecting the layer with callouts on it

making it the only visible layer

selecting only text that contains "("

exporting selection as text file

going to an outside text editor to do find&replace

importing them back into IsoDraw

Got to be a less klunky way to something so simple?

1 ACCEPTED SOLUTION

Accepted Solutions

Just delete the two lines 'Select None' and 'Select if Type is "Text"' at the start of the macro. It will then only run on what you have selected. In regards to not working on all the text elements, I'm not sure at this point. I ran it against the sample provided and it worked on all three. Can you post what you tried it on if it is different?

View solution in original post

8 REPLIES 8

Hi,

Gary,

Its very easy,

Just send one sample .iso file.

attached is sample file

Bolt, Washer, and Nut

would be great if I could select a callout, hit a key or click a button and truncate it to the short form

All efforts appreciated..

Here is a macro to do what you want. It selects all text elements and then searches for a comma. If found it removes the comma and all remaining text and then applies a closing ")" at the end. Simple but effective.

Macro Text_Clean

Define E1 as Element
Define Where as Integer
Define Output as String

Select None

Select if Type is "Text"

E1 = ActiveDoc.FirstSelectedElement

While (Exists(E1) = True)

Where=Find(E1.Text.String,",",1)
If(Where <> 0)
Where=Where-1
Output=Left(E1.Text.String,Where) + ")"
E1.Text.String=Output
End If
E1=E1.nextSelectedElement

Select None

End While

End Macro

Harrumph. When I run it, it changes only two out of the three callouts.

selecting all text is a little risky to me. there could be other notes or other text on the illustration that might have a comma, and POW! We've wiped out the rest of the sentence.

Can we modify it to work only only a selected item? It is up to my user to know to select only text.

Just delete the two lines 'Select None' and 'Select if Type is "Text"' at the start of the macro. It will then only run on what you have selected. In regards to not working on all the text elements, I'm not sure at this point. I ran it against the sample provided and it worked on all three. Can you post what you tried it on if it is different?

Spoke too soon. I see it is failing on the bolt. I added a check in case there was no comma, it worked before that so I'm guessing that is my source. Give me a few and I'll see what I can come up with.

Red in the face here. Found my errror. It wasn't the if statement, it was a poorly, last minute placed, 'select none'. Try this instead.

Macro Text_Clean

Define E1 as Element
Define Where as Integer
Define Output as String

Select None

Select if Type is "Text"

E1 = ActiveDoc.FirstSelectedElement

While (Exists(E1) = True)
message E1.Text.String
Where=Find(E1.Text.String,",",1)
message Where
If(Where <> 0)
Where=Where-1
Output=Left(E1.Text.String,Where) + ")"
E1.Text.String=Output
End If
E1=E1.nextSelectedElement

End While
Select None

End Macro

It's good. Deleting the two lines allows it to run on a single selected, or on a group of selected. And if nothing is selected it does nothing at all. That is the best all around for me!

Top Tags