iLogic Tutorial for Creating a SmartPart 2

 
 
 
 
 
 
 
 
 
 

In the first part of this iLogic Tutorial for the Shaker Table series, we left off having created an assembly, placing our hanger bolt SmartPart into it, then placing some Content Center parts into it using AutoDrop. So-far we have only placed the 5/16” nut/washer set. We still need to place the ¼” version, but to do so, we will need to write some iLogic code.

To begin this second part of this iLogic Tutorial, I want to add a couple of parameters. The first is a Multi-Value Parameter for choosing between ¼” and 5/16” bolts. This operation could be done entirely within the iLogic code, but it’s quicker to test things with a parameter that we will later place on a form. To create the multi-value parameter you just create a numeric parameter as you normally would –in this case calling it Diam. Give the new parameter an Equation of .3125 (5/16”). Then right click anywhere in the parameter’s row, and choose Make Multi-Value from the context menu…

 

Inventor Tutorial for SmartPart – Part 2 image 01 - Creating parameters in Autodesk Inventor

 

Inventor Tutorial for SmartPart – Part 2 image 02 - The iLogic multi value parameter list 

 

 

 

The Value List Editor will pop up. the .3125 value you entered earlier will be at the bottom –which means that it is already part of the list. We need to create a new value of .25 in the top pane, then click the Add button to move it down to the list below. Click OK to finish up.

 

 

 

 

 

 

The other parameter is the one that will constrain the nut/washer along the axis of the hanger bolt. As-is, you can drag the set along the length of the bolt (and off of it entirely), and that will not do. To create this next parameter, just click Add Numeric, add a parameter named Nut_Offset, and give it an Equation of ½”…

 

Inventor Tutorial for SmartPart – Part 2 image 03 - Adding a numeric parameter in Autodesk Inventor

Now we will apply  the parameter to the assembly by grabbing the Constrain tool from the Position Panel, then clicking on the top of the hanger bolt. Next we need to click on the bottom of the washer…

 

 Inventor Tutorial for SmartPart – Part 2 image 04 - Adding constraints with Autodesk Inventor

 

Inventor Tutorial for SmartPart – Part 2 image 05 - Naming an iLogic constraint with Autodesk Inventor

 

 

 …choose the Nut_Offset constraint from the Parameters List, then put a minus sign before it as you can see in the image above. We will need to use, and possibly control this distance via iLogic later on when we are automating things. Not a bad idea to name the constraint –I called it Nut Offset.

 

 

 

Finally, the iLogic code! Start by creating a new iLogic rule called Hanger Bolt. In the image of the iLogic Code Editor below, you can see the code you need to write…

 

Inventor Tutorial for SmartPart – Part 2 image 06  - Writing iLogic code in the iLogic Code Editor

 

 

Inventor Tutorial for SmartPart – Part 2 image 07 - Changing Autodesk Inventor's Level of Detail

 

 

 

…click OK to accept and save the code. Now add a new form named Hanger Bolt, and add the multi-value Diam parameter to the form and click OK. Now we can use the form to resize the diameter of the hanger bolt and suppress the 5/16” versions of the nut/washer set, but first, create a new Level of Detail called iLogic, and make sure it is selected. The LOD can be called any ting you wish –we just need one in order to suppress the parts. With that done, open the Hanger Bolt form and choose the .25 version…   

 

 

 

 

 

Inventor Tutorial for SmartPart – Part 2 image 08  - Changing the size using an iLogic form

 

The hanger bolt should resize to ¼”, and the 5/16” nut and washer should now be suppressed.

The next thing to do is to place the ¼” versions of the nut and washer set. You do so the same as before, except that AutoDrop will be a tad confused and try its damndest to place another 5/16” nut. Solve this by clicking to place the nut, then right clicking to bring up the context menu…

 

Inventor Tutorial for SmartPart – Part 2 image 09 - Change Autodesk Inventor's AutoDrop settings

 

…choose the ¼” version. On my machine, AutoDrop got the washer correct, but if it doesn’t do so for you, you know the routine. With the ¼” nut/washer in place, add the Nut_Offset constraint to them as you did with the 5/16” set earlier.

We are now ready to finish up the iLogic rule and test the model. In the earlier iLogic rule writing session, we wrote just enough code to resize the part to its ¼” version, and suppress the  5/16” nut and washer so that they didn’t fail on us. We now need to finish up the diameter sizing code as follows…

 

Inventor Tutorial for SmartPart – Part 2 image 10 - Adding iLogic code via iLogic's "Edit Rule" console

…which is telling the model that if the Diam parameter is set to ¼”  — size the bolt to ¼”, suppress the 5/16” hardware, and unsuppress the ¼” stuff. Remember you can grab the code snippets from the Snippets Tab, and fill them in with Parameters and Names from the tabs above —-or you can type the whole thing in if that trips your trigger. Use the form to test your model –it should work flawlessly.

There is just a tad bit more code to go on this, but it will have to wait until the next installment. Later

 





4 thoughts on “iLogic Tutorial for Creating a SmartPart 2

  1. Hi Mark,

    This is right about the place where I get confuzzled.

    I have everything working except that the bolt diameter does not change. The nut and washer do, but not the bolt diameter.

    How does the connection work between the parameters listed in the ipt and iam files? This was one of those questions I asked from before. Taking for an example, if you were modeling chairs to go with the table, and you have similar parameters in both part files (chair and table) for say "Leg_Taper", how does this all clear itself out, especially in the parts list in the very end?

    The iLogic is making sense, the form editor is great….I am just missing the big connection right at this point in the process of not only "how" but "why". For another example, why does one "make components" when one can simply bring in the multi bodied part right into an assembly file….or would that be a sub assembly?

    Sorry if I am jumping ahead or all around. I usually pick this stuff up easily, but for some reason this is confounding me.

    Thank you for your feedback, it's been immeasurable help.

    • Hi Kent,

      At this point, everything is controlled by the length. Changing the length should change the diameter at the assembly level…

      If Length = 1.5 Or Length = 2 Or Length = 2.5 Or Length = 3.5 Then
      Diam = .25
      Else If Length = 4 Or Length = 4.5 Or Length = 5 Then
      Diam = .3125
      End if

      Which is then sent to the part it these two chunks of code…

      If Diam = .25 Then
      Parameter("Hanger Bolt:1", "Bolt_Diam") = .25
      Component.IsActive("Hex Nut – Inch 5/16 – 18:1") = False
      Component.IsActive("Hex Nut – Inch 1/4 – 20:1") = True
      Component.IsActive("Circular Washer (Inch) 5/16:1") = False
      Component.IsActive("Circular Washer (Inch) 1/4:1") = True
      Else If Diam = .3125 Then
      Parameter("Hanger Bolt:1", "Bolt_Diam") = .3125
      Component.IsActive("Hex Nut – Inch 5/16 – 18:1") = True
      Component.IsActive("Hex Nut – Inch 1/4 – 20:1") = False
      Component.IsActive("Circular Washer (Inch) 5/16:1") = True
      Component.IsActive("Circular Washer (Inch) 1/4:1") = False
      End If

      Without the min/max added by the wizard, the entire code is as follows, and is designed to be controlled only with the length parameter in the assembly…

      ********************************************************************************

      Parameter("Hanger Bolt:1", "Bolt_Length") = Length

      If Length = 1.5 Or Length = 2 Or Length = 2.5 Or Length = 3.5 Then
      Diam = .25
      Else If Length = 4 Or Length = 4.5 Or Length = 5 Then
      Diam = .3125
      End If

      If Diam = .25 Then
      Parameter("Hanger Bolt:1", "Bolt_Diam") = .25
      Component.IsActive("Hex Nut – Inch 5/16 – 18:1") = False
      Component.IsActive("Hex Nut – Inch 1/4 – 20:1") = True
      Component.IsActive("Circular Washer (Inch) 5/16:1") = False
      Component.IsActive("Circular Washer (Inch) 1/4:1") = True
      Else If Diam = .3125 Then
      Parameter("Hanger Bolt:1", "Bolt_Diam") = .3125
      Component.IsActive("Hex Nut – Inch 5/16 – 18:1") = True
      Component.IsActive("Hex Nut – Inch 1/4 – 20:1") = False
      Component.IsActive("Circular Washer (Inch) 5/16:1") = True
      Component.IsActive("Circular Washer (Inch) 1/4:1") = False
      End If

      ********************************************************************************

      Copy and paste it in and let me know if it works for you. If not, there is something wrong elsewhere.

      Mark

  2. Well….I did find out that my bolt diameter parameter waaaaay back on page 1 was not set up correctly, that was why the bolt diameter wasn't changing. My mistake. Where's that blushing emoticon?

    • I know the feeling ;)

      I think you may be trying too hard to get the “big picture” too fast…..I can guarantee it will take awhile, but it will come. In this tutorial, we are creating components because I will be using them in a drawing with a parts list at the end, but in the real world you need to take whatever approach you need to get the information you want. We will cover different approaches in other tutorials, and there are very many approaches that can be taken, but for this tutorial we are going down the road we are on.

      As for the chair and table question, that all depends on if the two are in the same assembly. The parameters used in the tutorial are meant to be easy to remember, and that’s it. If you have two parts in an assembly that needed differing equations then they need to have separate parameter names or they will not have separate sizes.

      The parts list in the end will give you a list of parts regardless of parameters and the modeling method…except in the case where you do not make components (parts). In that case, your entire model is one part –Designing a Shaker Table with Autodesk Inventor.ipt, and that’s all that will be in the list.

      If I were designing this to build one of them myself, I would make a quick drawing from the single part, slap a few dimensions on it, and start building….but that’s not the point of the tutorial or the website as a whole. The object is to show lots of different ways that things can be done, and let the user take away what he needs.

      Stick with it.

      Mark

Leave a Reply