Ilogic form minimum / maximum parameter wizard

Ilogic form minimum / maximum parameter wizard

mark.ellisBM9JT
Observer Observer
2,550 Views
9 Replies
Message 1 of 10

Ilogic form minimum / maximum parameter wizard

mark.ellisBM9JT
Observer
Observer

Hi all

I'm creating an Ilogic form that contains certain parameters in the model and i would like to limit the values for these parameters.

I have used the minimum/maximum wizard in the rule logic.

My problem is if someone enters a value outside the range required then even though a message box warns them that parameter now takes on the new value (even though it is outside the range) or a set value of the minimum or maximum allowed. I got around this by creating a dummy parameter but it seemed a long way to do this for every parameter within the form. 

Is there a simpler way. My model parameter is height, my dummy user parameter is mheight.

' ******* mheight Limits *******
If mheight >= 50 And mheight <= 100
  height = mheight
  ElseIf mheight < 50 Or mheight >100 Then
    MessageBox.Show("The value is outside the allowed range of 50 to 100mm", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
	mheight = False
	mheight = height
End If

 

0 Likes
2,551 Views
9 Replies
Replies (9)
Message 2 of 10

johnsonshiue
Community Manager
Community Manager

Hi Mark,

 

The rule actually can be simplified to the following. You can still keep the error message.

 

height = Min(height, 100)+Max(height,50)-height

 

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 3 of 10

mark.ellisBM9JT
Observer
Observer

so what happens to the parameter if i enter 101 will height keep its current value?

 

0 Likes
Message 4 of 10

A.Acheson
Mentor
Mentor

@mark.ellisBM9JT 

 

You should be able to set the range in the form if values are defined , and also in the parameters fx dialogue.

 

As for ensuring value entered is in the current range. 

The snippet you could be looking for is this.

MultiValue.SetValueOptions(True, DefaultIndex := 0)

In a normal multi value parameter this would reset to the first value of the parameter. 0 means 1st, 1 means 2nd etc

This will control the default value if not in the range set. 

This article shows its use with an error catching statement. 

https://microconcepts.typepad.com/design_automation/2015/01/updating-multi-value-parameter-list-opti...

 

I am fairly sure it will work in your situation, however I have  not tried it on a custom ranged parameter as of yet.


You could also just set the parameter value to be smaller than the range manually if the material min or max is exceeded. 

A couple of screenshots of the form settings could help too if this not solve your question or even easier attach  a simplified form with parameter and  rule.

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 5 of 10

mark.ellisBM9JT
Observer
Observer

Don't think this multivalue will work in my case

0 Likes
Message 6 of 10

A.Acheson
Mentor
Mentor

@mark.ellisBM9JT 

This seems to be more awkward than I thought. The solution above would just over complicate this and doesn't seem to work .

 

Another option is to use a slider form to set the visual limits of the parameter, however a value can still be entered in exceeding these limits, no model update will occur but the value does not get reset to the original value which is less than ideal. I am sure other user would have a better solution, consider moving it over to the customization forum to get more eyes on it.

 

Setting up Range Slider in Form
https://knowledge.autodesk.com/support/inventor/learn-explore/caas/screencast/Main/Details/0a14a8a5-...

'' ******* mheight Limits *******
If mheight >= 50 And Parameter("mheight") <= 100 Then
	
Else
	'Set value back to lowest if slider limits are exceeded
	mheight = 50
End If

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 7 of 10

mark.ellisBM9JT
Observer
Observer

I have the solution in the code i first posted, a dummy parameter but it seems long winded but the replies i'm getting are no shorter.

I do not want to change the parameter to the minimum value if it gets entered out of range as this updates the model and this can be time consuming and unnecessary

0 Likes
Message 8 of 10

johnsonshiue
Community Manager
Community Manager

Hi Mark,

 

I think the solution I provided should work too. If you enter any value greater than 100, height will be 100. For anything less than 50, height will be 50. The in-between values will be unchanged.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 9 of 10

mark.ellisBM9JT
Observer
Observer

I think you are misunderstanding what i mean. Lets say the parameter is 67mm and the maximum value is 100mm but a user enters 200 in the textbox then I want that dimension to stay as 67mm and not jump to 100mm thereby updating the model

0 Likes
Message 10 of 10

J-Camper
Advisor
Advisor

You can shorten it this much for sure:

' ******* mheight Limits *******
If mheight >= 50 And mheight <= 100
  height = mheight
Else 
    Logger.Trace("Outside Range: " & mheight)
	mheight = height
End If

 

You don't need the Else If, just an Else [unless there were more situations to consider than just 2]. Trace will not display message but does include a print out in the iLogic Log [when run in log level: trace] just so you know what was attempted. 

 

I don't know why you were setting the parameter to False?  Doesn't need to be there.

0 Likes