I am new at using macros. I tried making a simple code where a macro would save my part in different formats. stp, igs and 3dxml.
Sub CatMain()
pathInputBox = InputBox("Enter path")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = objFSO.GetFolder(pathInputBox)
CATIA.DisplayFileAlerts = False
For Each oFile In oFolder.Files
If Right(oFile.Name, 8) = ".CATPart" Then
Set oProdDoc = CATIA.Documents.Open(oFolder & "\" & oFile.Name)
newname = Replace(oFile.Name, ".CATPart", "")
oProdDoc.ExportData oFolder & "\" & newname, "stp"
oProdDoc.ExportData oFolder & "\" & newname, "igs"
oProdDoc.ExportData oFolder & "\" & newname, "3dxml"
End If
Next
End Sub
And it works. But what if my part has more bodies. Say I also have an unfolded as a body and I would want to save that separately too? How would a macro code look if I wanted to save a body from the catpart? Can someone help me with this simple operation?