Is it possible to create iAssembly?

Is it possible to create iAssembly?

Anonymous
Not applicable
386 Views
1 Reply
Message 1 of 2

Is it possible to create iAssembly?

Anonymous
Not applicable

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.kAssemblyDocum​entObject)

 

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?

0 Likes
Accepted solutions (1)
387 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution

I found the solution by my self. It seem to be hard to do this only inside Inventor.

I just need to write all information that I need into the Excel Worksheet of iAssembly Table.

0 Likes