Create Rules in the Assembly Continued…

Notice how we’ve enclosed this entire block in an “If isTee” statement, so that these lines are only processed if we’re using a tee-style manifold block. The statement “if isTee then” is the equivalent of “if isTee = True Then” but provides a more concise expression format.

Here, we first choose the appropriate row in the union part’s iPart table, corresponding to the value of the port_b_size parameter, and then extract the values that are to be used for the x and y pattern offsets. Then, we extract the Part Number from the union part, and store its value in another parameter for later reference.

Choosing the Port B Screw Size

The last part of this rule will choose the member within the screw part’s iPart table to use for Port B. This will be based on the value of the port_b_size parameter. We use a series of If/Then/Else statements to control this.

If port_b_size = .50 then
iPart.ChangeRow(“port_b_union_screw”, “Screw-01”)
elseif port_b_size = .75 then
iPart.ChangeRow(“port_b_union_screw”, “Screw-02”)
elseif port_b_size = 1.00 then
iPart.ChangeRow(“port_b_union_screw”, “Screw-02”)
elseif port_b_size = 1.25 then
iPart.ChangeRow(“port_b_union_screw”, “Screw-03”)
elseif port_b_size = 1.50 then
iPart.ChangeRow(“port_b_union_screw”, “Screw-04”)
elseif port_b_size = 2.00 then
iPart.ChangeRow(“port_b_union_screw”, “Screw-04”)
elseif port_b_size = 2.50 then
iPart.ChangeRow(“port_b_union_screw”, “Screw-05”)
elseif port_b_size = 3.00 then
iPart.ChangeRow(“port_b_union_screw”, “Screw-06”)
end if

We could have included all of these lines within the “If isTee” block above, since the screw only matters if we’re actually including it in our model. To simplify the rule, however, we’ve kept these lines separate which has no effect on the results the rule produces.

This completes the port_b_rule. Press OK to close the dialog box and save the rule.

Before you continue, save the file.

Inventor iLogic Tutorial Navigation

Intro123456789101112131415161718