Using Rules

This task introduces the Knowledge Advisor rules. 
Unlike the parameter and formula capabilities which are available to all CATIA users, the rule and check capabilities require the Knowledge Advisor product. 

For more information about Rules, see Working with the Rule Feature. For more information about the Rule Editor, see Using the Rule Editor.

ascenari.gif (1364 bytes)
  1. Select the KwrStartDocument item in the specification tree

  2. Access the Knowledge Advisor workbench from the Start>Knowledgeware menu.

  3. Click the I_RulesP2.gif (241 bytes) rule icon. The following dialog box is displayed:

    The dialog box fields display default values that can be modified:

    • The rule name: Rule.1. The first rule created in a document is Rule.1 by default.
      This name is the one displayed in the specification tree unless you modify the default name at creation.

    • The user and the date of creation.

    • The destination, i.e. the feature you are going to add the rule to. By default, in this scenario, the destination is the Relations feature (the Relations node in the specification tree). But a rule could be added to another feature, then only apply to this feature.

  4. Replace the Rule.1 string with Cylinder_Rule, if need be modify the comments but don't modify the destination. Click OK. The Rule Editor is displayed (see below).

  5. Type the code below into the edition box or copy/paste it from your browser to the edition box.

    PartBody\Hole.1\Activity = true
    if PadLength <= 50mm and PadLength > 20mm
    {
    PartBody\Hole.1\Diameter = 20mm
    Message("PadLength is: # | Internal Diameter is: #",
    PadLength,PartBody\Hole.1\Diameter)
    }
    else if PadLength > 50mm and PadLength < 100mm
    {
    PartBody\Hole.1\Diameter = 50mm
    Message("PadLength is: # | Internal Diameter is: #",
    PadLength,PartBody\Hole.1\Diameter)
    }
    else if PadLength >= 100mm
    {
    PartBody\Hole.1\Diameter = 80mm
    Message("PadLength is: # | Internal Diameter is: #",
    PadLength,PartBody\Hole.1\Diameter)
    }
    else
    {
    PartBody\Hole.1\Activity = false
    Message("PadLength is: # | Internal Diameter is: #",
    PadLength,PartBody\Hole.1\Diameter)
    }

    Users working in a Japanese environment must use the script below:

    `PartBody\Hole.1\Activity` = true
    if `PadLength` <= 50mm and `PadLength` > 20mm
    {
    `PartBody\Hole.1\Diameter` = 20mm
    Message("PadLength is: # | Internal Diameter is: #",
    `PadLength`,`PartBody\Hole.1\Diameter`)
    }
    else if `PadLength` > 50mm and `PadLength` < 100mm
    {
    `PartBody\Hole.1\Diameter` = 50mm
    Message("PadLength is: # | Internal Diameter is: #",
    `PadLength`,`PartBody\Hole.1\Diameter`)
    }
    else if `PadLength` >= 100mm
    {
    `PartBody\Hole.1\Diameter` = 80mm
    Message("PadLength is: # | Internal Diameter is: #",
    `PadLength`,`PartBody\Hole.1\Diameter`)
    }
    else
    {
    `PartBody\Hole.1\Activity` = false
    Message("PadLength is: # | Internal Diameter is: #",
    `PadLength`,`PartBody\Hole.1\Diameter`)
    }
  6. Click Apply. An information window displays the PadLength and Pad internal diameter values. Click OK in the Information window. The Cylinder_Rule relation is added to the specification tree.

  7. Click OK to terminate this part of the dialog. Keep your document open and proceed to the next task.