DRAW Administrator Guide
Intelligent Text
Intelligent Text
Intelligent text supports the calling of a global PML function (or a global string variable) as part of the intelligent text expression, using the “#PML” syntax. The PML function can take global parameters and must return a string.
---------------------------------------------------------------------
-- PML Function to calculate the number of rungs on a CWAY component
---------------------------------------------------------------------
define function !!getRungs(!component is DBREF) is STRING
-- Check for a valid component type
if (!component.type.neq('CTRAY')) then
-- Not a valid component type so provide suitable message
!string = 'Invalid Component Type'
else
-- Get component data
!owner = !component.owne
!catref = !component.catref
!rungSpacing = !catref.para[12]
-- For a straight piece of cable tray
if (!catref.gtype.eq('FTUB')) then
-- Read the start and the end of the straight piece
VAR !posPA POS PA OF $!owner
VAR !posPL POS PL OF $!owner
-- Turn the start and end points into position objects
!posPAObj = object POSITION(!posPA)
!posPLObj = object POSITION(!posPL)
-- Calculkate the length
!length = !posPAObj.distance(!posPLObj)
!numberOfRungs = !length / !rungSpacing
-- Build the output striung
!string = 'Number of rungs: ' & !numberOfRungs.int().value()
else
-- Every other component cannot be calculated yet
!string = 'Cannot Calculate'
endif
endif
return !string
endfunction
1974 to current year.
AVEVA Solutions Limited and its subsidiaries. All rights reserved.