iLogic Tutorial – Completing the Min/Max Rule with the Parameter Limits Wizard
With the new code in place, we need to add the rules that reset any rail widths that may be too large when the door is set to smaller sizes. The following code:
If Opening_Height < 12
Top_Rail_Width = 2
Bottom_Rail_Width = 2
MessageBox.Show(“At the height you have set, all rail widths must be reset to the minimum of 2”, “Rail Reset Rule”, MessageBoxButtons.OK, MessageBoxIcon.Error)
….needs to be inserted above the Opening_Height variables just created as shown in the image to the right. This adds a guarantee that smaller doors will never have rail widths that are too large for door, which would cause a failure in the model and in real life.
You will now need to do the same procedure for the Opening_Width parameter. This time you paste the Opening_Width parameter into the box. The min is again 6.9375, and the max is 48.
This time you add the left and right style reset parameters below to reset their widths if the door gets less than 10″ wide, again placing the snippet above the Wizard generated code…
if Opening_Width < 10
Left_Style_Width = 2
Right_Style_Width = 2
MessageBox.Show(“At the width you have set, stile widths must be reset to the minimum of 2”, “Stile Reset Rule”, MessageBoxButtons.OK, MessageBoxIcon.Error)
Now we need to add the min / max for the rails and stiles. Use the wizard for each one, hitting the apply button to add them. Make sure the cursor is below the previous code before adding new code as the Wizard will put the code wherever is. Here are the four entries
Bottom_Rail_Width – min is 2″ and max is 5″
Top_Rail_Width – min is 2″ and max is 3″
Left_Style_Width – min is 2″ and max is 3″
Right_Style_Width – min is 2″ and max is 3″
The completed code can be found here: Limits_Code_2.txt
Now click OK to exit the editor and test the part. If the width or height parameters are below the limits that reset the rails and stiles to their minimum, you will not be able to set the rails or stiles to a size larger than the minimum.
If this tutorial has helped you at all, please consider linking from your home page, blog, or in discussion groups to spread the word. Thanks!
– iLogic Tutorial Navigation –