Having Issues Seeing Linked Parameters on iParts Placed Within An Assembly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Greetings everyone,
I'm having some rather strange issues trying to swap out iParts within an Assembly Model via iLogic, and I'm not certain why. I've done this particular operation numerous times in the past with other projects of mine, so I know what I'm doing; the only thing that I've noticed that's different this time around is the fact that my iParts' Linked Parameters are causing these unhandled exceptions whenever I attempt to click on them while within the iLogic Rule Editor.
Here's my scenario: I have two iPart components within an Assembly Model. My iLogic code is currently trying to identify the component that has a name which begins with "BPN"; once found, my code is attempting to ChangeRow from Row 15 to Row 14 (see first attached image). However, when I attempt to do this I get an iPart.FindRow error saying that the component named "System._ComObject" was not found.
Here is my code thus far:
' This rule will extract the W1 & H1 parameters from the Backpan component, and then will adjust the positioning
' and pattern parameters of the Stiffener Angles according to the extracted dimensions.
Sub Main()
' First, we must properly identify which sub-component within this Assembly Model is the Backpan; the first 3 letters
' of the Backpan's part number is "BPN".
Dim oAssyDoc As AssemblyDocument
oAssyDoc = ThisApplication.ActiveDocument
' This variable will let us keep track of whether or not we found a Backpan component.
Dim bFoundBPN, bFoundBSH As Boolean
bFoundBPN = False
bFoundBSH = False
' This will represent our Backpan component occurrence.
Dim oBPNCompOcc As ComponentOccurrence
' This will be used to iterate through all of the components within our Assembly Model.
Dim oCompOcc As ComponentOccurrence
For Each oCompOcc In oAssyDoc.ComponentDefinition.Occurrences
' MsgBox("Left(oCompOcc.Name, 3) = " & Left(oCompOcc.Name, 3))
If Left(oCompOcc.Name, 3) = "BPN" Then
' Found it! Let's assign oCompOcc to oBPNCompOcc and then exit out of this For Each loop.
oBPNCompOcc = oCompOcc
bFoundBPN = True
Exit For
End If
Next
' If bFoundBPN is still set to False, then that means we didn't find the Backpan. We inform the User, and
' then exit the procedure.
If bFoundBPN = False Then
MsgBox("ERROR: No Backpan component starting with 'BPN' was found. Exiting iLogic rule.")
' Exit Sub
Else
' These variables will be used to store the W1 & H1 values from the oBPNCompOcc component.
Dim W1, H1 As Double
' This will represent oBPNCompOcc's name without the occurrence indicator at the end of the name (":1").
Dim sBPNName As String
sBPNName = Left(oBPNCompOcc.Name, oBPNCompOcc.Name.Length - 2)
' HERE is where Inventor gets angry with me.
i = iPart.FindRow(oBPNCompOcc, "H1", "=", 72.5, "W1", "=", 109.875)
iPart.ChangeRow(oBPNCompOcc, i)
End If
End Sub
Interestingly enough, when I expand the BPN component in the Model Tree within the iLogic Rule Editor and then attempt to click on the Linked Parameters, I get an unhandled exception error (see second attached image).
It's so strange because I use the same code as shown above for some older iPart manipulating iLogic code that I've done with previous editions of Inventor (2020, to be precise), and the Linked Parameters work just fine (see third attached image)!
I don't understand why the Linked Parameters for my BPN component causes this strange error to appear, and yet my older iPart components are perfectly fine. Would anybody have any insight as to what I can do to make these things play nicely with each other?