We will be using the Shaker Table created in an earlier iLogic tutorial as a base for this one, so if you haven’t completed it, I suggest you do so —it is geared towards beginners, and shouldn’t take too long.
This iLogic tutorial was created to answer a reader’s inquiry as to “how to make the mortises auto-update when the tenon changes” when designing mortise and tenon joints. This has been accomplished. The table’s dimensions can easily be manipulated via the Parameter Editor.
Changing the Apron_Width parameter will automatically change the tenon width because we used the -( Apron_Width – ( Tenon_Shoulder * 2 ul ) ) formula to create the distance between the two planes that describe its width extents. The Tenon_Shoulder parameter used in the formula is a driven dimension placed on one segment of a group of three equal segments constrained to the thickness of the apron. As the apron thickness changes, the tenon remains exactly 1/3 of the thickness, and that dimension is transferred via the driven dimension to the mortise in the Leg solid.
Everything will work just fine until you get all jiggity with the parameters and create yourself a mess. For example, you can currently set the Apron_Width to whatever you wish. In the image below, I set it to 33”, and as you can see, things get a bit jacked up. What happens is that the Apron solid becomes 33” wide, the tenon follows it like it should, and goes through the bottom of the leg, and the taper cut on the leg goes to zero at the bottom of the leg, then back up using the negative value created by its driving formula….
In this case, the only thing that happened was that the design became downright stupid and unbuildable –but changing parameters beyond their intended limits can also damage the underlying sketch, and it can do so without you noticing. Poorly constrained sketches can just plain fall apart, but more likely a loop will cross another and cause some funky combo solid, one (or more) of your extrusions will fail to exist, or as is very common, a sketch element will flip to the opposite side of a line creating some crazy geometry or an open loop.
In the case below, I set the Apron_Width to 77” causing the taper sketch to bust through the top of the leg and blow the crap out of the leg extrusion and six dependant downstream features…
In some cases, you may loose everything and need to start over! Remember, it the above scenario, the part of the design that failed was not the part I was tinkering with –it simply used the same parameter in an equation. Once parts are created from your solids, you can easily blow things up and not know it until a lot of damage is done!
What we need to avoid catastrophe (see above), bad design (i.e., an eight foot tall table), or designs that go beyond our manufacturing capabilities (i.e., table top wider than the sander) are the limits this tutorial is all about. We may as well start with the example we have been using. In the example above, we adjusted the width of the apron to be wider than the leg is long, which started to cause problems. To fix this we could limit the apron’s width to an arbitrary set of numbers such as between 2” and 4” –which is fine, but is unnecessarily limiting. In my opinion, we should be able to take the design as far as we wish without wreaking the havoc described earlier.
The formula for the taper on the leg is: Overall_Height – ( Apron_Width + Top_Thickness + 3 in ) –which give a 3” reveal below the apron before the taper begins. We will use this as the basis for the limits to the apron widths, but before writing the code I will change the static 3” to a dedicated parameter so that it is easier to tweak the design later. To do so, just fire up the Parameters editor and create a new parameter called Taper_Reveal, and give it an equation of 3”. Now go to the Taper_Height parameter and set your curser just after the 3 in, then back space until the number and “in” text are gone. The formula’s text will now be red because it is not valid. To fix things, click the little arrow at the end of the text box you are working in, and select List Parameters from the drop-down list. Select the Taper_Reveal parameter you just created, and the red text will change back to black meaning all is well.
The new formula for this parameter is: Overall_Height – ( Apron_Width + Top_Thickness + Taper_Reveal ) –which is a bit more readable as it replaces the somewhat cryptic 3” with a known design entity. We will also add a parameter that describes the minimum length of leg taper we wish (or is feasible). Name the new parameter Taper_Min_Height and give it an equation of 4”.
With that done, we need to expose the iLogic Browser. To do so, click on the Manage Tab, then click the iLogic Browser icon on the iLogic Panel. If the Rules Tab is not active, make it so now. Now right click in the iLogic Browser to reveal the only thing in the context menu, Add Rule –click same to bring up the Rule Name dialog where we will enter Apron Min/Max. Click OK to bring up the iLogic Editor.
On the Model Tab, click on “User Parameters” (up near the top in the Fx area). This will add all of the parameters you created to the parameters window to the top right as shown above. If you place your cursor in the code field then double click on one of the parameters in the Parameter window, the parameter will be entered into the editor. It’s a good way to speed things up. Note: if any parameter you type in manually does not turn blue, it is not a valid parameter in this part.
Now we will begin writing some code in the lower window. This iLogic Rule only needs to limit the width and thickness of the apron as the rest of the parameters are controlled by limitations imposed by other geometry.
We will start with the iLogic code to limit the minimum width for the apron. Copy & Paste the code below into your code editing window, or better yet, type it in manually and use the parameter selection technique described above.
‘If apron width is set to be equal or greater than the formula below, then resetit to the same formula…
If Apron_Width< 2 Then
Apron_Width = 2
MessageBox.Show(“The Apron Width you have entered is less than the minimum width. It has been re-sized to the minimum width of 2 inches”, “Width too Narrow”)
Basically the code above states that if the Apron_Width parameter is set to less than 2”, then reset it 2” and send up a message box to tell the user what happened. I may eventually tie the code above into a formula that relates to the table’s overall height, but for now, I cannot see the apron getting less than 2” wide, and have used that as a lower limit.
Time to test the new code, but we will save time in the long-run if we create a Form to test our parameters. To do so, click on the Forms Tab on the iLogic Browser, then right click in the empty space and select Add Form. A new form and the Form Editor will pop up…
Click on the Form 1 label in the upper right window to make Form 1′s Properties active in the lower window. Now under the Behavior list, select Predefined Buttons. When selected, a drop-down list box will appear on the right, drop it down and select OK Cancel Apply. Look at your form (the little one to the upper right of the editor). It should now contain those three buttons…
Now all we need to do is drag the Apron_Width and Apron_Thickness parameters from the Parameter window on the left to the Label window in the right. Just drop them anywhere and they will snap into place below the Form 1 label we just modified. Click OK to save the form. There will now be a button on the Forms Tab of the iLogic Browser that has the name of our new form –Form 1. Click it to bring up the form.
Now test the code by changing the Apron_Width parameter to anything less than 2”. Click Apply, and a message should pop up..
Note that you do not need to have the message pop up. You could also just have the program do its magic in the background, but that could lead to mistakes by others, and would not be best practice in a production environment. When you click OK on the message box, the dimension you entered will change to 2 in, and the model will resize accordingly.
That’s it for today’s iLogic tutorial. There are three more chunks of code coming tomorrow to finish up this iLogic rule, and I’ll tell you how to make the model translucent as seen in the images above (if you haven’t figured it out already).
Subsribe to Post Notifications