Hi @dsl145
Here's a quick example I had on hand.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim asmDoc As AssemblyDocument
asmDoc = ThisApplication.Documents.Add(kAssemblyDocumentObject)
Dim asmDef As AssemblyComponentDefinition
asmDef = asmDoc.ComponentDefinition
' Get the node in the content browser based on the names of the nodes in the hierarchy.
Dim hexHeadNode As ContentTreeViewNode
hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Fasteners").ChildNodes.Item("Bolts").ChildNodes.Item("Hex Head")
' Find a specific family. In this case it's using the display name, but any family
' characteristic could be searched for.
Dim family As ContentFamily
Dim checkFamily As ContentFamily
For Each checkFamily In hexHeadNode.Families
If checkFamily.DisplayName = "DIN EN 24016" Then
family = checkFamily
Exit For
End If
Next
Dim i As Integer
If Not family Is Nothing Then
' Place one instance of each member.
Dim off As Double
off = 0
Dim row As ContentTableRow
'use these 2 lines to run 10 rows
For iRow = 1 To 10
row = family.TableRows.Item(iRow)
''or comment out those 2 lines and
'use the line below To run the entire table
'For Each row In family.TableRows
' Create the member (part file) from the table.
Dim failureReason As MemberManagerErrorsEnum
Dim failureMessage As String
Dim memberFilename As String
memberFilename = family.CreateMember(row, failureReason, failureMessage, kRefreshOutOfDateParts)
' Place the part into the assembly.
Dim transMatrix As Matrix
transMatrix = ThisApplication.TransientGeometry.CreateMatrix
transMatrix.Cell(2, 4) = offset
Dim Occ As ComponentOccurrence
Occ = asmDef.Occurrences.Add(memberFilename, transMatrix)
' Compute the position for the next placement based on the size of the part just placed.
Dim minY As Double
Dim maxY As Double
minY = Occ.RangeBox.MinPoint.Y
maxY = Occ.RangeBox.MaxPoint.Y
off = off + ((maxY - minY) * 1.1)
Next
End If
