PDMS设备管口方位标注
2018-09-29 本文已影响0人
饭桶2018
设备管口方位简易标注

EQUI
!equi = !!CE
SITE
!world = !!CE
$!equi
-- mark x y z on equipment
!size = 3000
aid clear all
!equi = !!CE
!pos = !equi.pos.wrt(!world)
!ori = !equi.ori.wrt(!world)
!xdir = !ori.xdir()
!ydir = !ori.ydir()
!zdir = !ori.zdir()
!xpos = !pos.offset(!xdir, !size)
!ypos = !pos.offset(!ydir, !size)
!zpos = !pos.offset(!zdir, !size)
aid arrow at $!pos dir $!xdir Height $!size
aid arrow at $!pos dir $!ydir Height $!size
aid arrow at $!pos dir $!zdir Height $!size
aid text |X| at $!xpos
aid text |Y| at $!ypos
aid text |Z| at $!zpos
!x0 = !equi.x.string('D0').real()
!y0 = !equi.y.string('D0').real()
-- mark nozz
var !nozzs collect all NOZZ for $!equi
do !nozz values !nozzs
!nname = !nozz.dbref().name
!npos = !nozz.dbref().pos.wrt(!world)
!x1 = !nozz.dbref().x.string('D0').real()
!y1 = !nozz.dbref().y.string('D0').real()
-- $p $!x0 $!y0 $!x1 $!y1 $!nname
if !x1 eq !x0 then
if !y1 gt !y0 then
!nangle = '90'
elseif !y1 lt !y0 then
!nangle = '270'
else
!nangle = '0'
endif
else
!rad = ((!y1 - !y0 ) / (!x1 - !x0))
!deg = !rad.atan()
if !x1 gt !x0 and !y1 ge !y0 then
!deg = !deg + 0
elseif !x1 gt !x0 and !y1 lt !y0 then
!deg = !deg + 360
elseif !x1 lt !x0 then
!deg = !deg + 180
endif
!nangle = !deg.string('D0')
endif
-- this ori is not the ori of equi nozz ori
-- !nangle = !nozz.dbref().ori.wrt(!equi).gamma.string('D0')
aid text |$!nangle| at $!npos
enddo