Catia Macro, Replace certain texts in a product
Catia Macro, Replace certain texts in a product
(OP)
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.
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.





RE: Catia Macro, Replace certain texts in a product
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 --> CATScript
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 SubRegards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...