0

GisMofx provided me this VBA code.
I use this code to remove the specified symbols from my Catia Part bodies.
Can you please help me in converting this into CATScript or Vbscript?

Sub FixPartBodyNames()

Dim myPart As Part
Set myPart = CATIA.ActiveDocument.Part

Dim myBody As Body

Dim newName As String
Dim newCharacter As String
newCharacter = " "

For Each myBody In myPart.Bodies 'loop through all the bodies in the part
newName = myBody.Name 'get the current body's name
newName = Replace(newName, ".", newCharacter) 'replace all "." with " "
newName = Replace(newName, "/", newCharacter) 'replace all "/" with " "
myBody.Name = newName 'rename the current body with the revised name
Next

MsgBox "All Done!"
End Sub
Community
  • 1
  • 1
J.Zecha
  • 1
  • 5
  • Sure we can help you. Where exactly are you stuck? Is there some part of the VBA code which you don't understand? Is there some specific VBA keyword of which you don't know the equivalent VBScript keyword? – Heinzi Feb 12 '16 at 20:28

1 Answers1

0

Did you tried to change FixPartBodyNames with CATMain ?

ferdo
  • 178
  • 4