Pages

Tuesday, June 12, 2012

Turning Features On & Off - An iLogic Enabled Template in Autodesk Inventor

“You can't keep putting bodies against it. It's becoming too quick and complex. You have to automate the process and have standard policies.”
Andrew Bird

One of the side projects I work on semi-regularly is designing furniture in Autodesk Inventor.  Mostly, that means taking designs that I find on the web or in books, and increasing the detail to the point of having full piece and assembly drawings.

I quickly learned to create templates containing "board blanks".  Templates that contained a board already created, with parameters named "Length", "Width", and "Thickness".

The original template.  Just a board with Named Parameters


Instead of redrawing that geometry every time, I would start a template with the geometry already created, and I was off to the races!

But soon, I found that I was using a lot of tenon joints.  So I went ahead and created a second template with a tenon joint in it.




The tenon "enabled" template.  With it's extra parameters

And I was proud of my ingenuity.

But now the challenge I faced was caused by my poor memory.  There were many times I grabbed one of the templates, then part way through realized I should have grabbed the other template!

So I simplified my templates to one template that contained all I needed.

 I created a template where I could control the suppression of the tenon using an iLogic Multi-Value List.  Now I had something I could toggle on and off at will.  With the flip of a switch, a "standard" board, or a "tenon" board.

The combined template.  The Multi-Value List shown with it's two options

And I was *very* proud of my ingenuity!

But now, to "add octane to the mix" as said by Paul Munford in his blog post on "The CAD Setter Out"

Over time, here and there, I created a better interface.

Over the years, and releases of Inventor, utilizing spurts of motivation to overcome barren planes of procrastination,  I added a dialog box.  Now I had something that was easier to interact with then opening parameters

A few months later, I got around to setting the dialog box greet you on file creation, saving the trouble of activating manually.

After completing that task only a few weeks ago, I decided to share this template with the world, so to speak.  

This is one of those blog posts that frankly, I procrastinated on a bit.  Why?  It's a lot to write up.

So to ease the task I'm breaking it up into parts.  So, first, let's get something functional.

How to Suppress and Unsuppress the Tenon!

For starters, name your parameters.  It makes them easier to work with when creating your code.

 Note the bottommost parameter "Joint Type" this is a multi-list that sets what type of joint is used.

Also, note there are a "Shoulder_Length" and an "Overall_Length" parameter.  This parameters are toggled depending on whether or not a tenon is placed on the part.  Ultimately, this parameter can be exported to the parts list for a cut length.


 
The Parameter list. 

Once those parameters are created.  Create an iLogic rule and use the following code to drive the rule.

'If Parameter "Joint_Type" is "Tenon Joint", then unsuppress the feature named "Tenon"
If Joint_Type = "Tenon Joint" Then
Feature.IsActive("Tenon") = True
'Set Value of Length equal to Parameter "LengthOL" (for eventual parts list export)
Length = LengthOL

'If Parameter "Joint_Type" is "Regular Joint", then suppress Feature named "Tenon"
ElseIf Joint_Type = "Regular Joint" Then
Feature.IsActive("Tenon") = False
'Set Value of Length equal to Parameter "Shoulder_Length"(for eventual parts list export)
Length = Shoulder_Length
End If

Check out the video below for the fulls steps.


In Conclusion

This portion of the blog only gets to that "functional" part of the rule  It works great, but it requires that the parameter screen be opened every time.  It may not be elegant, but it is effective.

I ran it like this for quite sometime?  Why?  It worked, and I never got around to further tweaking.

It's that classic case where I fell victim to "good enough".

In the next post, we'll add a form and make this rule run more efficiently and more user friendly.

6 comments:

  1. Anonymous2:05 PM

    Dear Jonathan, I recently migrated from Mechanical Desktop to Inventor Pro 2013 and have been struggling to find a tutorial that would show me how to control my Parameters from an external Excel speead-sheet based on various what-if commands. This tutorial has helped me to fill in one of the missing pieces of the puzzle. So thank you for a succinct and useful tool. CJJ

    ReplyDelete
    Replies
    1. Anonymous, I remember Mechanical Desktop. I started on it back in the days of MDT 4.0. It was a good program in it's day, but it's time, I'm afraid, has passed.

      Glad the post helped you out! Welcome to the Inventor world!

      Delete
  2. Hi Jonathan.
    I have a similar part made ​​with sheet metal.
    I can turn off and on all flanges with iLogic.
    But now I place multiple parts in assy and want also to control the flanges to turn them off and on at ones.
    Do you have any idea to set this up with iLogic in the assy?

    ReplyDelete
    Replies
    1. Jos,

      I'm afraid I don't have a one click solution. If it's a single part used multiple times, changing one should change them all.

      You may be able to use the following:

      MultiValue.SetListInComponent("Part1:1", "d0", 0.5, 0.75, 1.0, 1.25)

      Assuming you can set the list to change the list in a component. Although it does depend on how you built the part.

      Delete
  3. Anonymous8:06 AM

    Jonathan,
    Do you have a method, absent iLogic, to suppress part features in an assembly?
    For example: You have an assembly (= weldment w/o using "weldments") comprised of a number of parts in their 'as-welded' condition. Then you want to do machining on that weldment. So, some parts are thicker and have undersized holes in them. But in the Part itself, you have all the 'as-machined' holes and thicknesses which you can 'turn-on' in the assembly.
    Currently, I create an assembly w/all the parts 'as-fabricated' (= thicker and w/undersized holes). Then I use a derived part to do all the machining operations. But this always isn't the correct work-path, and the other method (= suppressing features at the part level) would work better.
    Got any suggestions?
    Thanks for your input ... Chris

    ReplyDelete
    Replies
    1. iLogic is probably your best way to go in my opinion. You might be able to do some trickery with iParts and iAssemblies too, but it could get a little cumbersome to manage as the assembly starts getting larger.

      Delete