pravs
Mechanical
- Apr 12, 2018
- 34
Hello
While using the code given in the Macro to rename and save all unique parts in a product an error regarding 'save as' pops up .
can someone post generalized macro to save cat parts , cat products etc in desired formats like 3dxml , stp etc.
Option Explicit
Sub CATMain()
Dim iCount As Integer
Dim sSuffix As String
Dim sNewName As String
sSuffix = "_00"
'To avoid save as warnings*********
CATIA.DisplayFileAlerts = False
Dim productDocument1 As ProductDocument
Set productDocument1 = CATIA.ActiveDocument
Dim product1 As Product
Set product1 = productDocument1.Product
Dim doc1 As Document
Dim products1 As Products
Set products1 = product1.Products
For iCount = 1 To products1.Count
products1.Item(iCount).PartNumber = products1.Item(iCount).PartNumber & sSuffix
sNewName = products1.Item(iCount).PartNumber
Dim documents1 As Documents
Set documents1 = CATIA.Documents
iCount = iCount + 1
Set doc1 = documents1.Item(iCount)
doc1.SaveAs " C:\Users\kpravars\Desktop\test\" & sNewName & ".CATPart"
iCount = iCount - 1
Next iCount
End Sub
my task requires me to just save all the catparts and catproducts in a given installation locally in the specific folder (preferably in STP format).
thanks in advance .
While using the code given in the Macro to rename and save all unique parts in a product an error regarding 'save as' pops up .
can someone post generalized macro to save cat parts , cat products etc in desired formats like 3dxml , stp etc.
Option Explicit
Sub CATMain()
Dim iCount As Integer
Dim sSuffix As String
Dim sNewName As String
sSuffix = "_00"
'To avoid save as warnings*********
CATIA.DisplayFileAlerts = False
Dim productDocument1 As ProductDocument
Set productDocument1 = CATIA.ActiveDocument
Dim product1 As Product
Set product1 = productDocument1.Product
Dim doc1 As Document
Dim products1 As Products
Set products1 = product1.Products
For iCount = 1 To products1.Count
products1.Item(iCount).PartNumber = products1.Item(iCount).PartNumber & sSuffix
sNewName = products1.Item(iCount).PartNumber
Dim documents1 As Documents
Set documents1 = CATIA.Documents
iCount = iCount + 1
Set doc1 = documents1.Item(iCount)
doc1.SaveAs " C:\Users\kpravars\Desktop\test\" & sNewName & ".CATPart"
iCount = iCount - 1
Next iCount
End Sub
my task requires me to just save all the catparts and catproducts in a given installation locally in the specific folder (preferably in STP format).
thanks in advance .