Hi all,
I've scoured the forum and the web for a solution to my problem, and even the similar cases I've found haven't been able to resolve this for me.
I'm helping my company build out a form and corresponding iLogic to drive a part configurator for our products; the form works, as does a lot of the iLogic I've built, save for this one snippet relating to selecting the iPart row. BAG_CUSTOMBAG is a boolean parameter and BAG_VOLUME is a multivalue numerical parameter; the table member names correspond to values of BAG_VOLUME.
I've tried removing ":1" after the part name, tried using just a name of a member instead of the BAG_VOLUME parameter, tried ensuring that the value of BAG_VOLUME is being converted to a string, and still get the same error:
Error in rule: BAG CONFIGURATOR, in document: 2D BAG (3 SEAM).ipt
Object reference not set to an instance of an object.
Anyone have any advice on what I'm missing here?
If Parameter("BAG_CUSTOMBAG")= False Then iPart.ChangeRow("2D BAG:1", Parameter("BAG_VOLUME")) Else iPart.ChangeRow("2D BAG:1:)", "CUSTOM")
EndIf
Hi
Looking at this line of your code
"iPart.ChangeRow("2D BAG:1", Parameter ("BAG_VOLUME"))"
I assume 2D BAG:1 is the component name in your model tree. Have you stabalized the name? By that I mean that you must rename the component in the model tree.
There should be no need for "Parameter" before BAG_VOLUME
So try this , "MY BAG" is the stabalized name I used
iPart.ChangeRow("MY BAG",BAG_VOLUME)
You may already have tried some or all of this, if so my apologies
can you try running the rule with the line
iPart.ChangeRow("2D BAG:1", "BAG_VOLUME")
just comment out the other lines, right now i am not sure which part of the code is failing.
If you could post a snapshot of your ipart author table I can try recreating the issue
Sure, you can find it attached.
I tried commenting out the code except for the iPart.change, still no luck. For reference, I stablized my part name to "DPPW".
So to be clear.
You assembled the component into the assembly and stabalized the name in the assembly model tree to DPPW
This should work!
I will try to work up an example here to test this, what version of Inventor are you working with?
Absolutely,
The code should reside in the assembly.It will be triggered (executed) when the value of your parameter BAG_VOLUME changes
Then the ipart member will swap out
Hi,
You may have stabilized the name, but when i saw your JPG file, i didnt find any column Name with "BAG_VOLUME"
iPart.ChangeRow("DPPW:1", 8)
If you have doubt still in handling kindly check my example file at: http://grabcad.com/library/ilogic-ipart-and-imate-1
The below code will allow you to pick your component and modify based on selection
Dim comp = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter,"Select Component to change:")
'MsgBox(comp.Name)
DefaultRowNumber = iPart.RowNumber(comp.Name)
'rowName = iPart.RowName(comp.Name)
'rowstringvalue=iPart.CurrentRowStringValue("Member")
'MsgBox("Default Row No= " & GetDefaultRowNumber & " RowName==> " & rowName & " RowStringValue==> " & rowstringvalue)
i = iPart.FindRow(comp.Name,"Member","=","CUSTOM") ' To set last row no to Dim i
'MsgBox("Row No= " & i)
j=1
Component.Visible(comp.Name)=False
Dim sizelist As New ArrayList
For j = 1 To i
iPart.ChangeRow(comp.Name,j)
rowstringvalue=iPart.CurrentRowStringValue("Part Number")
'MsgBox("Row String Value= " & rowstringvalue)
sizelist.Add(rowstringvalue)
'MsgBox("j= " & j)
Next j
'MsgBox("j= " & j)
iPart.ChangeRow(comp.Name,j-1)
'sizelist.Add(rowstringvalue)
iPart.ChangeRow(comp.Name,DefaultRowNumber)
Component.Visible(comp.Name)=True
sizelist1= InputListBox("Select sizelist ", sizelist, sizelist, Title := "Select Sizelist", ListName := "Select Sizelist")
j = iPart.FindRow(comp.Name,"Part Number","=",sizelist1)
'ThisApplication.CommandManager.StartCommand(2344) ' kZoomAllCommand = 2344
'ThisApplication.CommandManager.StartCommand(2353) ' kPanCommand = 2353
accept = InputRadioBox("Accept or Reject to change size", "Accept", "Reject", accept, Title := "Accept or Reject to change size")
'Run rule based On selection
While accept <> True
sizelist1= InputListBox("Select sizelist ", sizelist, sizelist, Title := "Select Sizelist", ListName := "Select Sizelist")
j = iPart.FindRow(comp.Name,"Part Number","=",sizelist1)
ThisApplication.CommandManager.StartCommand(2344) ' kZoomAllCommand = 2344
accept = InputRadioBox("Accept or Reject to change size", "Accept", "Reject", True, Title := "Accept or Reject to change size")
MsgBox(accept)
'yesorno=MessageBox.Show("Are you sure you want to use this size?","iLogic",MessageBoxButtons.YesNo)
If accept <> True 'Or yesorno= vbYes
iPart.ChangeRow(comp.Name,DefaultRowNumber)
End If
End While
'Dim Currentpartno= iPart.CurrentRowStringValue("Part Number")
'MsgBox("Current Part No= " & Currentpartno)
'Tubelength = InputBox("Enter Tubelength", "Tubelength", "10")
'MsgBox("j= " & j)
'iPart.ChangeRow(comp.Name,iPart.RowName(comp.Name),Tubelength)
ThisApplication.CommandManager.StartCommand(2344)
'ThisApplication.ActiveView.Fit