2016-02-12 209 views
0

GisMofx为我提供了此VBA代码。
我使用此代码从我的Catia零件体中删除指定的符号。
你能帮我转换成CATScript或Vbscript吗?将VBA代码转换为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 
+0

当然我们可以帮助你。你究竟在哪里卡住?有没有你不明白的VBA代码的一部分?有没有一些特定的VBA关键字,你不知道等效的VBScript关键字? – Heinzi

回答

0

您是否试图用CATMain更改FixPartBodyNames?

+0

就是这样!代码现在可用。 –