Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catia Macro, Replace certain texts in a product

Status
Not open for further replies.

vlg426

Mechanical
Apr 17, 2013
6
US
Hi Guys

How do I write a macro that will replace every instance of certain text in a product tree to another text I want? Text can be in the file name, parameter name, parameter value....... I also need to perform this many times for difference text replacements.

I tried the function "Replace", but I failed...

.catvba

I know literally nothing about Macro, anything helps.
 
Replies continue below

Recommended for you

Hi,

Bellow an example how to use string manipulation in CATIA Script....to make it more general you will need to modify, I would add an input box for string to be replaced and another one for string used to replace....I will let you the pleasure to search a solution.

Code:
Sub CATMain()

Set MySel= Catia.activedocument.selection
MySel.Search "Name=*Geo*,all"    
For i=1 to Mysel.count
    Catia.statusbar=i & "/" & mysel.count
    MySel.item(i).value.name= Replace(Mysel.item(i).value.name,"Geo","AnotherGeo")
Next

End Sub

Regards
Fernando

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top