×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Catia Macro, Replace certain texts in a product

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.

RE: Catia Macro, Replace certain texts in a product

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 --> 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 Sub 

Regards
Fernando

https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources