In AVEVA Diagrams the user can define rules to be applied during consistency checks. The Consistency Rules and the Formatting Rules both reside in the Diagrams Rules form which can be reached via the Rules
command from the Admin tab.
The Consistency Rules provide functionality to configure actions depending on user defined conditions and create fully configurable definitions when a consistency check is made.
In the Diagrams Rules form, the main nodes will be displayed under the Diagrams Rules node. It is not possible to remove or reorder these nodes, but they could be checked, partially checked or unchecked to determine whether the rules beneath are active or not. The same could be applied to rule sets or individual rules as well. When a rule or rule set is not active it will be skipped by the consistency check, but could be either executed manually or automatically on certain events.
Using the right click context menus, the user can execute a number of commands.
Save This will save the changes made to the current rule set.
Export This will export the current rule set to an xml file.
Import This will import a rule set from an xml file.
Restore This will discard any unsaved changes, and will restore the current rule set from the latest saved point.
Apply This will apply the current rule.
Create Rule Set This will create a new rule set.
Create Rule This will create a new rule.
Delete This will delete a rule set.
Cut This will cut a rule set or a rule.
Copy This will copy a rule set or a rule.
Paste This will paste a cut or copied rule set or a rule.
RuleDetails This will open the Diagrams Rule Details form for the current rule.
Copying and re-ordering is only possible in the scope of one kind of rules. As well as using the right click context menu, drag and drop can be used to re-order the rules
Depending on the hierarchy, it is possible to execute the commands on the right hand side of the form as well
Consistency rules can be specified by modifying their rule name and description, selection criter ia, check to be performed on pre-selected shapes and the action to be taken on non-satisfying shapes. The details of each rule can be viewed and modified using the Diagrams Rule Details form.
The name and the description of the rules can be changed any time using the appropriate fields at the top of the form.
In the Shape Selection Criteria, the user can determine which elements should be taken into account while performing consistency check, e.g. bore size should be checked for inline components only. From the drop down list, Type & attribute value, PML Expression or Shapes without DB element can be selected. Each of these options will enable the form to display attributes; a textbox to define the PML expression or further options to specify the condition for the shapes without database element.
The administrator can also determine which shapes are selected using a Visio formula to filter the shapes on the page. i.e., formula (BeginX- EndX)*(BeginX-EndX)+(BeginY-EndY)*(BeginY-
EndY)>10mm could be used if the rule should be applied to shapes matching the given database criteria and in addition only if the length of the connector is greater than 10 mm.
Once the selection criteria are given, it is possible to highlight the matching shapes on the currently open drawing using the Highlight link label. The highlight could be reset using the Reset highlight link label. The shapes selected according to the shape selection criteria will
be checked against the definition given as a PML expression or the definition selected from the library as shown.
The PML expression should be a Boolean type and it should return a value of TRUE. Returning a FALSE value will cause the actions in the next tab to be applied to all shapes on the page that don’t comply with the shape selection criteria.
There are a number of standard checks defined in Diagrams Consistency Rules Library, but it is also possible to define custom checks. They should be defined as classes implementing
IDiagramsRulesCheck specified in
Aveva.Diagrams.DiagramsRules in Aveva.Diagrams.dll. To be automatically picked up, the class defining check should be placed in a dll named *ConsistencyRulesLibrary.dll.
Checking the Execute for each connection checkbox will apply the definition for every connection of a given shape and action will be performed on every failed connection. If this option is un- checked, checks are performed only once for every shape matching selection criteria.
On the Actions tab, the administrator can define actions to be taken on the shapes that have been selected by the shape selection criteria and failed to satisfy check definitions.
The action can be defined as a PML macro which can be any operation to be executed on a database element connected with a shape.
In addition, it is possible to select a number of actions from library. They can be added or removed by using Add action and Remove action link labels. Actions are executed in the order they appear in the list. To modify this Move up or Move down link labels can be used.
Similar to the check definition, actions are also pre-defined in Diagrams Consistency Rules Library, and also can be added by the administrator. To add custom actions, the administrator should define class implementing IDiagramsRulesActon specified in
Aveva.Diagrams.dll. To be automatically picked up, the class defining check should be placed in a dll named *ConsistencyRulesLibrary.dll.
As well as actions, severity of the rule and a message could be added to the rule details using the Actions tab. The severity could be selected as Information, Warning or Error. The icon displayed in the Message Log will depend on the severity of the rule and will be different for each. The message to be displayed in the Message Log can be typed in the Message field.
Using the Rule Options tabs could be helpful in customising the behaviour of the rules on certain events.
Don’t execute rule on events The rule will be executed manually.
Use default configuration Behaviour depends on the Consistency Rules settings in Diagram Options.
Custom configuration Behaviour is specified locally for the rule and doesn’t depend on default configuration.