Define iLogic Rules for the 3D Model
Now, we define a set of iLogic rules that will drive the geometry of the model based on the values of the key parameters we defined above. In this section, we will construct each rule in segments. The entire text of all of the rules can be found in the appendix at the end of the document for easy review later.
Adding a iLogic Rule to Control Port Visibility
The first rule we need to add will make model changes to the Port B features, based on whether the user wants an “elbow” or a “tee” block. This will involve suppressing or enabling the Port B-related features, based on the value of the block parameter.
Create a new rule named “block_shape_rule”. Recall that you add a new rule using the “Add Rule” button on the iLogic panel of the Manage tab.
iLogic Rules Editor
Once you’ve specified the new rule name in the Rule Name dialog, the iLogic Rule Editor dialog will be displayed.
Recall that, in the rule editor, you can use parameter names from the model as variables in your rule. Also, you can select from lists of the available parameters, as well as features and other model entities, for inclusion in your rule.
The first part of your new rule will handle the case where the block is a “tee”-style block.
Recall that for a tee-style block, all 3 ports will be active. In case Port B was previously disabled, we add the steps to (re)enable it, which involves activating two features in the part:
Feature.IsActive(“Port_B_Threads”) = True
Reminder: The Feature.IsActive function is available for selection on the Rule Syntax tab, in the Component/Feature function category. You can access the names of the available features on the Features tab of the rule editor.
We have now defined the behavior that we wish our model to take when block = “tee”. Now we will define the model behavior when the block = “elbow”:
When we’re creating an elbow block, we want to suppress the Port B-related features. Since this is simply the opposite of what we did for a “tee” block, we use the same function, but with opposite values:
Feature.IsActive(“Port_B_Threads”) = False
The easiest way to add these lines is to copy and paste the text from above, and then change “True” to “False” in the new lines.
This is all we need to do for the block = “elbow” case, so we can end the If block:
That’s it! You’ve now included all of the instructions necessary to enable or disable the Port B-related features based on the type of block to be used. If you haven’t already done so, click OK in the rule editor dialog to save the completed rule.
iLogic Introduction Tutorial Links