Create Rules in the Assembly

Let’s begin to write this iLogic rule. Create a new rule named “port_b_rule”. Populate the rule as follows…

The first thing that we’ll do is decide whether we’re making a tee style block, and remember that in a separate variable. We’ll then use this variable later to set other parameters.

If block = “elbow” Then
isTee = False
Else
isTee = True
End If

We’ll use the value of the isTee variable later – it holds a True or False value to indicate whether we are making a tee manifold.

We are now going to add lines to our rule that will turn off the constraints that locate the union and union screw when the manifold block is an elbow, and turn them on when we’re making a tee style. Notice how we can use the isTee variable to turn these constraints on or off according to the value of the block parameter.

Constraint.IsActive(“port_b_cap_center”) =isTee
Constraint.IsActive(“port_b_cap_hole”) = isTee
Constraint.IsActive(“port_b_cap_face”) = isTee
Constraint.IsActive(“port_b_cap_screw”) = isTee

Notice how specifying the names of these constraints has made it easier to refer to them in this rule. Also keep in mind that you can use the model tree information provided on the Components tab of the rule editor to help fill in the names of the constraints.

iLogic iProperties

Next, we add two additional lines to conditionally include the Port B Union part, and corresponding screw pattern:

Component.IsActive(“port_b_union”) = isTee
Component.IsActive(“port_b_screw_pattern”) = isTee

These both use the same “isTee” variable used previously. When the screw pattern is suppressed, the screw component itself is also suppressed.

Next, if we are using a Port B, we need to set the port size, the parameter values that control the screw pattern, and the Port B union part number.

if isTee Then
i = iPart.FindRow(“port_b_union”, “port_size”, “=”, port_b_size)
port_b_y_dist_between_screws = iPart.CurrentRowValue(“y_dist_betwn_screw”)       port_b_x_dist_between_screws = iPart.CurrentRowValue(“x_dist_betwn_screw”  port_b_union_part_number = iProperties.Value(“port_b_union”, “Project”, “Part Number”)
End If

Don’t close the editor, more on next page…

Inventor iLogic Tutorial Navigation

Intro123456789101112131415161718