Failures: Insert iPartMember or getting iPartTableRow by Parameters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
We have an iPartFactory for fasteners. That FullDocumentName is stored as string "ScrewSource"
I have no trouble inserting that iPartFactory with default values.
I have been hitting my head against the wall trying to insert the iPartFactory by specifying the iPartTableRow by values.
From the API help, I see that the iPartTableRow index can be specified via string of identifiers, quoting:
If a string is input it should be in a part identifier format(i.e. "[Height=1.000 in][Length=2.000 in][Radius=0.250 in]"
However, I cannot get this to work.
It fails with an error that leaves me wondering if there is some parsing problem.
I've verified the column names I'm calling, as well as that there is a unique row with all the values I call.
Type:Code
BoltThread:Dia
Bolt:TotalLength
are all parameters/column names in the iPartFactory table. The values I call out are all the values of a fastener I have active in another window. I'm stumped at where to begin. Error in attached screenshot (if it works)
Public Function InsertScrew() As ComponentOccurrence Dim ScrewDoc As Inventor.PartDocument = InvApp.Documents.ItemByName(ScrewSource) Dim PCD As PartComponentDefinition = ScrewDoc.ComponentDefinition ScrewFactory = PCD.iPartFactory Dim oMatrix As Matrix = InvTG.CreateMatrix oMatrix.SetTranslation(InvTG.CreateVector(0, 0, 30), True) Dim AsmCompDef As AssemblyComponentDefinition = AsmDoc.ComponentDefinition Dim AsmOccs As ComponentOccurrences = AsmCompDef.Occurrences Dim screwstring As String = "[Type:Code=SHCS][BoltThread:Dia=0.250][Bolt:TotalLength=0.5]" Dim ScrewTableRow As iPartTableRow = ScrewFactory.TableRows.Item(screwstring) Dim thisScrew As ComponentOccurrence = AsmOccs.AddiPartMember(ScrewSource, oMatrix, ScrewList) Return TheScrew End Function
Error: