Creating a Rule

A rule is a set of instructions, generally based on conditional statements, where the relationship between parameters is controlled. You can write it either by directly entering the appropriate syntax in the editor box or by selecting items from the editor dictionary list.


Before you begin: You must have created parameters.
See Also
Creating Sets of Relations
Updating Relations Using Measures
  1. From the Compass, click 3D Modeling Apps , and select Engineering Rules Capture.
  2. Create the rule. To do so, do the following:
    1. Click Rule .
    2. Enter a rule name.
    3. Optional: If need be, replace the default comments.
    4. Optional: If you want to add the rule to be created to a specific relation set, specify a destination.
    5. Click OK.
    6. In the Rule Editor, enter your rule script.
    Important:
    • You may also create a rule by clicking the relation specified in the tree and clicking Rule .
    • The editor supports the autocompletion allowing you to access available variables, knowledge types, or methods. For example, when you declare a new variable, the list of available known Knowledge types is automatically displayed.
    • You can use the following keyboard shortcuts in the editor:
      • Ctrl+Z: Undo. Lets you delete the last word you entered.
      • Ctrl+Y: Redo.
      • Ctrl+F: Search in text.
      • Ctrl+A: Select all.

Example

This example shows you how to create a rule that retrieves the abscissa of a point and, depending on the coordinate value, displays a message or another. It 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.

Import and open the Sample1.3dxml file located in the startup\KnowledgewareEngineeringRulesCaptureSamples directory.

  1. From the Compass, click 3D Modeling Apps , and select Engineering Rules Capture.
  2. Click Formula to create three Length type parameters: Point5X, Point5Y, and Point5Z.
  3. Click Rule . 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.
  4. Click OK.
  5. Enter the rule below in the editor.
  6. In the rule, you can retrieve the Point.5 definition (PartBody\Point.5) by double-clicking the feature in the tree.
  7. Click OK. The message Point.5 abscissa is: xxxmm appears.