<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=445056146107513&amp;ev=PageView&amp;noscript=1">

Manage Stock Size Data and Other Downstream Information with iLogic

Hagerman & Company

It’s often the most dreaded part of any design project. You’ve spent days or weeks pushing the limits of your creativity and engineering expertise. You’ve iterated and tweaked and simulated and fought for your ideas, and you’ve had a blast doing it. Now comes the boring yet vital final piece: communicating how to bring your design to life.

As you buckle down for a few days of detailing, BOM creation, and tedious data entry, you ask yourself “Isn’t there a better way to do some of this stuff?” The answer is yes – to a point. While you’ll still have to detail all those lovely parts you’ve created, there are some things you can do to make putting the finishing touches on your design a bit less annoying.

If Only…

I spent years doing special machinery design before I came to Hagerman. I designed dozens of machines large and small. The one constant across all of them was the tedium of documenting all of the various purchased and fabricated items required for the build. It wasn’t the detailing so much – I found that to be a nice mental break between design phases of various projects. No, the real annoyance came from generating cut lists and bills of material.

That annoyance was largely my own fault, of course. If only I had documented things better as I went along. If only I had bothered assigning part numbers, or working out the stock sizes, or filled out Manufacturer and Part Number information. What might have taken me a few seconds on each part, spread out over weeks and so unnoticed, instead took me hours at the end of the project. Hours I’d rather be doing anything else. Hours that were error-prone and more than once led to admonishment by the ladies in Purchasing, or ribbing (even a good shouting at) by the guys in the Shop.

So how can iLogic help with this? For starters, it can remind you to fill out that information as you go. The rules you create with iLogic can be run in response to certain program events – for example when a document is first created, or right before you save a document (making sure any updates you make get saved).

iLogic

The above dialog shows the events in response to which you can run rules in a part. The available events will vary by document type. For example, you can run rules in drawings in response to drawing view changes. Let’s take a look at a simple rule that will remind me to fill out the iProperties I use for my parts list and drawing title block information:

iLogic

To get maximum benefit from the rule I’ll then set it to run in response to the ‘Before Save Document’ event:

iLogic

Now every time I save the document, if any of the important properties are missing, I’ll get a friendly reminder:

iLogic

Work Hard to be Lazy

That’s great – we’ll now be pestered every time we save a file, but only if any of the important properties are missing. Let’s take this a step further, though. Who wants to take the time to open the iProperties dialog and scan through the list to edit all those properties? Nobody, and that’s probably why we didn’t do it in the first place. Luckily with a bit more effort up front we can be both lazy and more productive. The first step is to create an iLogic form that contains the properties you need to fill out:

iLogic

Next, replace the line from our original rule that displays the message box with a rule that shows the form. Here’s what the updated rule looks like:

iLogic

And just like that, if you’ve forgotten to fill out your important properties, you will receive this helpful reminder whenever you save.

Measure Not; Cut Once

A common practice in the machine design world is to provide stock size information for all the fabricated parts that make up your assembly. This stock size also typically includes some additional material to allow for cleanup during machining. The creation of stock sizes is another tedious and error-prone process that we can virtually eliminate using iLogic.

We’ll start with a simple rule that takes the bounding box of the current part, uses that to create the required stock size, then places that stock size into a custom iProperty. Here’s an example:

iLogic

The beauty of the above example is that you don’t need to draw using a set of custom parameters to carefully build the stock size. The stock size will be based on the extents of the visible geometry. In addition to capturing the exact dimensions of the solid it adds 1/8” to the longest dimension, as you’ll typically want a bit of extra stock available for cleanup. Notice the amount of additional stock is stored in a variable near the top of the rule; this is a good practice so you can quickly modify the added stock if necessary. You might even consider making that a model parameter for greater visibility and ease of adjustment.

Important Note: The Measure.Extents iLogic variables provide the bounding box for the entire visible model, including work features. For this reason you’ll notice the above rule first runs a second rule called “ToggleWorkFeatures”. This rule turns off the visibility of all work features, allowing the Measure.Extents variables to return only the extents of the geometry. Here’s the rule:

iLogic

This is an example of incorporating the Inventor API into an iLogic Rule. This is a common practice, and it greatly expands iLogic’s capabilities.

Finishing Touches

Ok, so we have a stock size now - isn’t that great? We need to be careful when applying a rule like this, though. The rule firmly assumes that the part is prismatic and not cylindrical. It also assumes that the part is being made out of a single piece, and is suitable for machining from a single billet. We can make provisions for two common cases where this is not true and either warn the user that the generated stock size may not be appropriate or refuse to generate a stock size at all. This will require a bit more use of the Inventor API, but it’ll ultimately be worth it for data integrity and peace of mind.

We’ll start with cylindrical shapes. While we can’t catch all such shapes, we can eliminate many – especially if you follow a design practice where your cylindrical shapes are built primarily from Revolve features. We’ll make this check extremely conservative; if any feature in the part’s model tree is a Revolve feature we’ll consider it inappropriate for automatic stock size generation. First we’ll need a rule that determines if any of the features in the model are Revolve features. Here’s a simple rule to determine that:

iLogic

Note this makes use of a custom user parameter named Prismatic. This is a Boolean parameter that stores whether or not the part is considered prismatic or not. This rule also starts out with the assumption that the part is prismatic, then checks to see if that assumption is incorrect. This is an important logical construct when using iLogic; if our rules make decisions based on the contents of the model, we must always be sure to account for model changes and reset our state storage variables appropriately.

The second situation we need to account for is when the part we’ve modeled isn’t machined, and instead may be a weldment. We can check for situations like this by comparing the volume of the bounding box (which is being used for the stock size) against the volume of the solid itself. Here’s a section of the code to accomplish this:

iLogic

Note this makes use of another user parameter named RemovedMaterialPercentageThreshold. This is a value set by the user to indicate when the calculated stock size is inappropriate. For example, if the value of RemovedMaterialPercentageThreshold is set to 50, the generated stock size would be considered inappropriate if more than 50% of that material would have to be removed to reach the actual volume of the solid. The reason I chose to make this a user parameter is because depending on the type of part that number may need to be higher or lower. Exposing it as a parameter makes it easy for a user to specify an appropriate value.

To tie it all together we need to warn the user that the stock size was not automatically generated. It’s also a good idea any time your rules might repeatedly generate message boxes to provide the user with a way to disable those boxes. Here’s the updated Stock Size rule that incorporates the check for a cylindrical part, for weldments, and controls user notification:

iLogic

Sizing It All Up

The way I approached the creation of this utility is my favorite way to implement iLogic. Start with something simple that solves a problem in a good percentage of cases, then expand on the original solution to make it more and more capable. Here’s a summary of what we’ve done:

  • Created a rule named Properties Reminder to display a dialog box upon document save to remind us to fill out important properties when we have the information close at hand
  • Created a rule called Stock Sizeto automatically determine the stock size of our part
    • This included the creation of a rule called ToggleWorkFeatures that ensures all work features have been turned off. This is required for proper stock size creation
    • Expanded our Stock Sizerule to account for some common situations where it’s not appropriate
      • This included the creation of a StockSizeChecks rule to determine if the part is made up of any Revolved features

Here are some ways this utility could be further improved:

  • Format the stock sizes into fractional values using the iLogic RoundToFraction() function
  • Provide a multi-value parameter for users to select a ‘part type’ (i.e. weldment, bracket, etc.) that would adjust the value of the RemovedMaterialPercentageThreshold parameter to a suitable value for certain types of parts
  • Determine stock sizes for cylindrical parts as well as prismatic parts
    • For example, institute a design rule that an ‘OD’ parameter used by a base Revolved feature always specifies the diameter of the stock size, then use that parameter value in conjunction with bounding box information
    • Use iLogic to connect to a spreadsheet that includes part numbers to automate the part numbering process

Reference Information

You can download a sample part that contains all the rules and parameters here:

https://www.dropbox.com/s/4aa2t3dgw1sdzv4/iLogicStockSizeSample.ipt?dl=0

The above part is in Inventor 2015 format. If you’re using an older version of Inventor you can download the rules as plain text here:

https://www.dropbox.com/s/qoehglw7rwe648j/StockSizeRules.txt?dl=0

Note: All Inventor files and code are provided as-is with no guarantee of functionality.

If you would like more information about how Hagerman & Company can help with your customization, design automation, or document management needs feel free to contact us via either phone or the web via our Contact Page.

Submitted by Forrest Judd, Manufacturing Solutions Engineer, Hagerman & Company, Inc.

Comments