Rule configuration files

Rules are used for automatically processing construction parts in specified situations. A rule consists of a condition followed by an answer. The answer is an action that the system performs if the condition is met (it is true).

Rules are contained in rule configuration files (.cfg). Rules for most functions can be created in the System Management application. See Defining rules in System Management for more information. Some of the configuration files must be created and modified in a text editor. Rules that can be defined in the System Management application can also be created and modified with a text editor.

Types of rule configurations

Rule configurations can be defined for the following functions and purposes:

  • Predefined bevels that the system applies to plate connections. See Plate beveling rules.

    • File naming – pdbrule0000.cfg, pdbrule0100.cfg, pdbrule0200.cfg, and pdbrule0300.cfg. See Rules for specific connection types.

    • File location – cvar\weld subfolder of the project's norms folder %ncgnorms%

  • Predefined bevels that the system applies to profiles and their end shapes. See Profile beveling rules.

    • File naming – profilepdb<number>.cfg, where number is a four-digit integer ranging from 0001 to 9999

    • File location – weld subfolder of the project's norms folder %ncgnorms% (<project>\norms\cvar\weld for centralized norms)

  • Logistical rules for returning values based on the logistical properties of the parts. These can be used for reports and part labels in drawings. See Rule Definitions.

    • File naming – rule<number>.cfg, where number is a four-digit integer ranging from 0001 to 9999

    • File location – cvar\logistics subfolder of the project's norms folder %ncgnorms%

  • Modifying the logistical information of parts for process codes. See Use Rules.

    • File naming – rule<number>.cfg, where number is a four-digit integer ranging from 0001 to 9999

    • File location – cvar\logistics subfolder of the project's norms folder %ncgnorms%

  • Logistical color filter scheme for Hull Viewer. See Logistical color filter rules.

    • File naming – logcol<number>.cfg, where number is a four-digit integer ranging from 0001 to 9999

    • File location – the project's norms folder %ncgnorms%

  • Automatic shrinkage compensation for bevels. See Compensation Rules.

    • File naming – compensation####.cfg, where #### is a four-digit integer ranging from 0001 to 9999

    • File location – the cvar\weld of the project's norms folder %ncgnorms%

  • Weld side rules – For defining the weld side in different situations.

    • File naming – weldside####.cfg, where #### is a four-digit integer ranging from 0001 to 9999

    • File location – the cvar\weld subfolder of the project's norms folder %ncgnorms%

  • Weld factor rules – For defining the weld throat in different situations.

    • File naming – weldfactor####.cfg, where #### is a four-digit integer ranging from 0001 to 9999

    • File location – the cvar\weld subfolder of the project's norms folder %ncgnorms%

Rule nesting

The 4-digit number in the file name enables rule nesting, which allows one rule to reference another. In this setup, the referenced rule serves as the response (answer) for the referencing rule. This means that rules can be split into multiple rule configuration files, which improves the structuring and organization of the rules. A maximum of 16 levels of rule nesting is possible.

Structure and syntax of a rule configuration file

Structure

The structure of a rule configuration file is always as follows:

  • First line – Description. For giving a description to the user about the purpose of the rule. The system does not use this. Can be left empty.

  • Line between the first and the last line – Condition–answer pair. A condition is a conditional expression that the system evaluates. The answer defines an action that the system performs if the condition is met.

  • Last line – Default answer. Used as the answer if none of the conditions is true.

Syntax

Syntax example:

Thickness // Description
thickness<10 $ RGB(255,0,0) // Expression 1
thickness>=10 and thickness<20 $ RGB(0,255,0) // Expression 2
thickness>=20 $ RGB(0,0,255) // Expression 2 
RGB(0,0,0) // Default answer

The first line is the description. The last line is the default answer.

All other lines are condition–answer pairs.

The lines are evaluated from the top down until one evaluates to TRUE. The answer on that line is returned.

If none of the expressions evaluates to TRUE, the default answer is returned.

Continuation character

The continuation character [ can be used to spread long lines accross several lines. The system will ignore the character itself and concatenate the next line to the current one.

Note: Using the rule editor in the System Management application will result in loosing the continuation character. The expression (and answer) will be on a single line.

Conditions and answers

The lines between the first and last line in a rule configuration file contain condition–answer pairs, one pair on each line.

The condition must be followed by an answer. The condition must be separated from the answer by a dollar sign:

<condition> $ <answer>

Conditions

A condition is a logical expression that must evaluate to either TRUE or FALSE (a Boolean value). In other words, it should involve a comparison that checks a specific scenario. Examples:

thickness>10.0 and thickness<=20.0

and

panel==”A”

Answers

The answer can either be a string, a number value or a Boolean value.

The answer can also be a refrence to another rule. The answer of the referenced rule will be used as the answer. For example:

thickness>=10 and thickness<20 $ rule0021.

Referencing another rules can be used for rule nesting. This allows for better structuring and organizing of the rules because one can have separate rule files for different types of construction. For example:

c_code==c_code_plate $ rule0002

c_code==c_code_bracket $ rule0003

c_code==c_code_shellframe $ rule0004

c_code==c_code_profile $ rule0005

 

Note: The system always invokes the rule file with the lowest number first, usually 0001

 

If the answer is a string, it can be composed of multiple parts so that the answer is a concatenation of these parts. For example:

thickness>10.0 and thickness<=20.0 $ thickness.32.0.2.0 ” (Average)”

or

panel==”A” $ 0.50*thickness

 

The answer can be formatted. See Field format editor for information on the format codes.

Functions, operators, variables and constants

For information on the functions, operators, variables and constants that the rule parser recognizes and can be used within the rule system, see the following help topics: