03-13-2019
10:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-13-2019
10:27 PM
Try this iLogic code for iAssembly.
' 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)
Call oFactory.CreateMember(oRow)
Dim oPath As String
oPath = oFactory.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
ThisApplication.SilentOperation = True
Call oReferDoc.SaveAs(oPath & "\" & oName & ".iam", True)
Call oReferDoc.Close
ThisApplication.SilentOperation = False
Next
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network
