Question: How can I allow for multiple different ‘Design Intents’ in an iLogic part or assembly?
What do I mean by this? Well take a look at the picture above. This is a filter assembly (that I’ve modelled as a single part for convenience), which is constructed from rectangular filters of any width we choose, in order to fill the total installation width with a certain quantity of columns. We have 3 simple parameters that we can vary on this assembly. These are:
Width of the individual filters
Total width of the assembly
Quantity of columns
So far so good. But wait a minute – normally in parametric modelling we have to make a decision about which parameters will be the ‘controlling’ or ‘master’ parameters. And then we calculate the other parameters based on the master parameters. For instance, we could specify the FilterWidth, and the TotalWidth, and we could then calculate ColumnQTY = TotalWidth/FilterWidth). Or we could specify TotalWidth and ColumnQTY and then calculate FilterWidth as TotalWidth/RowQTY. So if you think about it we have overspecified this assembly – one of these three numbers is redundant: we only need two numbers to fully specify.
But as a user, I want to allow any of these 3 parameters to be the ‘controlling’ parameter. Therefore the iLogic code will need to recognise which of the three parameters has been changed by the user. This changed parameter then becomes the ‘controlling’ parameter, and the code modifies the other parameters as required.
So here are the three scenarios that need to be identified by the iLogic rule:
Scenario 1: TotalWidth has been changed by the user. Adjust the ColumnQTY for the current value of FilterWidth. Then check to see if a ‘filler’ filter is required.
Scenario 2: FilterWidth has been changed by the user. Adjust the quantity of filter columns to suit TotalWidth. Then check to see if a ‘filler’ filter is required.
Scenario 3: ColumnQTY has been changed by the user. Adjust FilterWidth to ensure that TotalWidth is correct. Then suppress any filler filters.
We need a simple way of identifying which of the three parameters has been changed by the user. So how do we do this using iLogic?
We can’t have each of the 3 scenarios above in the same iLogic rule with a simple ‘If’ statement, as we’ll have no way of determining which of the three parameters has been changed by the user. And we can’t put each scenario in a different rule, as they will trigger each other and overwrite each other’s changes.
My favourite way to do this is to create a ‘memory’ parameter for each parameter, which stores the last set value of the parameter. This will then allow the iLogic rule to compare each ‘memory’ parameter against the actual (current) parameter value, identify which parameter the user has changed, and the rest is easy…
So I’m going to add these three ‘memory’ parameters into my part:
…and I will then be able to use lines of code like this to identify which of the three parameters has been changed by the user.
' Check if TotalWidth has changed...
If TotalWidth <> TotalWidthMemory Then
MessageBox.Show("Total Width has been changed", "Cadline")
And then I’ll need to make sure the ‘memory’ parameter is reset (to the updated new value) for next time.
' Remember value for next time...
TotalWidthMemory = TotalWidth
So armed with this knowledge we can get that iLogic rule together. See the video below showing each of the three parameters being updated using an iLogic form, and the design intent for scenarios 1, 2, and 3 being captured correctly.
You can download the iLogic Inventor part file with the link below (iLogic code included).
If you’re using Inventor 2014 or earlier, you won’t be able to open the part file, so you can download the iLogic code in a text file with the link below.