Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

@j.peterszetapdm,

 

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