03-08-2019
01:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-08-2019
01:25 AM
Hoping that below iLogic code may be helpful to save iAssemblymembers. Similarly, code can be modified for iPart.
' Set reference to active document.
oDoc = ThisApplication.ActiveDocument
' Check the Document type is an assembly or part
If (oDoc.DocumentType <> kAssemblyDocumentObject And _
oDoc.DocumentType <> kPartDocumentObject) Then
MsgBox("Error:Document type is not assembly/part")
Exit Sub
End If
Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim initRowIndex As Integer
Dim oFactory As iAssemblyFactory = oDef.iAssemblyFactory
Dim oRow As iAssemblyTableRow
Dim oMember As iAssemblyMember
For Each oRow In oFactory.TableRows
' Generate the member and file, (overwrites member file or creates new file)
oMember = oFactory.CreateMember(oRow)
Dim oPath As String
oPath = oMember.ParentFactory.MemberCacheDir
Dim oReferDoc As AssemblyDocument
oReferDoc = ThisApplication.Documents.Open(oPath & "\" & oRow.MemberName & ".iam", True)
Dim oName As String
oName = oReferDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value
Call oReferDoc.SaveAs(oPath & "\" & oName & ".iam", True)
Call oReferDoc.Close
Next
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network
