You are on page 1of 10

setup form !!

clip
title 'KTY-Manipulao de Clipping'
PATH DOWN
!down
= !!pml.getpathname('downarrow16.png')
!up
= !!pml.getpathname('uparrow16.png')
!east
= !!pml.getpathname('eastarrow16.png')
!west
= !!pml.getpathname('westarrow16.png')
frame .frame1 'De: '
button .afrome pixmap /$!<west> width 16 height 16 callback '!this.subfrome(
)'
path right
text .frome 'Leste
' callback '!this.clipbox()' width 10 is STRING
button .sfrome pixmap /$!<east> width 16 height 16 callback '!this.addfrome(
)'
path down
button .afromn pixmap /$!<east> width 16 height 16 callback '!this.addfromn(
)'
path left
text .fromn 'Norte
' callback '!this.clipbox()' width 10 is STRING
button .sfromn pixmap /$!<west> width 16 height 16 callback '!this.subfromn(
)'
path down
button .sfromu pixmap /$!<down> width 16 height 16 callback '!this.subfromu(
)'
path right
text .fromu 'Elevao ' callback '!this.clipbox()' width 10 is STRING
button .afromu pixmap /$!<up> width 16 height 16 callback '!this.addfromu()'
exit
PATH RIGHT
frame .frame2 'At:'
button .atoe pixmap /$!<west> width 16 height 16 callback '!this.subtoe()'
path right
text .toe 'Leste
' callback '!this.clipbox()' width 10 is STRING
button .stoe pixmap /$!<east> width 16 height 16 callback '!this.addtoe()'
path down
button .aton pixmap /$!<east> width 16 height 16 callback '!this.addton()'
path left
text .ton 'Norte
' callback '!this.clipbox()' width 10 is STRING
button .ston pixmap /$!<west> width 16 height 16 callback '!this.subton()'
path down
button .stou pixmap /$!<down> width 16 height 16 callback '!this.subtou()'
path right
text .tou 'Elevao ' callback '!this.clipbox()' width 10 is STRING
button .atou pixmap /$!<up> width 16 height 16 callback '!this.addtou()'
exit
path down
frame .frame3 'Captura Volume' at xmin .frame1
button .ce
| CE | callback '!this.dbref(||)'
button .equi
| EQUI | callback '!this.dbref(|equi|)'
button .pipe
| PIPE | callback '!this.dbref(|pipe|)'
button .elem2elem |De Elem P/Elem| callback '!this.elem2elem()'
path right
button .elem
| ELEM | at xmax .equi at ymin .ce callback '!this.dbref(|el
em|)'
path down
button .frmw
| FRMW |
callback '!this.dbref(|frmw|)'
button .bran
| BRAN | callback '!this.dbref(|bran|)'
exit

path right
frame .frame4 'Altera/Localiza volume'
path down
text .offset
| OFFSET |
width 6
button .expand |EXPANDE|
callback
button .shrink |DIMINUI|
callback
button .findclip |ENCONTRA O BOX| callback
exit
path right

is REAL
'!this.expand(|exp|)'
'!this.expand(|shr|)'
'!this.findclip()'

frame .frame5 'Tipo de Elem.'


path down
toggle .pipeelem |PIPE|
toggle .equielem |EQUI|
toggle .struelem |STRU|
toggle .restelem |REST|
toggle .hvacelem |HVAC|
toggle .trayelem |TRAY|
exit
path right
frame .frame6 'Por Conexo:'
path down
toggle .pipeequi |+EQUI|
toggle .pipebran |+BRAN|
toggle .pipesupp |+SUPP|
exit
path down
-- frame .frame7 ''
button .pipesyst
|SISTEMA| callback '!this.addfromlisfile()'
text .pipesystname ||
width 10 is string
-- exit
path right
rgroup .addtype '' frame at xmin .frame5 ymax .frame5
ADD TAG 'Volume' select |VOL | callback '!this.toggle(|vol|)'
ADD TAG 'Connec' select |CONN| callback '!this.toggle(|con|)'
exit
path left
button .add |ADICIONA| callback '!this.within(|add|)'
button .only |SOMENTE| callback '!this.within(|only|)'
button .ok
| DISMISS |at xmin .frame1 ymax .frame5 callback '!this.ok()' ok
toggle .clipon 'Liga/Desl.' at xmin .ce ymax .frame4 callback '!this.clipon()'
member .filename is string
exit
define method .clip()
!this.hvacelem.Active = FALSE
!this.trayelem.Active = FALSE
!this.pipeelem.val = TRUE
!this.equielem.val = TRUE
!this.struelem.val = TRUE
!this.restelem.val = TRUE
!this.hvacelem.val = TRUE
!this.trayelem.val = TRUE
!this.offset.val = 1000
!this.pipesystname.val = ''
!this.pipeequi.Active = FALSE
!this.pipebran.Active = FALSE
!this.pipesupp.Active = FALSE

!this.pipesystname.Active = FALSE
!this.frome.val = '0'
!this.fromn.val = '0'
!this.fromu.val = '0'
!this.toe.val = '0'
!this.ton.val = '0'
!this.tou.val = '0'
var !!frompos delete
var !!topos delete
!this.clipon.val = !!GPH3DDESIGN1.CLIPBOX.ACTIVE
clip box on
!this.convertbox('clip')
endmethod
define method .elem2elem()
id @
!felem = !!ce
!frompos = !felem.position.wrt(world)
id @
!telem = !!ce
!topos = !telem.position.wrt(world)
pin1 at $!frompos
pin2 at $!topos
var !dist cons dist PIN1 to PIN2
PIN1 dir towards PIN2
PIN1 dist (!dist / 2)
var !cpos PIN1 POS WRT /*
!xlen = abs (!topos.east - !frompos.east)
!ylen = abs (!topos.north - !frompos.north)
!zlen = abs (!topos.up - !frompos.up)
clip XLEN $!xlen
clip YLEN $!ylen
clip zLEN $!zlen
clip pos $!cpos
clip box on
pin1 off
pin2 off
!this.convertbox('clip')
endmethod
define method .dbref(!ref is string)
if (!ref eq 'elem') then
id @
elseif (!ref eq 'equi') then
id equi @
elseif (!ref eq 'pipe') then
id pipe @
elseif (!ref eq 'bran') then
id bran @
elseif (!ref eq 'frmw') then
id frmw @
endif
-- !!gphViews.clipBoxElement( !!GPH3DDESIGN1.lclippingMenu, |SELECT| )
!this.clipBoxCE(!!ce)
!this.convertbox('')
endmethod
define method .clipBoxCE(!any is ANY)
!form
= !!GPH3DDESIGN1

!type = !any.objecttype()
if ('$!type' eq 'ARRAY') then
!volume = object VOLUME(!any)
else
!volume = object VOLUME(!!CE)
endif
!form.clipBox.box = !volume.box()
!form.clipbox.set()
endmethod
define method .showfromto()
!this.frome.val = !!frompos.STRING().SPLIT()[2]
!this.fromn.val = !!frompos.STRING().SPLIT()[4]
!this.fromu.val = !!frompos.STRING().SPLIT()[6]
!this.toe.val = !!topos.STRING().SPLIT()[2]
!this.ton.val = !!topos.STRING().SPLIT()[4]
!this.tou.val = !!topos.STRING().SPLIT()[6]
endmethod
define method .convertbox(!type is string)
if (!type eq 'clip') then
var !oldclip CLIP
!array = !oldclip.split()
!xlen = !array[1]
!ylen = !array[2]
!zlen = !array[3]
!cpos = ((substring (after (!oldclip, 'Z is U') , -4)) + 'wrt /*')
else
!xlen = !!GPH3DDESIGN1.CLIPBOX.BOX.XLENGTH.STRING()
!ylen = !!GPH3DDESIGN1.CLIPBOX.BOX.YLENGTH.STRING()
!zlen = !!GPH3DDESIGN1.CLIPBOX.BOX.ZLENGTH.STRING()
!pos = !!GPH3DDESIGN1.CLIPBOX.BOX.POSITION
!cpos = !pos.string()
endif
pin1 at $!cpos
pin1 dir west wrt /* dist ($!xlen / 2)
pin1 dir south wrt /* dist ($!ylen / 2)
pin1 dir down wrt /* dist ($!zlen / 2)
pin2 at $!cpos
pin2 dir east wrt /* dist ($!xlen / 2)
pin2 dir north wrt /* dist ($!ylen / 2)
pin2 dir up
wrt /* dist ($!zlen / 2)
var !from PIN1 POS wrt /*
var !to PIN2 POS wrt /*
!!frompos = !from.position()
!!topos = !to.position()
!this.showfromto()
pin1 off
pin2 off
endmethod
define method .clipbox()
!from = ('e' + '$!this.frome.val' + 'n' + '$!this.fromn.val' + 'u' + '$!this.f
romu.val')
!to = ('e' + '$!this.toe.val' + 'n' + '$!this.ton.val' + 'u' + '$!this.tou.v
al')
pin1 at $!from WRT /*
pin2 at $!to WRT /*
var !dist cons dist PIN1 to PIN2
PIN1 dir towards PIN2

PIN1 dist (!dist / 2)


var !cpos PIN1 POS WRT /*
!xlen = !this.toe.val.REAL() - !this.frome.val.REAL()
!ylen = !this.ton.val.REAL() - !this.fromn.val.REAL()
!zlen = !this.tou.val.REAL() - !this.fromu.val.REAL()
clip XLEN $!xlen
clip YLEN $!ylen
clip zLEN $!zlen
clip pos $!cpos
clip box on
pin1 off
pin2 off
!!GPH3DDESIGN1.CLIPBOX.BOX.POSITION = !cpos.position()
!!GPH3DDESIGN1.CLIPBOX.BOX.XLENGTH = !xlen
!!GPH3DDESIGN1.CLIPBOX.BOX.YLENGTH = !ylen
!!GPH3DDESIGN1.CLIPBOX.BOX.ZLENGTH = !zlen
!this.convertbox('clip')
endmethod
define method .clipon()
!type
= !!GPH3DDESIGN1.view.type()
!viewName = !!GPH3DDESIGN1.view.fullName()
if (!type eq 'GM3D') then
!volType = 'GIVOLUME'
else
!volType = 'VOLUME'
endif
if (!this.clipon.val) then
edit $!<viewName> $!<volType>
clip enable
exit
!!GPH3DDESIGN1.CLIPBOX.ACTIVE = true
-- auto $!!frompos to $!!topos
else
edit $!<viewName> $!<volType>
clip disable
exit
!!GPH3DDESIGN1.CLIPBOX.ACTIVE = false
endif
endmethod
define method .boxon()
if (!this.boxon.val) then
clip box on
else
clip box off
endmethod
define method .findclip()
auto $!!frompos to $!!topos
endmethod
define method .expand(!exp is string)
if (!exp eq 'exp') then
!mult = 1
else
!mult = -1
endif

!this.frome.val
!this.fromn.val
!this.fromu.val
!this.toe.val =
!this.ton.val =
!this.tou.val =
!this.clipbox()
endmethod

= STRING(!this.frome.val.REAL() + (!mult * -$!this.offset))


= STRING(!this.fromn.val.REAL() + (!mult * -$!this.offset))
= STRING(!this.fromu.val.REAL() + (!mult * -$!this.offset))
STRING(!this.toe.val.REAL() + (!mult * $!this.offset))
STRING(!this.ton.val.REAL() + (!mult * $!this.offset))
STRING(!this.tou.val.REAL() + (!mult * $!this.offset))

define method .subfrome()


!this.frome.val = STRING(!this.frome.val.REAL() - !this.offset.val)
!this.clipbox()
endmethod
define method .addfrome()
!this.frome.val = STRING (!this.frome.val.REAL() + !this.offset.val)
!this.clipbox()
endmethod
define method .subfromn()
!this.fromn.val = STRING(!this.fromn.val.REAL() - !this.offset.val)
!this.clipbox()
endmethod
define method .addfromn()
!this.fromn.val = STRING(!this.fromn.val.REAL() + !this.offset.val)
!this.clipbox()
endmethod
define method .subfromu()
!this.fromu.val = STRING(!this.fromu.val.REAL() - !this.offset.val)
!this.clipbox()
endmethod
define method .addfromu()
!this.fromu.val = STRING(!this.fromu.val.REAL() + !this.offset.val)
!this.clipbox()
endmethod
define method .subtoe()
!this.toe.val = STRING(!this.toe.val.REAL() - !this.offset.val)
!this.clipbox()
endmethod
define method .addtoe()
!this.toe.val = STRING(!this.toe.val.REAL() + !this.offset.val)
!this.clipbox()
endmethod
define method .subton()
!this.ton.val = STRING(!this.ton.val.REAL() - !this.offset.val)
!this.clipbox()
endmethod
define method .addton()
!this.ton.val = STRING(!this.ton.val.REAL() + !this.offset.val)
!this.clipbox()
endmethod

define method .subtou()


!this.tou.val = STRING(!this.tou.val.REAL() - !this.offset.val)
!this.clipbox()
endmethod
define method .addtou()
!this.tou.val = STRING(!this.tou.val.REAL() + !this.offset.val)
!this.clipbox()
endmethod
define method .within(!add is string)
if (!add eq 'only') then
remove all
endif
if (!this.pipesystname.Active eq true) then
!this.addLISpipes()
elseif (!this.addtype.val eq 2) then
!this.pipeconn()
elseif (!this.addtype.val eq 1) then
var !elems collect all within $!!frompos to $!!topos
if (!this.struelem.val) then
var !stwall collect all (stwall) within $!!frompos to $!!topos
do !i index !stwall
add $!stwall[$!i]
enddo
endif
var !types eval type for all from !elems
var !hlist eval hlis for all from !elems
var !dbnumb eval dbnumb for all from !elems
do !i index !elems
skip if (real(!dbnumb[!i]) gt 1100)
skip if ((!types[!i] eq 'STRU') or (!types[!i] eq 'FRMW') or (!types[!i] eq '
SBFR'))
if (!this.restelem.val eq FALSE) then
skip if (match(|$!hlist[$!i]|, |REST|) neq 0)
endif
if (!this.pipeelem.val eq FALSE) then
skip if ((match(|$!hlist[$!i]|, |PIPE|) neq 0) and (match(|$!hlist[$!i]|, |R
EST|) eq 0))
endif
if (!this.equielem.val eq FALSE) then
skip if ((match(|$!types[$!i]|, |SUBE|) neq 0) or (match(|$!types[$!i]|, |EQ
UI|) neq 0))
endif
if (!this.struelem.val eq FALSE) then
skip if (match(|$!hlist[$!i]|, |STRU|) neq 0)
endif
add $!elems[$!i]
-- write $!elems[$!i]
enddo
endif
endmethod
define method .pipeconn()
!start = !!CE
if (!this.pipeequi.val) then
var !BRANLS coll all (BRAN)
do !cnt indexes !BRANLS
$!BRANLS[$!cnt]

FOR $!start

add ce
goto href
handle any
golabel /skiphead
endhandle
equi
handle (2,111)
golabel /skiphead
endhandle
add ce
$!BRANLS[$!cnt]
label /skiphead
goto tref
handle any
golabel /skiptail
endhandle
equi
handle (2,111)
golabel /skiptail
endhandle
add ce
label /skiptail
enddo
endif
if (!this.pipebran.val) then
var !BRANLS coll all (BRAN)
do !cnt indexes !BRANLS
$!BRANLS[$!cnt]
add ce
goto href
handle any
golabel /skipbbhead
endhandle
bran
handle (2,111)
golabel /skipbbhead
endhandle
add ce
$!BRANLS[$!cnt]
label /skipbbhead
goto tref
handle any
golabel /skipbbtail
endhandle
bran
handle (2,111)
golabel /skipbbtail
endhandle
add ce
label /skipbbtail
enddo

FOR $!start

var !compLS coll all (tee olet redu cross elbo)


do !cnt indexes !compLS
$!compLS[$!cnt]
add ce
goto cref
handle any
golabel /skipBcref

FOR $!start

endhandle
!BRAN = !!ce
add ce
label /skipBcref
enddo
endif

--

if (!this.pipesupp.val) then
var !ATTALS coll all (ATTA)
do !cnt indexes !ATTALS
$!ATTALS[$!cnt]
add ce
goto cref
handle any
golabel /skipcref
endhandle
!HANG = !!ce
rest add ce
$!HANG
goto tref
handle any
golabel /skipcref
endhandle
frmw add ce
label /skipcref
enddo
endif
$!start
endmethod

FOR $!start

define method .addfromlisfile()


!this.pipeelem.Active = FALSE
!this.equielem.Active = FALSE
!this.struelem.Active = FALSE
!this.restelem.Active = FALSE
!this.hvacelem.Active = FALSE
!this.trayelem.Active = FALSE
!this.pipeequi.Active = FALSE
!this.pipebran.Active = FALSE
!this.pipesupp.Active = FALSE
!this.pipesystname.Active = true
var !procode project code
var !path ('%' + !procode + 'ISO%/LIS')
call !!fileBrowser('$!path', '', 'System Isometri Input', false, '!!clip.LISpip
esfile(!!fileBrowser.file)')
-- call !!fileBrowser('$!path', '', 'System Isometri Input', false, '')
endmethod
define method .LISpipesfile(!file is FILE)
!this.filename = !file.name()
!this.pipesystname.val = after(!this.filename, '\')
write |SYSTEM - $!this.pipesystname.val|
endmethod
-- define method .addLISpipes(!file is FILE)
define method .addLISpipes()
-- !filename = !file.name()

!INPUT = object FILE('$!this.filename')


!INPUT.Open('READ')
handle (160,46)
!!alert.error('FILE Name is UNSET.')
!INPUT.Close()
return
endhandle
!pipelist = array()
do !CNT
!REC1 = !INPUT.ReadRecord()
BREAK IF EMPTY (!REC1)
HANDLE ANY
BREAK
ENDHANDLE
VAR !PROF SPLIT '$!REC1'
VAR !PIPE !PROF[3]
$!PIPE ADD CE
write |$!PIPE|
!ref = ref
!pipelist.append(!ref)
ENDDO
!INPUT.Close()
!this.clipBoxCE(!pipelist)
!this.convertbox('')
endmethod
define method .toggle(!type is String)
if (!type eq 'vol') then
!this.pipeelem.Active = true
!this.equielem.Active = true
!this.struelem.Active = true
!this.restelem.Active = true
!this.hvacelem.Active = FALSE
!this.trayelem.Active = FALSE
!this.pipeequi.Active = FALSE
!this.pipebran.Active = FALSE
!this.pipesupp.Active = FALSE
!this.pipesystname.Active = false
else
!this.pipeelem.Active = FALSE
!this.equielem.Active = FALSE
!this.struelem.Active = FALSE
!this.restelem.Active = FALSE
!this.hvacelem.Active = FALSE
!this.trayelem.Active = FALSE
!this.pipeequi.Active = true
!this.pipebran.Active = true
!this.pipesupp.Active = true
!this.pipesystname.Active = false
endif
endmethod
define method .ok()
clip box off
KILL !!clip
pin1 off
pin2 off
endmethod

You might also like