I think I have a similar problem as this and I couldn't find a satisfying solution so I'd like to reignite the thread
It's going to be hard to explain and unfortunately I can't share the design file, so I'll try my best to be clear.
I have a part that has a left and a right side. I have a form with a multilist option that let you determine whether you want to display the left or the right side. That works fine. But where it gets complicated is that I am trying to constrain a screw on the part, depending on its side. At first glance, when I select my side in the form, it doesn't work, but when I Regenerate my rule, boom! the screw pops back into place and is fully constrained.
How can I make that my screw reacts the same without having to regenerate the rule each time, just by changing the parameter in the form?
The code goes like this. For clarity sake, I only copied the code for the left side but it's exactly the same for the right side.
If Orientation = "Left Foot" Then
If BallSize = 0.15625 Then
'Dim _0_80x250_TORXPLUS_BPos = ThisAssembly.Geometry.Point(0.506227, 1.965597, 2.303143)
Dim screwA = Components.Add("0-80x250_TORXPLUS_BLACK_93701A106:1", "0-80x250_TORXPLUS_BLACK_93701A106.ipt", position := Nothing, grounded := False, visible := True, appearance := Nothing)
Components.Delete("1-72x03125_SOCKET_BLACK_91864A008:1")
Components.Delete("2-56x03125_TORXPLUS_BLACK_93701A206:1")
Components.Delete("4-40x03125_TORXPLUS_BLACK_93701A256:1")
Components.Delete("6-32x375_TORXPLUS_BLACK_93701A304:1")
Constraints.AddByiMates("Insert100", "0-80x250_TORXPLUS_BLACK_93701A106:1", "080_TORX_INSERT", "FootAnkle_part02_v02:1", "L_080_TORX_INSERT")
Constraints.AddByiMates("Mate105", "0-80x250_TORXPLUS_BLACK_93701A106:1", "080_TORX_MATE", "FootAnkle_part02_v02:1", "L_080_TORX_MATE")
ElseIf BallSize = 0.1875 Then
Dim screwB = Components.Add("1-72x03125_SOCKET_BLACK_91864A008:1","1-72x03125_SOCKET_BLACK_91864A008.ipt", position := Nothing, grounded := False, visible := True, appearance := Nothing)
Components.Delete("0-80x250_TORXPLUS_BLACK_93701A106:1")
Components.Delete("2-56x03125_TORXPLUS_BLACK_93701A206:1")
Components.Delete("4-40x03125_TORXPLUS_BLACK_93701A256:1")
Components.Delete("6-32x375_TORXPLUS_BLACK_93701A304:1")
Constraints.AddByiMates("Insert101", "1-72x03125_SOCKET_BLACK_91864A008:1", "172_HEX_INSERT", "FootAnkle_part02_v02:1", "L_172_HEX_INSERT")
Constraints.AddByiMates("Mate106", "1-72x03125_SOCKET_BLACK_91864A008:1", "172_HEX_MATE", "FootAnkle_part02_v02:1", "L_172_HEX_MATE")
Oh and the BallSize parameter just determines the size of the part itself so that it know which screw size to load.
I'm kinda stuck, I tried a bunch of things but none worked even the slightest bit. Tried updating the document, running the rule in the code, tried setting the multilist value to true once it's changed. There's surely something I do wrong somewhere, I just can't see where.
Thanks a lot for your help