iLogic Tutorial for Creating Min/Max Design Limits in Autodesk Inventor

iLogic Tutorial  Image-01 - Autodesk Inventor's iLogic BrowserWe 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.

 

iLogic Tutorial  Image-02 - Adding parameters for the iLogic code to come

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

 

iLogic Tutorial  Image-03 - A bad extrusion in Autodesk Inventor

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…

 

iLogic Tutorial  Image-04 - This image shows extrusions blowing up in Autodesk Inventor

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.

 

iLogic Tutorial  Image-05 - inventor's Parameter editor

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

 

iLogic Tutorial  Image-06 - Autodesk Inventor's iLogic Browser

 

 

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.

 

 

 

 

 

 

iLogic Tutorial  Image-07 - iLogic code 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.

 

‘Apron Min Width
‘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”)
End If

 

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…

 

iLogic Tutorial  Image-08 - Autodesk inventor's iLogic editing environment

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…

 

iLogic Tutorial  Image-09 - Add buttons to the iLogic form

 

iLogic Tutorial  Image-10

 

 

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

 

iLogic Tutorial  Image-11 - iLogic text box

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

Later.

 



Subsribe to Post Notifications


 





9 thoughts on “iLogic Tutorial for Creating Min/Max Design Limits in Autodesk Inventor

  1. Thanks, Mark – another good tutorial. That's an amazingly easy way to create UI.

    Here are few nitpick corrections:

    "it is geared towards beginners, and should take too long" should be "it is geared towards beginners, and shouldn’t take too long".

    "If you place your cursor in the code field then click" should be "If you place your cursor in the code field then double-click". At least that's what I had to do.

    Mark

    • Thanks Mark, I probably went over the "should" part 10 times without catching it. Nice to have the extra editing power.

      As for the Form creator, I love the functionality as well. I hope they keep developing it. It would be nice to be able to make models with these interfaces and lock down the underlying code so that people could sell functional modules that companies could plug-and-play into their models.

      I’ll add this to my drafts for a future post. I’ve been thinking of it off & on since the form creator was introduced. Stick around for the next post on the min/max –hopefully a wrap-up of the code.

      I’ll likely go into auto selection (and inclusion) of hanger bolts in the next chapter.

  2. Hello Mark,

    Thank you so very much for the excellent tutorials! I am a beginner, but learning very much here.
    I am a bit "stuck" however, as I am having trouble finding page two of your post of December 30. The page 2 link refers back to page 1… Otherwise, the tutorials are very well put together, and interesting to follow. Very much appreciated!

    Trying to catch up,
    Jerry

    • Hi Jerry, Thanks for the complement! It’s great to hear that this stuff is helping someone!

      As for the link, those are created automatically by WordPress (the CMS used to run this site) –and yes, it is broken. Damn!

      To fix it, I just removed the separator that was supposed to split this giant post into two pages. It will take awhile to load, but it should all be there. Sorry for any inconvenience, hope enjoy the (full) tutorial.

      PS – I am working on a system for linking the pages from different tutorial together so that intra tutorial navigation is a bit easier. Should be up-and-running soon.

      Mark

      • Hey Mark,
        Thanks for your attention. The world is now as it should be!!!
        Hope I can get caught up to the "nuts and bolts" of the tutorial this weekend. Hope you have a good weekend as well.
        Sincerely, Jerry

        PS- I voted for "Perspective"…

        • Hi Jerry,

          Glad things are now working correctly. I am doing major shifting around of older pages and files at the moment, so If you come across any bad links or other stupidity, please comment and I’ll take care of it ASAP.

          As for the ‘Perspective’ vote –in my experience, the vast majority of users used Ortho. Maybe because it’s the default setting? Or is it a visual thing? I am inclined to believe it has to do with artistic thought process or not…… but I could be wrong. Whatever——–have a great weekend, and get caught up, the next installment is pretty interesting.

Leave a Reply