将VBA代码转换为CATScript或VBScript

时间:2016-02-12 04:09:45

标签: vba vbscript catia

GisMofx为我提供了这个VBA代码 我使用此代码从我的Catia Part主体中删除指定的符号 你可以帮我把它转换成CATScript或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

1 个答案:

答案 0 :(得分:0)

Did you tried to change FixPartBodyNames with CATMain ?