Managing iLogic Part Configurations
We will now cover the last two topics listed in the beginning of this tutorial:
- Reading data from an embedded spreadsheet
- Setting feature and component activity
Now we will write a rule that uses values from the embedded Excel spreadsheet to set the values for parameters that control the port geometry, based on a specified size. We will look up the port size in the spreadsheet to identify the row of values that we want, and then read fields from that row to get the parameter values to use.
Go to the iLogic Parameter Editor and change the block parameter from elbow back to tee. When we have a Tee style block, there are three ports. Each port is listed in the iLogic parameter editor, but changing the port size in the parameter editor will not change the port size in our model. We have to add rules to drive the different port sizes.
Our first step will be to add a rule that will set the size of the ports and the dimensions of the screw pattern around each port. The screw pattern will be used in the assembly to hold a flange onto the block.
Add a rule named “port_size_rule”. Click OK. The rule editor will appear.
iLogic provides built-in functions that read information from Excel spreadsheets. These functions are available on the Rule Syntax tab, under the Data Links function category.
To access the embedded spreadsheet, go to the Inventor model browser, and expand the “3rd Party” item in the tree. Right-click on the “Embedding 1” entry, and choose “Edit”. The spreadsheet looks like this:
The first thing we need to do is to locate the row that contains the values to be used for Port A. We look up the value matching the port_a_size parameter in a column named “port_size”. The function to use is labeled i = GoExcel.FindRow(“3rd Party:Embedding 1”, “Sheet1”, “columnName”, “<=”, 0.2, “columnName”, “<=”, 4.1) in the rule editor. Once you have inserted this function template into your rule, replace “columnName” with “port_size”, “<=” with “=”, and 0.2 with port_size.
i = GoExcel.FindRow(“3rd Party:Embedding 1”, “Sheet1”, “port_size”, “=”, port_a_size)
This indicates that we want to find the row in the embedded spreadsheet that has a port_size column that equals the value of the port_a_size parameter.
iLogic Introduction Tutorial Links
Intro – 1 – 2 – 3 – 4 – 5 – 6 – 7 – 8 – 9 – 10