Testing the New iLogic Rule (Port_Size_Rule) Continued
Notice that we’ve used a new “local variable” named “port” to hold the size of the largest available port. Now we have to tell the model what to do with this information. This model is getting its information from an embedded Excel spreadsheet. We will need to look at the spreadsheet to update the overall sizes of this model.
Press Enter twice to add some white space in the rule.
As with the previous rule, we will use information from the embedded spreadsheet to get the values for other parameters. We first need to locate the row of information in the embedded spreadsheet.
Here, we’re again using the port_size column for the lookup, and using the value of the variable assigned above as the value to look for.
We will now set some model parameters with information from the embedded Excel spreadsheet, using the row we found for the largest port size.
port_c_depth_from_front = GoExcel.CurrentRowValue(“port_c_depth_from_front”)
block_width = GoExcel.CurrentRowValue(“block_width”)
port_a_hor_offset = GoExcel.CurrentRowValue(“hor_offset”)
port_b_hor_offset = GoExcel.CurrentRowValue(“hor_offset”)
port_c_hor_offset = GoExcel.CurrentRowValue(“hor_offset”)
So far we have figured out which port is the largest, and we are sizing the top of the block according to these sizes. We will examine the tee and elbow to determine which port size is bigger on the port a / port b face to determine height of the block.
For this, we will use another local variable, “porta”, to hold onto this value. Again, since Port B is not used for elbow-style blocks, we have different steps depending on this setting.
porta = MaxOfMany(port_a_size, port_b_size)
ElseIf block = “elbow”
porta = port_a_size
Notice that, for elbow-style blocks, we don’t use the MaxOfMany function, since there’s only one value to consider. We can just set the variable from that value.
Now we need to tell the model where to get the values for the height of the block. We will go to the Excel spreadsheet again to get this information.
Here, we find the correct row to use, based on the local variable we just set. We will now set the height of our block.
port_b_vert_offset = GoExcel.CurrentRowValue(“vert_offset”)
Almost finished. We need to set the value for two additional parameters. One of these will set the block height. The other will set the vertical offset of Port C. For this value, we have some special logic, which adds some extra space beyond the vertical offset used for the other ports. We get this from another spreadsheet cell. Note that we only do this for elbow-style blocks.
port_c_vert_offset = GoExcel.CurrentRowValue(“vert_offset”) + (GoExcel.CurrentRowValue(“port_dia”)/4)
port_c_vert_offset = GoExcel.CurrentRowValue(“vert_offset”)
block_height = GoExcel.CurrentRowValue(“block_height”)
This finishes up the lock_size_rule rule. Click OK in the iLogic Rule Editor to see the effect of this rule. Change any of the port sizes in the iLogic Parameter Editor and see the model update.
iLogic Introduction Tutorial Links