2016-02-12 208 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

就是這樣!代碼現在可用。 –