Parameter change won't trigger rule

Parameter change won't trigger rule

alikhan.ganayev
Enthusiast Enthusiast
1,097 Views
8 Replies
Message 1 of 9

Parameter change won't trigger rule

alikhan.ganayev
Enthusiast
Enthusiast

So it's actually a very simple rule

I have Parameters BreedteAanslag, BreedteChassisAchter, BreedteMontageOnder. I put these equations in the Parameters tab BreedteAanslag = BreedteChassisAchter - 23 mm and BreedteMontageOnder = BreedteChassisAchter - 38 mm.

The rule I want to trigger is to limit the range of BreedteChassisAchter

If BreedteChassisAchter < 418 Then

BreedteChassisAchter = 418

ElseIf BreedteChassisAchter > 1000 Then

BreedteChassisAchter = 1000

End If

 as seen here. If I change the parameter to something like 300, it will still accept this value unless I run the rule manually and then it jumps back to 418. I have tried adding an Appy button to the form and I believe parameter changes are part of the event triggers. Windows 10 / Inventor 2019. 

0 Likes
1,098 Views
8 Replies
Replies (8)
Message 2 of 9

WCrihfield
Mentor
Mentor

By which means are you changing the value of that parameter when it is not triggering the rule to run...parameters dialog box, local iLogic Form, global iLogic Form, or other means?  Are you directly changing the value of that parameter named "BreedteChassisAchter ", or are you just changing the value of the other two parameters involved ("BreedteAanslag " & "BreedteMontageOnder ")?  If you are using a global iLogic Form, you will definitely need to use either the Apply or OK button before it will send those parameter changes to the document, and even then, if what you changed didn't change the value of that one parameter you are using in the rule, it will not cause the rule to run.  If using a local iLogic Form or the parameters dialog box, that should cause the parameter values to change immediately, without needing to use Apply or OK, but still if that one parameter's value was not changed, it will not cause the rule to be triggered.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 9

alikhan.ganayev
Enthusiast
Enthusiast
I'm just using a local form on the iLogic tab. I think it does change the value because if I change it to a value, the model does change, it just doesn't follow the range I set for it. On the form I just change the BreedteChassisAchter parameter and the other parameters just follow the equation.
0 Likes
Message 4 of 9

alikhan.ganayev
Enthusiast
Enthusiast
Also on another note. If I change the value to 300, the assembly will change to that value; 300. The parameter value however shows 418. Which is pretty weird.
0 Likes
Message 5 of 9

WCrihfield
Mentor
Mentor

OK.  I think I understand what is going on now.  Any time you use 'raw' numbers in an iLogic rule, and they are supposed to represent any type of measurement, they automatically get understood as being in 'database units' instead of your document units.  Database units for length type measurements is centimeters (cm), so your numbers are likely being understood as centimeters, instead of whatever other units you may have had in mind.  And simply putting a units string behind it won't help either.  You will need to either include some math to convert the numbers as needed or use the built-in tool for converting units.  The built-in tool can be found under the Document.UnitsOfMeasure, called ConvertUnits().

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 9

HermJan.Otterman
Advisor
Advisor

Hi, can you share your model? or an failing example?

if the piece of code you showed, would be the only piece of code, does it work then?

the trigger only triggers model parameters and not userparameters... but if your model changes then I gues there are some model parameters changed..

what happens if you would run the code twice? does it work then? if it does, you have to write your parameters diffretly: instead of Breedte = 300, write parameter("Breedte") = 300

you can also trigger a rule like this:  xx=Breedte as your first line in a new rule. if Breedte gets changed, then the rule the line is in will be executed. this way the other rule wil not be executed on all parameter changes what could be time consuming.

Do you maybe have set the option: "don't rul automatically" (this is in the rule options)??

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes
Message 7 of 9

WCrihfield
Mentor
Mentor

In Inventor 2019 the only event in the Event Triggers dialog for parameters is specifically for 'Model' parameters, and will not work on 'User' parameters.  Are all of those parameters 'model' parameters, or are they 'user' parameters, or are some model, and others user type?  If they are user parameters, and you really need this to be automated, there is still hope, but it could get more complicated, because you could still use a custom event handler code, instead of using the built-in Event Triggers dialog.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 8 of 9

alikhan.ganayev
Enthusiast
Enthusiast

I'm sorry for the late response. They're user parameters. Does Inventor 22 have this problem?

0 Likes
Message 9 of 9

WCrihfield
Mentor
Mentor

It is true that in Inventor 2022 they added "Any User Parameter Change" to the list in the Event Triggers dialog box.  But that is just for you to place the name of a rule (local or external rule) under the name of one of those events, then any time that event happens, it will trigger that rule to run.  Are you even using the Event Triggers dialog box, or just relying on the presence of those unquoted local parameters in that rule to cause it to run automatically?

Even before Inventor 2022, when you are using the unquoted names of local parameters (of any type) within a local rule, that should cause that local rule to be automatically ran any time the value of any of those named local parameters changes.  It's been that way for a long time.  However, if this were an external rule, those unquoted parameter names would not work anymore...it only work that way in local rules, where those parameters exist in the same document as the rule is in.

 

You said you were working on an assembly, right.  Does this same parameter exist in the main assembly, or one of its components, or in both the main assembly and is some of the components?  Is this parameter linked with any other parameters in any of the components, or an Excel file, or something like that?  What exactly are you controlling with these parameters?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes