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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Doing manual edits on a 4 digit text number. Need macro for IsoDraw to match manual text edit

RubenCote
10-Marble

Doing manual edits on a 4 digit text number. Need macro for IsoDraw to match manual text edit

Doing manual edits on a 4 digit text number but noticed when I call up the Object info that the name shows the previous text. For example change a text 0401 to 0462. When I do a Object info it still shows 0401 in the name (see attachment). So I want to develop a macro that will change the object info name to match the manual edit. In this case 0462. Here's the macro code I have so far:

Here's the code:

Macro change_name_in_object_info

Define el as Element

Define Text as String

Define output as String

Define text1 as string

el=ActiveDoc.FirstSelectedElement

Select if Type is "Text"

        WHILE (Exists (el) = true)

text1=Text

el.info.name = text1

el = el.nextSelectedElement

        End While

select none

End Macro

ACCEPTED SOLUTION

Accepted Solutions

Main issue was you were doing your select after assigning value to el. Try this.

Macro change_name_in_object_info

    Define el as Element

    Define Temp as string

   

    Select if Type is "Text"

    el = ActiveDoc.FirstSelectedElement

    While (Exists(el) = true)

        Temp = el.text.string

        el.Info.Name = Temp

        el = el.NextSelectedElement

    End While

    Select None

End Macro

View solution in original post

2 REPLIES 2

Main issue was you were doing your select after assigning value to el. Try this.

Macro change_name_in_object_info

    Define el as Element

    Define Temp as string

   

    Select if Type is "Text"

    el = ActiveDoc.FirstSelectedElement

    While (Exists(el) = true)

        Temp = el.text.string

        el.Info.Name = Temp

        el = el.NextSelectedElement

    End While

    Select None

End Macro

Trevor the code you posted worked like a charm. Great as always! Thank you for helping out.

Announcements

Top Tags