pload DEFAULT
pload DCAF
clear
if [info exists Doc] {Close Doc; unset Doc}
if [info exists D] {Close D; unset D}
# Create a new document and set UndoLimit
NewDocument Doc BinOcaf
UndoLimit Doc 100

# Open a transaction
NewCommand Doc

puts "Create box"
box b 1 3 5 100 120 150

puts "Create cylinder"
pcylinder cyl 50 200 120

ttranslate cyl -50 -50 0

puts "Create cone"
pcone con1 80 20 230 270

ttranslate con1 150 -100 0

set aLabel2 0:2
Label Doc ${aLabel2}

set aLabel3 0:3
Label Doc ${aLabel3}

set aLabel4 0:4
Label Doc ${aLabel4}

NewCommand Doc

SetShape Doc ${aLabel2} b

NewCommand Doc

SetShape Doc ${aLabel3} cyl

NewCommand Doc

SetShape Doc ${aLabel4} con1

puts "Create sphere"
psphere sp  150
ttranslate sp 50 50 10

puts "3 fuse operations"
fuse r1 sp b
fuse r2 r1 con1
fuse r3 r2 cyl
incmesh r3 0.1
set aLabel5 0:5
Label Doc ${aLabel5}

SetShape Doc ${aLabel5} r3
puts "==> Extract and keep subshape - face"
explode r3 F

puts "==> ttranslate r3_1"
ttranslate r3_1 -100 -100 -170
set aLabel6 0:6
Label Doc ${aLabel6}

SetShape Doc ${aLabel6} r3_1

puts "==> Extract and keep subshape - edge"
explode r3_9 E
ttranslate r3_9_5 50 50 10
set aLabel7 0:7
Label Doc ${aLabel7}

SetShape Doc ${aLabel7} r3_9_2

puts "==> SaveAs Doc"
#DFBrowser Doc
SaveAs Doc /dn05/KAS/dev/SZY-Bin/work/TA95.cbf

Close Doc
unset Doc
puts "==> Open Doc"
Open /dn05/KAS/dev/SZY-Bin/work/TA95.cbf D

smallview
puts "==> Extract & display shapes"
GetShape D 0:2 S2
GetShape D 0:3 S3
GetShape D 0:4 S4
GetShape D 0:5 S5
GetShape D 0:6 S6
GetShape D 0:7 S7

don S7
checkshape S7
wait 2
don S6
checkshape S6
wait 2
don S5
checkshape S5
wait 2
don S4
checkshape S4
wait 2
don S3
checkshape S3
wait 2
don S2
checkshape S2
wait 2
display S2 S3 S4 S5 S6 S7
puts "Info: TEST COMPLETED"
