VNETxmlOrigName Example 2
- Last UpdatedDec 15, 2025
- 2 minute read
If you want to name their pipes using only its Fluid Service and Number which are defined as part of its name, using the above pipe /6"-AI-502100-AB3, then create a name of AI-502100. To create this you need the following PML syntax, in a file called VNETxmlOrigName<Project Code>.pmlobj.
|
define object VNETxmlOrigName<Project Code> |
||||||||
|
-- Used as a temporary store for the original name |
||||||||
|
member .result is string |
||||||||
|
endobject |
||||||||
|
-- End of object definition for VNETxmlOrigName<Project Code> |
||||||||
|
define method .VNETxmlOrigName<Project Code>( !object is dbref, !name is string ) |
||||||||
|
-- The !object and !name are always passed to this file, and must be declared. You will need |
||||||||
|
-- these to do some of the naming that you require |
||||||||
|
if (!object.type EQ 'PIPE') then |
||||||||
|
if (!name.match('-') gt 0) then |
||||||||
|
!splitname = !name.split('-') |
||||||||
|
if ((!splitname.size() eq 3) or (!splitname.size() eq 4)) then |
||||||||
|
!this.result = !splitname[2] & '-' & !splitname[3] |
||||||||
|
else |
||||||||
|
!this.result = !name |
||||||||
|
endif |
||||||||
|
elseif (!name.match('/') gt 0) then |
||||||||
|
!splitname = !name.split('/') |
||||||||
|
if (!splitname.size() eq 4) then |
||||||||
|
!this.result = !splitname[1] & '-' & !splitname[2] & '/' & !split name[3] |
||||||||
|
else |
||||||||
|
!this.result = !name |
||||||||
|
endif |
||||||||
|
else |
||||||||
|
!this.result = !name |
||||||||
|
endif |
||||||||
|
elseif (!object.type EQ ‘EQUI’) then |
||||||||
|
... |
||||||||
|
elseif (!object.type EQ ‘INST’) then |
||||||||
|
... |
||||||||
|
else |
||||||||
|
!this.result = !name |
||||||||
|
endif |
||||||||
|
endmethod |
||||||||
The result is that, for PDMS objects of type PIPE, if the name can be split on ‘-‘ dashes and it breaks down into 3 or 4 items then make the name up from the 2nd (AI) and 3rd (502100) components, which means that the size (6") and spec (AB3) of the pipe (1st and 4th components respectively) would not be used in the name. Also if the name does not contain ‘-‘ dashes then split the name on ‘/’ backslashes. If there are 4 components then make the name up from the 1st, 2nd and 3rd components. If the name does not fall into any of these breakdowns then return the original name.
Note: The supplied name has already had the preceding slash removed before this method is called.
The XML produced by the Export appware with the above configuration object, the User-Defined Identifiers looks like this:
For a pipe named /6"-AI-502100-AB3
|
<Object> |
|||||
|
<ID>AI-502100</ID> |
|||||
|
<Context> |
|||||
|
<ID>PROJECTCONTEXT</ID> |
|||||
|
</Context> |
|||||
|
<ClassID>PipingSegment</ClassID> |
|||||
|
<Association type="is identified by"> |
|||||
|
<Object> |
|||||
|
<ID>/6&-AI-502100-AB3</ID> |
|||||
|
<Context><ID>VPD</ID> |
|||||
|
<Context> |
|||||
|
<ID>PROJECTCONTEXT</ID> |
|||||
|
</Context> |
|||||
|
</Context> |
|||||
|
</Object> |
|||||
|
</Association> |
|||||
|
</Object> |
|||||
This routine is also called whenever an object needs to be identified, including objects that are the target of associations, such as connected items.