You are on page 1of 4

var !!error.

text ''
var !ret REFE
LAYE
handle any
error |You are not on LAYEr or below. Move to correct LAYEr first|
return
endhandle

var !tlay NAME


if (match('$!tlay','LAB') eq 0) then
CONFIRM |Confirm to place arrow(s) on LAYE $!tlay|
if ('$_CALERT_USERDATA' eq 'NO') then
return
endif
endif

$* Determine VIEW direction and preset variables


VIEW
var !vdir DIRE
var !rcode RCODE

$* Determine cosines
$M C:\PT\ut_unitv.mac $!vdir
var !vwr split '$!!uhunicos'

$* Reverse viewing direction to point TO observer


do !i to 3
var !vwr[$!i] (0 - $!vwr[$!i])
enddo

$*/PIL-MUMBAI/STD-SYMB-GEN/MISC/ARROW
first memb of /PIL-MUMBAI/STD-SYMB-GEN/MISC/ARROW

handle any
$* $P$!!error.text
DRWG
LIBY 1
NEW SYLB /PIL-MUMBAI/STD-SYMB-GEN/MISC/ARROW-SYLB
var !tol TOLE
TOLERANCE 0.001
NEW SYTM /PIL-MUMBAI/STD-SYMB-GEN/MISC/ARROW
XYPS X97.000 Y93.000 NLPN 1 FONT 1 TPEN 3 CHEI 2.000
NEW STRA
FPT OFFS X0.000 Y0.000
TPT OFFS X4.000 Y0.000 NLPN 213 $(LENG 0.100$)
END
END
TOL $!tol
ERROR |Symbol /PIL-MUMBAI/STD-SYMB-GEN/MISC/ARROW was not defined and is now
created. See further instructions in COMMAND window|
endhandle

label /arwfnd

var !pent devpen 213


if (UPC('$!pent') neq 'COLOUR 1 THICK LPICTURE 17 GLYPH 16') then
setpen 213 Colour 1 SOLID THICK LPICTURE 17 GLYPH 17
ERROR |Definition for pen 213 must be added to file C:\PT\PEN.SET PEN is set now
temporarily|
endif

$!ret

var !tpr ''

do !i to 3
var !wx[$!i] (0)
var !wy[$!i] (0)
var !wz[$!i] ($!vwr[$!i])
enddo

if (abs($!vwr[3]) gt .99) then $* we have an Z = U


var !wx[1] (1)
var !wy[2] (1)

else $* we have an ISO view


var !phi1 (atant($!vwr[2],$!vwr[1])) $* define X-axis values
$* if ($!vwr[2] lt 0) then
$* var !phi1 (0 - $!phi1)
$* endif
var !phi1 ($!phi1 + 90)
var !wx[1] (cos($!phi1))
var !wx[2] (sin($!phi1))

var !phi1 ($!phi1 + 90) $* define Y-axis values


var !zz1 ($!wz[3]) $* projected length of Y in EN
var !wy[1] ($!zz1 * cos($!phi1))
var !wy[2] ($!zz1 * sin($!phi1))
var !wy[3] (sqrt(1 - $!wy[1] * $!wy[1] - $!wy[2] * $!wy[2]))
endif

$*--------------------------------------- main loop


label /loop
$!tlay

var !ret REFE


prompt off
prompt load escape |Identify$!tpr pipeline item to place$!tpr arrow (OR existing
ARROW to update)|

id @
handle (61,528)
prompt on
return
elsehandle any
error |$!!error.text|
golabel /loop
endhandle
prompt on

var !tpr ' NEXT'


var !tm ''

var !t TYPE
if ('$!t' eq 'BRAN') then
var !pdir PH DIR wrt /*
else
own
var !t2 TYPE
if ('$!t2' neq 'BRAN') then
if ('$!t' eq 'SLAB') then
SAME
var !tm TMRF
if ('$!tm' eq '/PIL-MUMBAI/STD-SYMB-GEN/MISC/ARROW') then
var !flarw REFE
goto DDNM
var !t TYPE
if ('$!t' eq 'BRAN') then
var !pdir PH DIR wrt /*
else
var !pdir PL DIR wrt /*
endif
golabel /l1
endif
endif
ERROR |$!t selected, NOT a pipe component|
SW
golabel /loop
endif
same
var !pdir PL DIR wrt /*
endif

label /l1
var !ddnm REFE

$!ret

if ('$!tm' eq '/PIL-MUMBAI/STD-SYMB-GEN/MISC/ARROW') then


$!flarw
else
NEW SLAB TMRF /PIL-MUMBAI/STD-SYMB-GEN/MISC/ARROW LFPEN TEMP DDNM $!ddnm LEAD OFF
XYPO 0 0
handle any
ERROR |$!!error.text|
golabel /loop
endhandle
endif

$* call unitvector
$M C:\PT\ut_unitv.mac $!pdir
var !lbv split'$!!uhunicos'

$* translate direction into drawing system


var !nx ($!wx[1] * $!lbv[1] + $!wx[2] * $!lbv[2] + $!wx[3] * $!lbv[3])
var !ny ($!wy[1] * $!lbv[1] + $!wy[2] * $!lbv[2] + $!wy[3] * $!lbv[3])
var !nz ($!wz[1] * $!lbv[1] + $!wz[2] * $!lbv[2] + $!wz[3] * $!lbv[3])

$* Calculate angle for slab

var !t1 ($!nx / sqrt(1 - $!nz * $!nz))


var !ang (0)
if (abs($!t1) gt 1.0) then
var !t1 (1.0 * abs($!t1) / $!t1)
endif
var !ang (acos($!t1))
if ($!ny lt 0) then
var !ang (-$!ang)
endif

$* Here comes the glorious moment where we set the result of


$* all the maths above !
ADEG $!ang

at @
handle any
delete slab
golabel /loop
endhandle

$* Position label at centerline


var !off xypo
var !ff split'$!off'

var !nang (atant($!ff[2],$!ff[1]))


var !dang ($!ang - $!nang)

var !l (sqrt($!ff[1] * $!ff[1] + $!ff[2] * $!ff[2]) * cos($!dang))


var !nx (cos($!ang) * $!l)
var !ny (sin($!ang) * $!l)

var !otol TOLE


tol .001
xypo $!nx $!ny
tole $!otol

golabel /loop

You might also like