Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

help in saving single parts and products in an installation

Status
Not open for further replies.

pravs

Mechanical
Apr 12, 2018
34
Hello
While using the code given in the thread560-347231 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.
thanks in advance .
 
Replies continue below

Recommended for you

If you start writing the code, we will be there at your side to help you along.
did you change the line
doc1.SaveAs "C:\FolderLocationWhereYouWantToSaveParts\" & sNewName & ".CATPart"​
to suit your needs?


regards,
LWolf
 
Hi,
yes I have changed that part .
here is my code

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).
the following error pops up
Capture_fbnogv.png
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor