Creating a Rule    

The task described below explains how to create a rule which retrieves the abscissa of a point and, depending on the coordinate value, displays a message or another.

This scenario uses two special functions allowing you to retrieve the coordinates of a point. These functions can be accessed from the Measures item of the Dictionary. 

A rule is a multiline statement that you can write either by typing directly the appropriate syntax in the editor field or by selecting items from the editor dictionary list. For more information about the language to be used in rules, see Knowledgeware Language.
  1. Open the KwrMeasure.CATPart document. The whole document has been created using the Generative Shape Design product. The extruded surfaces are extruded from the Spline.1 and Spline.2 curves. The point whose coordinates are to be retrieved and tested is Point.5. 

  2. From the Start > Knowledgeware menu, access the Knowledge Advisor workbench.

  3. Use the I_FormulaP2.gif (164 bytes) editor to create three Length type parameters:  Point5X, Point5Y and Point5Z. 

  4. Click the icon. In the first dialog box which is displayed, enter a rule name (MeasureRule for example). If need be, replace the default comments. If you want to add the rule to be created to a specific relation set, specify a destination. To do so, see Creating Sets of Relations.

  5. Click OK. The Rule Editor is displayed. 

  6. Enter the rule below in the edition window. 

    if Geometrical Set.1\Point.5.coord(1) > 0mm 
    Message("Point.5 abscissa is positive")
      Geometrical Set.1\Point.5.coord(Point5X, Point5Y, Point5Z)
      Message("Point.5 abscissa is:  # ", Point5X)
  7. In the rule above, you can retrieve the Point.5 definition (Geometrical Set.1\Point.5) by double-clicking the feature in the specification tree.

  8. Click OK. The message "Point.5 abscissa is: 0mm" is displayed.

  9. Edit the Point.5 feature (double-click the object in the specification tree for example) and replace the Point.5  X value with 10 mm. The rule is in a to-be-updated status. See Updating Measures for information on relations to be updated.

  10. Re-access the Knowledge Advisor workbench, then click the icon. A message box informs you that "Point.5 abscissa is positive").

For more information about the Rule Editor, see Using the Rule Editor.