Professional Documents
Culture Documents
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()'
!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
!this.frome.val
!this.fromn.val
!this.fromu.val
!this.toe.val =
!this.ton.val =
!this.tou.val =
!this.clipbox()
endmethod
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
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