Refreshing an iLogic form

Refreshing an iLogic form

Anonymous
Not applicable
2,782 Views
14 Replies
Message 1 of 15

Refreshing an iLogic form

Anonymous
Not applicable

Is there a way to force a form to refresh itself?

My form / rule combination writes parameter values as multilists in responce to values which the user chooses in other parameters. The Parameter side of things works, an dupdates nicely, but the form doesn't refresh when driving parameters are updated. is there a way to either refresh / repaint a form.

 

Many thanks

0 Likes
2,783 Views
14 Replies
Replies (14)
Message 2 of 15

adam.nagy
Autodesk Support
Autodesk Support

Hi James,

 

I got some feedback from my colleague on this.

 

It sounds like you are using the form in "OK Cancel Apply" mode. In that mode, you make changes to the parameters and then hit Apply or OK. Before you hit a button, the form won't refresh. There's no way to get it to refresh in "OK Cancel Apply" mode because the rules have to run in order to update the other choice lists (multivalue lists).

 

The "OK Cancel Apply" option is set in the Predefined Buttons property of the form. The default is "Done". When the "Done" button is the only once shown, parameter changes are sent to Inventor right away. So the rules get a chance to run and the choice lists will update. Same in the "None" mode when no buttons are shown.

 

Cheers,

 

 

 

 



Adam Nagy
Autodesk Platform Services
0 Likes
Message 3 of 15

Anonymous
Not applicable

Hi, I'm running my rule in "None" (as I have another rule which needs to be run when the user has made all their selections. The system nicely updates the actual parameters, it also updates the multilists, and I've used additional rules to make sure that if t he current selection is no longer available, it will revert to a default option. However, the new selection isn't reflected back to the form. It is as though the form isn't re-painting in responce to parameter changes. Is there a way to either tell the form to update in responce to parameter changes, or to force a repaint of (ideally the combo box I'm using) or the whole form. (I'm aware that I can build all this in an add in, but I'd rather not as it's a lot of work for one missing piece of functionality.)

 

Many thanks

0 Likes
Message 4 of 15

MjDeck
Autodesk
Autodesk

Hi James,

 If I set the Predefined buttons form property to None, I don't see the problem. When I change the value of one parameter and that drives a rule to change the multilist of another parameter, the other parameter will update in the form. To change the current value as well as the list, use the statement:
MultiValue.SetValueOptions(True)

before other MultiValue statements.
Can you post a simple part that shows the problem?


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 5 of 15

amichaudJ6E3R
Contributor
Contributor

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

0 Likes
Message 6 of 15

MjDeck
Autodesk
Autodesk

@amichaudJ6E3R , does it work if you just run the rule (instead of regenerating it)?
Are you using ThisAssembly.BeginManage and ThisAssembly.EndManage?
Could you share your assembly privately with Autodesk?


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 7 of 15

amichaudJ6E3R
Contributor
Contributor

Let's say I make my selection in the form and the constraint ain't working, running the rule at this point works as fine as regenerating the rule.

 

Unfortunately I can't share the assembly. If there's no other way I may consider spending the time making a dummy assembly to share but I'd like to avoid it if possible.

 

I am not using ThisAssembly.Begin/EndManage

 

What does it do?

0 Likes
Message 8 of 15

MjDeck
Autodesk
Autodesk

If you use Begin/EndManage, you don't need to call Components.Delete. The system will take care of that for you. Anything that you don't Add between the call to BeginManage and the call to EndManage will be deleted.

There's some more info on this page.
For instance, in your code you show the cases where Orientation = "Left Foot" and BallSize = 0.15625 or 0.1875. Do you have the exact same Delete statements for Orientation = "Right Foot"? If not, it seems like you might have components left over when you change from right to left. Begin/EndManage can take care of that. I'm not sure it would fix your original problem, but it would reduce the amount of code.

If you can't share the model, can you share more of the rule? (If you can, it would be better to attach it as a text file rather than posting directly in the topic.) If you can share the whole rule, I might be able to put together a dummy model based on it.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 9 of 15

amichaudJ6E3R
Contributor
Contributor

Hi,  thanks a lot for your help.

 

Right now, my "patch" to my problem is that I made a button in my form that run the rule when pressed. I called it "reset constraints" and when pressed, everything pops back together...lol. Not exactly what I want but like I said, it kinda patches the issue.

 

I do have the same delete statement on the right side, I literally copied/paste the lines.

 

I will comment my code to try to make it as clear as I can and I'll put it in a text file. If I can fix this it would be so much cleaner then a reset button haha! Also, I am no programmer, so I apologies in advance if my code's a mess.

 

Also, I added a ThisAssembly.BeginManage() just to try it out, and now it seems I can't remove it without having an error prompt.

0 Likes
Message 10 of 15

MjDeck
Autodesk
Autodesk

Do the error messages mention specific component or constraint names? You might be able to get rid of the error messages by manually deleting those components or constraints in the assembly. Then the next time you run the rule it should add them back in.

But if you haven't made any changes you want to keep and haven't saved the assembly, another option would be to close it without saving.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 11 of 15

amichaudJ6E3R
Contributor
Contributor

Here's a text file of my rule. It's not the only rule of the document but it's the main one. I don't think the others are relevant. They deal with different parts of the assembly.

 

I am not sure I understand what you mean by error message, for the ThisAssembly.BeginManage you mean?

I don't know what I did in between our 2 messages, but I just deleted the lines from the code and no error prompt this time. So...moving on lol!

 

In the text file, you'll see there's only 2 screws that I try to constraint. There's supposed to be a lot more (one for each ball size) but I was trying to make these ones work before adding more.

 

 

0 Likes
Message 12 of 15

MjDeck
Autodesk
Autodesk

It's possible that the rules in your FootAnkle parts are not running when you want them to. To get the iMates right, you might need them to run right after you set the "sides" parameter.
Try setting the "Fire dependent rules immediately" option on this assembly rule. It's on the Options tab in the rule editor:
FireDependentRulesImmediately.png


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 13 of 15

amichaudJ6E3R
Contributor
Contributor

Hi!

 

It worked for my screws! They update automatically now. It's awesome. Thank you 🙂

 

For some reason, the plate part constraints do not update but I'm guessing it's something similar, I'll figure it out.

 

You mention something about ThisAssembly.BeginManage would flush all the part that aren't in use, is that right? Where should I put it, in my Orientation rule, in a separate rule? If in my already existing rule, am I wrong to think I'd put it outside all my Ifs, at the very beginning and very end?

0 Likes
Message 14 of 15

MjDeck
Autodesk
Autodesk

If you use ThisAssembly.BeginManage and EndManage, they have to be in the same rule with the code that adds the components and constraints. The best place to put them is usually at the beginning and end of the rule. (You can have more than one set of Begin/EndManage groups in the rule, but that is usually not necessary.)
A managed group "owns" the components and constraints that you add inside of it. Once they belong to a group, no other rule or group can add a component or constraint with that name to the assembly.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 15 of 15

amichaudJ6E3R
Contributor
Contributor

That makes sense,

 

thank you very much for your help.

0 Likes