Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

saving single parts and products individually in STEP format in an installation

Status
Not open for further replies.

pravs

Mechanical
Apr 12, 2018
34
US
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 .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top