
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to create an iAssembly by API, is it possible?
Now I already write the code to add all assembly members and ground them already.
Dim oiAsmDoc AsAssemblyDocument
oiAsmDoc = mApp.Documents.Add(DocumentTypeEnum.kAssemblyDocumentObject)
Dim oiAsmComDef AsAssemblyComponentDefinition
oiAsmComDef = oiAsmDoc.ComponentDefinition
Dim oiTG AsTransientGeometry
oiTG = mApp.TransientGeometry
Dim oiMatrix AsMatrix
oiMatrix = oiTG.CreateMatrix
Dim f As Integer
For f = 1 To oRowNum 'oRowNum = 2
Dim oiOcc AsComponentOccurrence
oiOcc = oiAsmComDef.Occurrences.Add(oAsmFullFileName(f - 1), oiMatrix)
Next
Dim oiConstraint AsAssemblyConstraint
For Each oiConstraint In oiAsmComDef.Constraints
oiConstraint.Delete()
Next
Dim oiOccurrence As ComponentOccurrence
For Each oiOccurrence In oiAsmComDef.Occurrences
If oiOccurrence.Grounded = FalseThen
oiOccurrence.Grounded = True
End If
Next
mApp.SilentOperation = True
oiAsmDoc.SaveAs(oiAsmFullFileName, False)
Dim oiAsmFac AsiAssemblyFactory
oiAsmFac = oiAsmComDef.CreateFactory
Dim oiAsmRow As Integer
Dim oAsmRow(oRowNum) As iAssemblyTableRow
For oiAsmRow = 1 To (oRowNum + 1)
CalloiAsmFac.CreateMember(oiAsmRow) ' Error from this line
oAsmRow(oiAsmRow - 1) = oiAsmFac.TableRows.Item(oiAsmRow)
Next
oiAsmDoc.Save()
mApp.SilentOperation = False
I wonder how can:
I add a few row?
I add the Include/Exclude of sub-assemblies ( which I already added upper)?
I change the value of Include/Exclude of sub-assemblies in the specific row?
Solved! Go to Solution.