iLogic Tutorial for the iDoor – 19

iLogic Tutorial – Completing the Min/Max Rule with the Parameter Limits Wizard

iLogic Tutorial for the iDoor Page Eighteen Image 01 - Code Snippet

 

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)
End If

….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.

 

 

iLogic Tutorial for the iDoor Page Eighteen Image 02 - iLogic Code sippet for width.

 

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)
End If

 

 

 

 

 

 

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.

The next iLogic tutorial, iDoor with iLogic 2, builds upon this one and adds a multi-value option for adding any of five edge profiles or none.

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 -

Intro12345678910111213141516171819

 






iLogic Tutorial for the iDoor – 18

iLogic Tutorial – Modifying the Min/Max in the Parameter Limits Wizard

 This page was modified on 12-10-09 to include the use of the  Parameter Limits Wizard to create message boxes that warn the user when the iLogic rules will not perform the task they have specified due to a dimension being outside of the acceptable range. While at it, I added rules for the rail and stile min/max values so that there is now no part of the door that can be created outside of spec.

All of the changes are within the ‘Limits’ rule, so go to the Manage Tab and open the iLogic Tree Editor, and double click the ‘Limits’ rule. When the Rule Editor opens, select all of the code then right click. Choose Comment Selection. The selected code will now turn grey, and will be disregarded by the program. The reson for doing this is because if for some reason the new code we write does not work, or cannot be finished in time for a production schedual, we can always Uncomment the code we know works fine and Comment the code we are working on and have full functionality untill we are satisfied the new code is complete.

 

iLogic Tutorial for the iDoor Page Eighteen Image 01 - iLogic Code Editor

Once you have the original code commented out, select the Wizards tab near the top of the Rule Editor. Once on that tab, click the Parameter Limits button as shown below…

 

iLogic Tutorial for the iDoor Page Eighteen Image 02 - iLogic Parameter Limits Wizard

The Wizard Dialog will open up where you need to specify the parameter and the min / max values. All of this can be copied from the commented out rule. Start with the Opening_Height parameter. Copy and pasted from the old rules to the parameter window in the Wizard. Then for the min max values, 96 is the max and 6.9375 is the min. Click OK.

 

 

 

 

 

iLogic Tutorial for the iDoor Page Eighteen Image 03 - iLogic Configurator

The Wizard should create some nicely commented code as shown in the image below..

.

iLogic Tutorial for the iDoor Page Eighteen Image 04 - Configurator

 

- iLogic Tutorial Navigation -

Intro12345678910111213141516171819

 






iLogic Tutorial for the iDoor – 17

iLogic Tutorial – Creating the iLogic Min/Max Limits Rule

Now for a little testing. Open the iLogic Parameter Editor from the Pattern Panel
on the Manage tab, select All-Key
in the filter settings (lower left) and situate your screen so that you can see the parameters as well as the door, similar to what is shown in the image below. The Opening_Height parameter is the parameter we will be changing.

iLogic Tutorial for the iDoor Page Seventeen Image 01 - Testing with the  iLogic Parameter Editor 

iLogic Tutorial for the iDoor Page Seventeen Image 02 - Measuring the resultsStart testing by setting the height to 10″. The door should become 10″ high, and have two hinge bores with offsets at 2 �” as the rules state it should.

Now change the height to 110″ high. You will find that going over the maximum size in the hinge bore rule will simply resize the door to the new height leaving whatever bore pattern had been active last –in this case, the 2 �” offset associated with doors under 12″.

As there is no new rule to follow at sizes over 96″ tall, the program is simply retaining the bore rule already applied by the 10″ height. It will do the same thing at the other three configurations as well. If you were to go from the 110″ height down to 88″, it would show the four hinges in the correct locations because 88″ falls within a defined rule. Try the other Handed rules to make sure they are working, then close the iLogic parameter Editor. its time to create the last rule.

 

iLogic Tutorial for the iDoor Page Seventeen Image 03 - The iLogic add rule window
Click on the Add Rule
icon on the iLogic Panel
on the Manage tab. Name the rule Limits and click OK.

 

 

 

 

 

Below you will see the entire code for the Limits rule. It says that if the opening width is set to anything less than the minimum, to reset it to the minimum. It also reduces any wider stiles down to 2″, which I am guessing is the company’s standard. The next part sets the max. width at 48″, and the lower section does the same things for the height.

iLogic Tutorial for the iDoor Page Seventeen Image 04 - iLogic Code

Note: Since writing this tutorial, I have found a better code for the limits using the Paramiter Limits Wizard. It creates code that does exactly the same as this (less the Rail and Stile resets) with the addition of an error message that tells the user what is going on. Continue to write and use the code above, and I’ll show you how to modify it later…

 

- iLogic Tutorial Navigation -

Intro12345678910111213141516171819

 






iLogic Tutorial for the iDoor – 16

iLogic Tutorial – Hinge Count Configurator Creation

This whole section reads as follows:

ElseIf Opening_Height >= 6.9375 And Opening_Height And Handed = “Right” Then
Feature.IsActive(“Sm Right_Cup_Bore”) = True
Feature.IsActive(“Sm Right_Dowel_Bores”) = True
Feature.IsActive(“Sm Pattern Right”) = True
Feature.IsActive(“Right_Cup_Bore”) = False
Feature.IsActive(“Right_Dowel_Bores”) = False
Feature.IsActive(“Med Pattern Right”) = False
Feature.IsActive(“LG Pattern Right”) = False
Feature.IsActive(“XLG Pattern Right”) = False

Which translates to: if the door is bigger than the minimum yet smaller than 12″ (in 1/16″ increments) and the Handed parameter is set to Right, then the small, right-hand, bore pattern will be unsuppressed. All left-hand bore patterns are already suppressed by the Left_Right rule written previously.

The next section sets the bore pattern for the next larger size range:

ElseIf Opening_Height > 11.9375 And Opening_Height And Handed = “Right” Then
Feature.IsActive(“Sm Right_Cup_Bore”) = False
Feature.IsActive(“Sm Right_Dowel_Bores”) = False
Feature.IsActive(“Sm Pattern Right”) = False
Feature.IsActive(“Right_Cup_Bore”) = True
Feature.IsActive(“Right_Dowel_Bores”) = True
Feature.IsActive(“Med Pattern Right”) = True
Feature.IsActive(“LG Pattern Right”) = False
Feature.IsActive(“XLG Pattern Right”) = False

Where the topmost code controls doors with a height equal or less than 11.9375 this latest one begins with doors more than 9.9375. The sizes cannot overlap, otherwise the code will try to (and possibly will) do two different things when set to an overlapping size. You can also see that the cup and dowel bores change from the Sm version, which is only used for the smallest door size range to the normal offset wich is used for all others. The next two size ranges will simply switch the pattern to the Lg and XLG pattern versions as can be seen in the code below…

 

 

 

 

 

ElseIf Opening_Height > 47.9375 And Opening_Height And Handed = “Right” Then
Feature.IsActive(“Sm Right_Cup_Bore”) = False
Feature.IsActive(“Sm Right_Dowel_Bores”) = False
Feature.IsActive(“Sm Pattern Right”) = False
Feature.IsActive(“Right_Cup_Bore”) = True
Feature.IsActive(“Right_Dowel_Bores”) = True
Feature.IsActive(“Med Pattern Right”) = False
Feature.IsActive(“LG Pattern Right”) = True
Feature.IsActive(“XLG Pattern Right”) = False

ElseIf Opening_Height > 66 And Opening_Height And Handed = “Right” Then
Feature.IsActive(“Sm Right_Cup_Bore”) = False
Feature.IsActive(“Sm Right_Dowel_Bores”) = False
Feature.IsActive(“Sm Pattern Right”) = False
Feature.IsActive(“Right_Cup_Bore”) = True
Feature.IsActive(“Right_Dowel_Bores”) = True
Feature.IsActive(“Med Pattern Right”) = False
Feature.IsActive(“LG Pattern Right”) = False
Feature.IsActive(“XLG Pattern Right”) = True

Which brings the rules for the right hand bores to an end. the next section is exactly the same as the right side. The whole rule can be downloaded below and pasted into the code window. 

 Hinge_Count_Code.txt

 

- iLogic Tutorial Navigation -

Intro12345678910111213141516171819

 






iLogic Tutorial for the iDoor – 15

iLogic Tutorial – Writing the iLogic Hinge Count Rule

    You should now have something like that shown in the  image below…

 

iLogic Tutorial for the iDoor Page Fifteen Image 01 - iLogic Rule Applied

iLogic Tutorial for the iDoor Page Fifteen Image 02 - iLogic Tree Editor

 

 Now run a full test on the rule. Open the iLogic Parameter Editor via the iLogic Parameters
icon on the iLogic Parameters
. With the full part visible, change the Handed parameter value from Left to Right. The program will need to change a good deal of geometry, but fairly rapidly all of the holes should switch sides. If so, try the None value. If they all went away, the code is working fine. If not, click on the Edit iLogic Tree
icon on the iLogic panel to bring up the list for this part. The iLogic Tree Editor will pop up as shown to the right. Double click on the rule to go back and edit it. You can look at, or even copy and paste the code from this text file.  — Left_Right_Code.txt

 

 

The next rule will tell the part how many hinges in what configuration depending on the height of the door. As stated earlier, the configuration is based on real-world rules used by a large door manufacturer, and are similar to the ones I have used while building cabinets myself.

Start the new rule by clicking on the Add Rule
icon on the iLogic Panel
. Name the rule Hinge_Count. You will create the first line of code the same way you created the first line of the last rule. The If statement cones from the button at the bottom of the code editor window, the Opening_Height is located by clicking on the User Parameters in the window under the Model tab, and then double clicking the parameter in the Parameter window to the right. After adding a space, you need to enter a Less Than symbol (Handed parameter from the parameter list (after clicking iLogic Parameters in the Model window), etc., etc. All of this can be typed in, copy & pasted in, or selected with double clicking and/or buttons. If you do type the code, remember that it is case sensitive and typos will cause it to not work.

 

 

 

 

 

iLogic Tutorial for the iDoor Page Fifteen Image 03 - iLogic Rule

This line tells the program that if the height of the door is less that 6.9375″ and the Handed parameter is set to the Right variable, then do something. The something is as follows…

 

iLogic Tutorial for the iDoor Page Fifteen Image 04 - iLogic Code

..so put together, the code states that no hole are present when the Opening_Height parameter is set below the stated value.

 

iLogic Tutorial for the iDoor Page Fifteen Image 05 - iLogic Code Snippet

The next line states what to do if the opening size is between two dimensions…

 

- iLogic Tutorial Navigation -

Intro12345678910111213141516171819

 






iLogic Tutorial for the iDoor – 14

iLogic Tutorial – Creating the “Handed” iLogic Rule

You should now have code that matches the code shown in the image below.

 

iLogic Tutorial for the iDoor Page Fourteen Image 01 - iLogic Rule Section

The next seven lines tell the rest of the right-hand features to be suppressed, and the eight after that tell all eight of the left-hand features to be unsuppressed. You can copy and paste the text below into the code window, but it is not good practice. You can copy and paste the code below, but it would be better practice to write the code yourself.

 

 

 

 

Feature.IsActive(“Sm Right_Dowel_Bores”) = False
Feature.IsActive(“Sm Pattern Right”) = False
Feature.IsActive(“Right_Cup_Bore”) = False
Feature.IsActive(“Right_Dowel_Bores”) = False
Feature.IsActive(“Med Pattern Right”) = False
Feature.IsActive(“LG Pattern Right”) = False
Feature.IsActive(“XLG Pattern Right”) = False
Feature.IsActive(“Sm Left_Cup_Bore”) = True
Feature.IsActive(“Sm Left_Dowel_Bores”) = True
Feature.IsActive(“Sm Pattern Left”) = True
Feature.IsActive(“Left_Cup_Bore”) = True
Feature.IsActive(“Left_Dowel_Bores”) = True
Feature.IsActive(“Med Pattern Left”) = True
Feature.IsActive(“LG Pattern Left”) = True
Feature.IsActive(“XLG Pattern Left”) = True

The next part basically says “do what it says above unless Right is selected. If it is, then do the following. The list is exactly the same as the one above except for the true and false statements being reversed.

ElseIf Handed = “Right” Then
Feature.IsActive(“Sm Right_Cup_Bore”) = True
Feature.IsActive(“Sm Right_Dowel_Bores”) = True
Feature.IsActive(“Sm Pattern Right”) = True
Feature.IsActive(“Right_Cup_Bore”) = True
Feature.IsActive(“Right_Dowel_Bores”) = True
Feature.IsActive(“Med Pattern Right”) = True
Feature.IsActive(“LG Pattern Right”) = True
Feature.IsActive(“XLG Pattern Right”) = True
Feature.IsActive(“Sm Left_Cup_Bore”) = False
Feature.IsActive(“Sm Left_Dowel_Bores”) = False
Feature.IsActive(“Sm Pattern Left”) = False
Feature.IsActive(“Left_Cup_Bore”) = False
Feature.IsActive(“Left_Dowel_Bores”) = False
Feature.IsActive(“Med Pattern Left”) = False
Feature.IsActive(“LG Pattern Left”) = False
Feature.IsActive(“XLG Pattern Left”) = False

The last chunk tells the program to follow all of the instructions above unless the value is None, in which case, do the following. It is again exactly the same code chunk as those above with the exception of all values being False. If the value is “None”, all features listed are suppressed.

ElseIf Handed = “None” Then
Feature.IsActive(“Sm Right_Cup_Bore”) = False
Feature.IsActive(“Sm Right_Dowel_Bores”) = False
Feature.IsActive(“Sm Pattern Right”) = False
Feature.IsActive(“Right_Cup_Bore”) = False
Feature.IsActive(“Right_Dowel_Bores”) = False
Feature.IsActive(“Med Pattern Right”) = False
Feature.IsActive(“LG Pattern Right”) = False
Feature.IsActive(“XLG Pattern Right”) = False
Feature.IsActive(“Sm Left_Cup_Bore”) = False
Feature.IsActive(“Sm Left_Dowel_Bores”) = False
Feature.IsActive(“Sm Pattern Left”) = False
Feature.IsActive(“Left_Cup_Bore”) = False
Feature.IsActive(“Left_Dowel_Bores”) = False
Feature.IsActive(“Med Pattern Left”) = False
Feature.IsActive(“LG Pattern Left”) = False
Feature.IsActive(“XLG Pattern Left”) = False
End If

The End If ends the statements and this rule. Click OK. If everything was entered correctly, the part should suddenly have all of the left handed bore holes visible.

 

- iLogic Tutorial Navigation -

Intro12345678910111213141516171819