当前位置: 动力学知识库 > 问答 > 编程问答 >

Convert VBA code to CATScript or VBScript

问题描述:

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

网友答案:

Did you tried to change FixPartBodyNames with CATMain ?

分享给朋友:
您可能感兴趣的文章:
随机阅读: