Manage Part Configurations

We now cover the last two topics listed in the beginning of this tutorial:

iLogic provides built-in functions that read information from Excel spreadsheets. These functions are available in the Snippets area, on the System tab, by expanding the Excel Data Links node.

In this lesson, we write a rule that uses values from an embedded Excel spreadsheet to set the values for parameters that control the port geometry, based on a specified size. Our rule looks up the port size in the spreadsheet to identify the row of values. Then it reads fields from that row to get the appropriate parameter values.

A tee-style block includes three ports. Each port is listed in the Parameters dialog box. However, changing the port size in the Parameters dialog box does not change the port size in our model. We must add rules to drive the different port sizes.

Our first step is to add a rule that sets the size of the ports and the dimensions of the screw pattern around each port. The screw pattern is used in the assembly to hold a flange onto the block.

  1. In the Autodesk Inventor model browser, expand the 3rd Party node in the tree.
  2. Right-click on Embedding 1, and select Edit to access the embedded spreadsheet.
  3. Add a rule named port_size_rule, and click OK to open the Edit Rule dialog box.

    The first thing our rule must do is locate the row in the spreadsheet that contains the values to use for Port A. We look up the value matching the port_a_size parameter in a column labeled port_size.

  4. In the Snippets area of the dialog box, on the System tab, locate the function labeled FindRow (embedded) in the Excel Data Links node. Double-click the function to insert it into the text area.

    Copy Code Block

    i = GoExcel.FindRow(“3rd Party:Embedding 1”, “Sheet1”, “columnName”, “<=”, 0.2)
  5. Once you inserted this function template into your rule, replace the first occurrence of columnName with port_size, the first occurrence of “<=” with “=”, and 0.2 with port_a_size.

    Copy Code Block

    i = GoExcel.FindRow("3rd Party:Embedding 1", "Sheet1", "port_size", "=", port_a_size)

    This code 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.

  6. Add a series of parameters based on the values of cells from this row in the spreadsheet. These parameters control the port diameter, drill depth, and the distance between the bolt holes. Use the function labeled CurrentRowValue in the Excel Data Links node of the Snippets area.

    Copy Code Block

     i = GoExcel.CurrentRowValue("columnName")

    Edit your copies of the snippet as shown here.

    Copy Code Block

    port_a_y_dist_between_screw = GoExcel.CurrentRowValue("y_dist_between_screw")
    port_a_x_dist_between_screw = GoExcel.CurrentRowValue("x_dist_between_screw")
    port_a_port_dia = GoExcel.CurrentRowValue("port_dia")
    Port_A_Drill_Depth = GoExcel.CurrentRowValue("tap_drill_depth")
    Note: Remember that you can select items in the Model tab of the Edit Rule dialog box to display various sets of Model parameters.
  7. To define the thread of the tapped holes, insert the feature labeled ThreadDesignation in the Features node of the Snippets area.

    Copy Code Block

    Feature.ThreadDesignation("featurename") = “3/8-16 UNC”

    Modify the text as shown here.

    Copy Code Block

    Feature.ThreadDesignation("Port_A_Threads") = GoExcel.CurrentRowValue("tap_dim")

    We have indicated that we should use the tap_dim cell to get the thread designation for the bolt holes.

  8. Now that the instructions are complete for the Port A parameters, create the instructions for Port B and Port C. Copy the rule text you have created, and paste it twice. In the first copy you paste, change port_a references to port_b. In the second copy you paste, change port_a references to port_c. You should now have three blocks of code, each related to one of the three ports.

    Copy Code Block

    i = GoExcel.FindRow("3rd Party:Embedding 1", "Sheet1", "port_size", "=", port_a_size)
    port_a_y_dist_between_screw = GoExcel.CurrentRowValue("y_dist_between_screw")
    port_a_x_dist_between_screw = GoExcel.CurrentRowValue("x_dist_between_screw")
    port_a_port_dia = GoExcel.CurrentRowValue("port_dia")
    Port_A_Drill_Depth = GoExcel.CurrentRowValue("tap_drill_depth")
    Feature.ThreadDesignation("Port_A_Threads") = GoExcel.CurrentRowValue("tap_dim")
    
    i = GoExcel.FindRow("3rd Party:Embedding 1", "Sheet1", "port_size", "=", port_b_size)
    port_b_y_dist_between_screw = GoExcel.CurrentRowValue("y_dist_between_screw")
    port_b_x_dist_between_screw = GoExcel.CurrentRowValue("x_dist_between_screw")
    port_b_port_dia = GoExcel.CurrentRowValue("port_dia")
    Port_B_Drill_Depth = GoExcel.CurrentRowValue("tap_drill_depth")
    Feature.ThreadDesignation("Port_B_Threads") = GoExcel.CurrentRowValue("tap_dim")
    
    i = GoExcel.FindRow("3rd Party:Embedding 1", "Sheet1", "port_size", "=", port_c_size)
    port_c_y_dist_between_screw = GoExcel.CurrentRowValue("y_dist_between_screw")
    port_c_x_dist_between_screw = GoExcel.CurrentRowValue("x_dist_between_screw")
    port_c_port_dia = GoExcel.CurrentRowValue("port_dia")
    Port_C_Drill_Depth = GoExcel.CurrentRowValue("tap_drill_depth")
    Feature.ThreadDesignation("Port_C_Threads") = GoExcel.CurrentRowValue("tap_dim")
  9. Click OK in the iLogic rule editor to save your port_size_rule. Your model may or may not update depending upon how the iLogic port size parameters were initially set.

Previous | Next