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. 
To know more about the Dictionary, see the Using the Dictionary. 

  1. Open the KwrMeasure.CATPart document. The whole document has been created with 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. Create three Length type parameters:  Point5X, Point5Y and Point5Z. 

  3. Select the root feature of the document and access the Knowledge Advisor workbench.

  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 Open_body.1\Point.5.coord(1) > 0mm 
    Message("Point.5 abscissa is positive")
    else
    {
      Open_body.1\Point.5.coord(Point5X, Point5Y, Point5Z)
      Message("Point.5 abscissa is:  # ", Point5X)
    }

    In the rule above, you can retrieve the Point.5 definition (Open_body.1\Point.5) by double-clicking the feature in the specification tree.

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

  8. 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.

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

To know more about the Rule Editor, see Using the Rule Editor.

Up Next