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 by entering the syntax in the editor. Alternatively, you can select items from the 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: 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 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 how to create a rule that retrieves the abscissa of a point. Depending on the coordinate value, it displays one 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\Knowledgeware EngineeringRulesCaptureSamples 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).
    1. Replace the default comments.
    2. 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, 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.