Automatic Pipe Routing Administration
- Last UpdatedJan 22, 2026
- 17 minute read
Routing Rules are special PDMS rules which are used to control, for example, how Pipe Router selects, positions and orientates components as Branches are routed, and also how Pipes are packed on Pipe Racks and Routing Planes.
You can apply routing rules to individual branches or all branches within a particular site, zone, or pipe, and you can also apply rules to individual components and remove rules from individual components, as required.
Routing Rule Purposes
There are different types of routing rules , which are used for different controls on the route. Rules are identified by their Purpose (PURP) attribute, and unlike other elements in PDMS, the user cannot create different, user-defined purposes for routing rules.
The routing rules available are listed below, identified by their PURP attribute, and with a short description. The purpose is set to a four-letter code, but it is sometimes shown as a more descriptive text on the PDMS Router forms.
Pre-processing
|
PRPR |
All rules with this Purpose will be executed before a Branch is routed. |
|
Selection |
|
|
BEND |
Bend or elbow selection: controls whether a bend or elbow is used for changing the direction of a pipe |
|
REDU |
Reducer type: specified when concentric or eccentric reducers are used |
|
Positioning |
|
|
DNSM |
Downstream pipe requirement: the length of pipe required downstream to the next component |
|
UPSM |
Upstream pipe requirement: the length of pipe required upstream from the previous component |
|
ELEV |
Component elevation: absolute or relative elevation of a component |
|
LOCA |
Component location: 3D position of a component |
|
Orientation |
|
|
MAJO |
Orientate on major axis: positioning on vertical or horizontal pipe segment. |
|
MINO |
Orientate on minor axis: such as the orientation of a handwheel |
|
Clash exclusion |
|
|
CLEX |
These rules are used to allow specified types of element to clash. |
Pipe racks (and routing planes) |
|
|
TRAV |
Pipe Rack travel plane selection: controls which pipe rack travel plane is used to route a particular type of branch |
|
ENTR |
Pipe Rack entry plane selection: controls which pipe rack entry plane is used to route a particular type of branch |
|
EXIT |
Pipe Rack exit plane selection: controls which pipe rack exit plane is used to route a particular type of branch |
|
SHOE |
Shoe height requirement |
|
WEIG |
Identify heavy pipe |
|
ADGP |
Extra gap required on plane or rack |
|
FLWI |
Flange width on plane or rack |
|
Post-processing |
|
|
POPR |
All rules with this Purpose will be executed after a Branch has been routed. |
How Routing Rules are Constructed
Routing rules consist of PDMS expressions which define:
-
Selection: the elements to which the rule applies.
All rules must have a selection expression.
-
A Logical test which evaluates to TRUE or FALSE. For example, (ATTRIB ADIR EQ D) specifies that the arrive direction is down.
Rules which use logical expressions are called logical rules. A Rule which does not have a logical expression is called a real rule, because its action (see below) is a real expression.
-
The Action which PDMS will carry out. The actions for logical rules will be carried out if the Logical test evaluates to False. For example,
-
(AXES PP 3 IS N) orientates a valve so that the P3 axis is in the north direction.
Actions
The Logical expression in a rule tests whether or not the component satisfies the rule. If not, that is, if the logical expression evaluates to False, and the rule has an action, the action will be applied. Pipe Router will then re-test the component. If the logical expression still evaluates to False, the Action will be reversed.
-
Logical rules may or may not have actions.
-
Real rules must always have actions.
-
Of the logical rules, the following use actions:
-
Minor axis
-
Elevation. If no action is specified, and the rule fails, a message is output.
-
Location. If no action is specified, and the rule fails, a message is output.
-
Upstream pipe requirement
-
Downstream pipe requirement
-
Pre-processing
-
Post-processing
-
If the user do not define an action for these rules, then the default action is taken, which depends on the rule.
Using PML Functions in Routing Rules
The Logical and Action expressions in Routing rules can call PML functions, which allows you to define much more complex logical tests and actions than can be done using simple expressions. A function is called by setting the rule action to a text string which is the name of the .pmlobj file. The file will contain the object definition, followed by a method definition.
The function must be defined using fixed names for the following elements:
|
CEREF |
The DBREF of the element the rule applies to. |
|
RESULT |
The returned boolean result. (Logical parts of rules only.) |
|
RULEMETHOD |
The method which is applied. |
|
OBSREF |
The DBREF of the Element clashing with the Branch. (Clash exclusion rule only). |
How Routing Rules are Applied
The following sections describe in detail which expressions are required by each type of rule, and how the rules are applied. Most of the examples are taken from Rules supplied with the product. To see more examples, select Settings > Routing Rules from the Pipe Router window, which will display the Routing Rules window. Select a Rule Set, then select a Rule from the list. To see the expressions in the rule, select Modify, and the Rule Attributes window will be displayed.
Pre-processing
|
Pre-processing (PRPR) |
Logical, will have Action |
All rules with this Purpose will be executed before a Branch is routed. The Action will normally be a PML function, which must have been defined before the rule is applied.
Typically this type of rule will be used where it is simpler to have a single rule to create, position and orientate several components rather than have individual rules. For example:
-
To build pipes of fixed geometry using a single rule to position and orientate all the components.
-
To build templates for parts of branches, for example, a control loop at the start of a branch.
The Selection part of the rule will identify a key component: for example, you could identify Valves which will require control loops by setting a UDA to a certain value, and then setting the selection expression to select all the Valves with the given attribute value.
The PML function will then create, position and orientate the components and finally set the head working point attribute to the last component covered by the rule. PDMS Router will then take over and route the Branch.
A suitable PML function is shown following. Note that at the end of the positioning and orientating commands, the RLOC attribute is set to 0 (Locked).
define object PREPROCESS
member .CEREF is DBREF
endobject
define method .RULEMETHOD()
if ( !THIS.CEREF.owner.phdir.east gt 0 ) then
prev tee
ori and p3 is n
dist 200
rloc 0
$!THIS.CEREF
ori pa is w
pos polar e dist 350 from prev tee
rloc 0
next tee
ori pa is w and p3 is n
pos polar e dist 250 from pl of $!THIS.CEREF
rloc 0
valv 1 of cref
ori pa is w and p3 is up
at w 500 wrt $!THIS.CEREF
rloc 0
elseif ( !THIS.CEREF.owner.phdir.east lt 0 ) then
prev tee
ori and p3 is s
dist 200
rloc 0
$!THIS.CEREF
ori pa is e
pos polar w dist 350 from prev tee
rloc 0
next tee
ori pa is e and p3 is s
pos polar w dist 250 from pl of $!THIS.CEREF
rloc 0
valv 1 of cref
ori pa is e and p3 is up
at w 600 wrt $!THIS.CEREF
rloc 0
elseif ( !THIS.CEREF.owner.phdir.north lt 0 ) then
prev tee
ori and p3 is e
dist 200
rloc 0
$!THIS.CEREF
ori pa is n
pos polar s dist 350 from prev tee
rloc 0
next tee
ori pa is n and p3 is e
pos polar s dist 250 from pl of $!THIS.CEREF
rloc 0
valv 1 of cref
ori pa is n and p3 is up
at w 500 wrt $!THIS.CEREF
rloc 0
elseif ( !THIS.CEREF.owner.phdir.north gt 0 ) then
prev tee
ori and p3 is w
dist 200
rloc 0
$!THIS.CEREF
ori pa is s
pos polar n dist 350 from prev tee
rloc 0
next tee
ori pa is s and p3 is w
pos polar n dist 250 from pl of $!THIS.CEREF
rloc 0
valv 1 of cref
ori pa is s and p3 is up
at w 500 wrt $!THIS.CEREF
rloc 0
endif
endmethod
The input to Pipe Router would be Pipes with a main Branch with the following sequence of components defined:
-
Tee
-
Valve with Stype CH
-
Tee
There would also be a second Branch, owning a Valve, with the Branch Head and Tail connected to the two Tees in the main Branch, which will form the control loop.
The rule to call the function could be defined as shown:

The rule is applied to the elements required in the normal way. An example of the control loop created is shown in the following picture.

Note: Pipe Router will lock the Tees and the Valves in position, so that they cannot be moved by any rules which are subsequently applied.
Selection
|
Bend or elbow selection (BEND) |
Logical, no Action |
Used to choose the type of component used to change direction. For example, the selection expression could be:
ALL BRAN MEM WITH ATTRIB ABORE LE 65
and the logical:
( ATTRIB TYPE EQ ’BEND’ )
makes sure that all Branches with bores less than or equal to 65 will use Bends rather than Elbows.

The default method of changing direction, set on the Pipe Router Defaults window, is using Elbows.

The default method of changing direction, set on the Pipe Router Defaults window, is using a Rule. The rule specifies that small bore pipes change direction using Bends
Note: The rule will only be applied if you set the Change direction using option on the Pipe Router Defaults window to Rule.
|
Reducer Selection (REDU) |
Logical, no Action |
To specify whether concentric or eccentric reducers are selected. For example, if the default reducers in a specification are eccentric, and you want concentric reducers in vertical sections of pipe but eccentric reducers in horizontal sections, the Selection expression in the rule could be:
ALL REDU WITH ( ATTRIB ADIR EQ U AND ATTRIB ADIR EQ D )
The logical expression to specify eccentric reducers in all the selected cases would be:
( ATTRIB STYP EQ ‘CON’ )
|
|
|
|
The default reducer in the Specification is eccentric. |
The rule specifies that reducers on vertical legs are concentric |
Positioning
There are two pseudo-attributes which are particularly useful in positioning expressions:
|
STAP |
is the length of straight tube before the component. |
|
STLE |
is the length of straight tube after the component. |
The lengths are measured from the component up to one of the following:
-
A change of direction
-
A change of bore
-
The start or end of the branch
-
One of the following components: VALV, VFWA, VTWA, FILT, PCOM, TEE and CROSS. (Any connection components such as flanges or gaskets are ignored.)
Downstream pipe requirement (DNSM)
Logical, can have Action
Used to control the length of straight pipe which is downstream from the previous component. If the rule logical fails, the action, if it exists, will be applied. The action should be an expression that moves the component a distance from the previous to ensure a straight length of pipe. For example:
Selection
ALL TEE WITH ( ATTRIB APOS EQ ATTRIB LPOS )
Logical
( ATTRIB STLE GT ATTRIB ABORE * 10 )
You can omit the action by setting the Action field on the form to unset, but the result may be unpredictable, particularly if other rules are being applied, and it is not recommended. If no action exists, and component positioning is head relative, the component will be moved 2/3 the distance along the leg, and then re-tested. If component positioning is tail relative, the preceding component will be moved if necessary when it is positioned.
|
|
|
|
A Tee is positioned by default. |
|
|
|
|
|
The rule is applied and the Tee is moved 2/3 of the distance along the leg between the Elbow and the Routing Plane |
|
|
Upstream pipe requirement (UPSM) |
Logical, can have Action |
The rule controls the length of straight pipe which is upstream from the next component.
Selection
ALL TEE WITH ( ATTRIB APOS EQ ATTRIB LPOS )
Logical
ATTRIB STAP GT ATTRIB ABORE * 10
An example of an action is:
POLAR AXES PREVPP DIST 4 IN FROM PREVPP
where the POLAR AXES keywords are used to specify a position in terms of a distance in a given direction from a point, and PREVPP is the previous p-point.
You can omit the action by setting the Action field on the window to unset, but the result may be unpredictable, particularly if other rules are being applied, and it is not recommended. If no action exists, and component positioning is tail relative, the component will be moved 1/3 of the upstream distance, and then re-tested. If component positioning is head relative, the following component will be moved if necessary when it is positioned.
|
Elevation (ELEV) |
Logical, can have Action |
The rule controls the elevation of a component. The following example uses the CLOSEST keyword in the logical expression to specify that components must be positioned at a height greater or equal to 0.61m vertically above an EQUI whose purpose is FLOO.
Selection
ALL BRANCH MEMBERS
Logical
ATTRIB UP WRT CLOSEST EQUI WITH ( PURP EQ ’FLOO’ ) DOWN GE .61M
A position on the closest vertical segment of pipe equal to the required elevation will be found. If no position on the existing pipe can be found, the action will be applied with the position adjusted to minimize the use of bends or elbows.
If the logical test is False, any action set will be applied.
|
Location (LOCA) |
Logical, can have Action |
Used to position a component at a given location. The following example is a test for a component in a sub-branch being positioned at p-point 4 of the connecting component in the owning branch:
ATTRIB APOS EQ ATTRIB PPOS 4 OF HREF OF OWNER
If the logical test fails, the action will be applied and the test repeated. If it fails again, a message is output.
The corresponding action expression would be:
ATTRIB PPOS 4 OF HREF OF OWNER
To position the component at p-point 4 of the connecting component in the owning branch.
Orientation
|
Major axis |
Logical, no Action |
Controls the major orientation of the component, which is the arrive/leave axis. For example:
ATTRIB ADIR EQ D
If this fails, the component will be moved to each leg in turn until one is found that passes. No action is allowed.
|
Minor axis |
Logical, can have Action |
Controls the minor orientation of a component, which is the axis perpendicular to the arrive/leave axis. Frequently this axis is the direction of a valve handwheel. For example:
ATTRIB P3 DIR EQ D
If the rule logical fails, the action will be applied. If the logical then fails, the component will be moved to another leg, and re-tested. If the component clashes, it will be moved along the leg and then re-tested.
If there is no action, the component will be rotated in increments of 90 degrees to find a non-clashing orientation which passes the rule. If after four attempts it still fails, the component will be moved along the leg and retried. If no suitable positions are found on the leg, the component will be moved to the next leg and the procedure repeated.
Examples using PML Functions
The following example shows how you could call PML functions for the Logical and Action expressions in a Minor Axis rule for positioning a Valve at and angle of 45 degrees.
First, the Logical expression will be set to ( 'minological' ), which will call the following PML function:
define object MINOLOGICAL
member .CEREF is DBREF
member .RESULT is BOOLEAN
endobject
define method .RULEMETHOD()
!THIS.RESULT = false
if ( !THIS.CEREF.ADIR.east ne 0 ) then
!THIS.RESULT = ( !THIS.CEREF.PDIR[3].up eq - 0.707107 and !THIS.CEREF.PDIR[3].north lt 0 )
elseif ( !THIS.CEREF.ADIR.north ne 0 ) then
!THIS.RESULT = ( !THIS.CEREF.PDIR[3].up eq -0.707107 and !THIS.CEREF.PDIR[3].east gt 0 )
. . .
. . .
endif
endmethod
If the Logical test evaluates to False, that is, if P3 does not have the specified orientation, the Action will be carried out.
The Action expression is set to ( 'minoaction' ), which orientates the P3 direction of the component:
define object MINOACTION
member .CEREF is DBREF
endobject
define method .RULEMETHOD()
if ( !THIS.CEREF.ADIR.east ne 0 ) then
ORI and p3 is s 45 d
elseif ( !THIS.CEREF.ADIR.north ne 0 ) then
ORI and p3 is e 45 d
endif
endmethod
Clash Exclusion
|
Clash Exclusion (CLEX) |
Logical |
A Clash Exclusion rule allows certain clashes to be approved in advance. A use for this is specifying that only non hazardous pipes are allowed in certain areas. Clash exclusion rules can use expressions or functions.
Example using Expressions
For example, the following rule can be used where two groups of elements are always allowed to clash. In this case, Branches carrying radioactive material have their PURP attribute set to RADI. All Zones which are safe for humans to enter have their PURP set to HUMA. The rule allows all Branches whose PURP is not set to RADI to pass through all human zones:
Selection
ALL BRAN MEM WITH ( PURP OF BRAN NEQ ‘RADI’ )
Logical
( PURP OF ZONE EQ ‘HUMA’ )
The selection part of the rule is used to identify the Branch or Branch member which is clashing and the logical applies to the obstruction clashing with the Branches.
Example using a PML Function
If a more complicated solution is needed, use a PML function. A simple example is
define object CLASH
member .CEREF is DBREF
member .OBSREF is DBREF
member .RESULT is BOOLEAN
endobject
define method .RULEMETHOD()
!THIS.RESULT = false
if ( !THIS.CEREF.owner.name eq '/ROUTE2-1' and
!THIS.OBSREF.owner.name eq '/OBSTR42' ) then
!THIS.RESULT = true
endif
endmethod
Pipe Racks and Routing Planes
Automatic routing along Pipe Racks is described in Create and Use Pipe Racks. In summary, Pipe Router sees a Pipe Rack as a group of routing planes. Each plane will have its FUNCTION attribute set, for example to UTIL for planes which are going to route utilities pipes. You should also ensure that Branches which will be routed along Pipe Racks have their PURPOSE attribute set appropriately, so that you can identify which Branches should be routed along a given plane.
Note:
In these rules, the selection expression selects Branches. The logical test is applied
to the Planes on the Pipe Rack.
|
Travel Plane Selection |
Logical, no Action |
To control which travel plane of a pipe rack is used to carry a particular branch. An example of the selection expression, which would apply the rule to all Branches to with Purpose set to COOLING, is:
ALL BRAN WITH ( PURP EQ ’COOLING’)
An example of the logical test, which will route the selected Branches along the Plane with its Function set to UTIL would be:
FUNCTION EQ ’UTIL’
Note:
It is important to use the FUNCTION attribute in rule writing for the rule logical
since the PURPOSE attribute is used internally.
|
Entry Plane Selection |
Logical, no Action |
To determine which entry plane is used to control a branch as it enters a pipe rack. Normally there will be one above and one below, to allow for branches with both liquid and vapour contents to use the rack. An example of the selection might be:
ALL BRAN WITH ( PURP EQ ’COOLING’ AND :CONT EQ ’GAS’)
Note:
That both the PURPOSE and:CONTENT attributes would need to be set on the branch for
the rule selection to take effect.
An example of the test could be:
FUNCTION EQ ’UTIL’.
which would cause pipes containing gas for cooling to use the upper entry/exit plane to get to/from the UTIL travel plane.
Note:
It is important to use the FUNCTION attribute in rule writing for the rule logical
since the PURPOSE attribute is used internally.
|
Exit Plane Selection |
Logical, no Action |
The rule will determine which exit plane is used to control a branch as it exits a pipe rack. Normally there will be one above and one below, to allow for branches with both liquid and vapour contents to use the rack. An example of the selection might be:
ALL BRAN WITH ( PURP EQ ’COOLING’ AND :CONT EQ ’GAS’)
Note:
That both the PURPOSE and :CONTENT attributes would need to be set on the branch for
the rule selection to take effect.
An example of the test could be:
FUNCTION EQ ’UTIL’
which would cause pipes containing gas for cooling to use the upper entry/exit plane to get to/from the UTIL travel plane.
|
Shoe Height |
Real |
Branches routed via planes or pipe-racks can be offset by a user-specified distance from the plane to allow for shoe-heights. The shoe-height is specified using rules with PURPose SHOE.
For example:
Selection:
( ALL BRAN ALL BRAN MEM ) WITH ( ISPEC OF BRAN NE NULREF )
Action:
(PH OD * 0.25 )
Note:
The Action specifies the distance from the Pipe OD. Subtract the insulation thickness
if the shoe height if measured from the bottom of the Pipe.
|
Heavy Pipe |
Logical, no Action |
You can specify that heavy pipes are placed at the edges of routing planes and light ones at the centre. When choosing this packing method, the PLPM attribute of the plane will be set to WEIG, and Pipe Router will look for a weight rule to determine whether pipes are light or heavy.
The logical expression will evaluate to False if the pipe is to be placed at the edge of the rack.
For example:
Selection:
ALL BRAN MEM
Logical:
( ATTRIB ABOR LT 300 MM)
All Pipes with Bore greater than 300mm will be placed at the edge of the rack.
|
Extra Gap |
Real |
Allows you to specify an additional gap between some pipes, for example, very hot pipes.
Additional gaps are determined by rules applied to the default bend or elbow of a branch. For example, for branches with temperature greater than 500 degrees, the following rule will give an additional gap of 0.2 times the arrive bore of the component:
Selection:
ALL BRAN MEM WITH ( TEMP OF OWNER GE 500 )
Action:
( ATTRIB ABOR * 0.2)
|
Flange Width (FLWI) |
Real |
Flange width rules are used to set the gap between Pipes on Routing Planes and Pipe Racks when the Pipe run on the plane includes Flanges. The rule is applied to the default Flange for the Pipe. The gap can be calculated in several ways.
Example 1
Selection:
ALL FLAN
Action:
( 0.25 * ATTRIB ABORE )
Example 2
Uses flange parameters:
Selection:
ALL FLAN
Action:
ACTION ( CPARA[2] + CPARA[3] )
Example 3
The next example uses a property of the Flange, which would be specified in a dataset as follows:
Owner /FLANGE.DATA.SET
Description Flange width Property
DKEY FLWI
Ptype BORE
Pproperty ( ATTRIB ABOR * 1.5 )
Dproperty 0
Purpose unset
Number 0
Dtitle unset
Punits mm
Ruse 0
The rule could then be:
Selection:
ALL FLAN WITH ( PSPE EQ /A150)
Action:
ACTION ( PROP FLWI )
Post-processing
|
Post-processing (POPR) |
Logical, will have Action |
All rules with this Purpose will be executed after a Branch has been successfully routed. They can be used to add extra details to a Branch such as Drains and Vents or slope the line. The Action will normally be a PML function, which must have been defined before the rule is applied.
The following example creates an expansion loop:
define object POSTPROCESS
member .CEREF is DBREF
endobject
define method .RULEMETHOD()
exit
$!THIS.CEREF
new elbo
select
ori and pl is up
dist 1000
rloc 2
new elbo
select
ori and pl is $!THIS.CEREF.LDIR
dist 300
rloc 2
new elbo
select
ori and pl is d
dist 300
rloc 2
new elbo
select
ori and pl is $!THIS.CEREF.LDIR
dist 300
rloc 2
router
endmethod
The following illustrations show a Branch, with and without the Post-processing Rule applied.





