pload DEFAULT
pload DCAF
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 line2d"
line l 2 0 1 1
mkedge L2 l
set aLabel2 0:2
Label Doc ${aLabel2}
SetShape Doc ${aLabel2} L2
checkshape L2
NewCommand Doc

puts "Create line3d"
line l 10 0 0 0 0 1
mkedge L3 l
set aLabel3 0:3
Label Doc ${aLabel3}
SetShape Doc ${aLabel3} L3
checkshape L3
NewCommand Doc

puts "Create circle3d"
circle c5 10 20 -5 1 0 0 0 0 1 17
mkedge C4 c5
set aLabel4 0:4
Label Doc ${aLabel4}
SetShape Doc ${aLabel4} C4
checkshape C4
NewCommand Doc

puts "Create ellipse"
ellipse e3 0 0 0 25 5
mkedge C5 e3
set aLabel5 0:5
Label Doc ${aLabel5}
SetShape Doc ${aLabel5} C5
checkshape C5
NewCommand Doc

puts "Create hyperbola"
hyperbola h3 0 0 0 50 50
trim th4 h3 -5 30 -3 40
mkedge C6 th4
set aLabel6 0:6
Label Doc ${aLabel6}
SetShape Doc ${aLabel6} C6
checkshape C6
NewCommand Doc

puts "Create hyperbola2d"
hyperbola h2 0 0 1 2 20 20
trim th2 h2 -5 15 -3 12
mkedge C7 th2
set aLabel7 0:7
Label Doc ${aLabel7}
SetShape Doc ${aLabel7} C7
checkshape C7
NewCommand Doc

puts "Create parabola2d"
parabola p2 0 0 0 1 50
trim tp2 p2 -150 180 0 50
mkedge C8 tp2
set aLabel8 0:8
Label Doc ${aLabel8}
SetShape Doc ${aLabel8} C8
checkshape C8
NewCommand Doc

puts "Create parabola3d"
parabola p3 0 0 0 1 0 0 0 0 1 50
mkedge C9 p3
set aLabel9 0:9
Label Doc ${aLabel9}
SetShape Doc ${aLabel9} C9
checkshape C9
NewCommand Doc

puts "Create beziercurve2d"
2dbeziercurve ci 3 0 0 1 10 0 sqrt(2.)/2. 10 10 1
mkedge C10 ci
set aLabel10 0:10
Label Doc ${aLabel10}
SetShape Doc ${aLabel10} C10
checkshape C10
NewCommand Doc


puts "Create beziercurve"
beziercurve cc 4 0 0 0 10 0 0 10 0 10 10 10 10
mkedge E11 cc
set aLabel11 0:11
Label Doc ${aLabel11}
SetShape Doc ${aLabel11} E11
checkshape E11
NewCommand Doc

puts "Create bsplinecurve2d"
dset h sqrt(3)/2
2dpbsplinecurve c12 2 \
4 0 2 pi/1.5 2 pi/0.75 2 2*pi 2 \
0 -h/3 1 \
0.5 -h/3 0.5 \
0.25 h/6 1 \
0 2*h/3 0.5 \
-0.25 h/6 1 \
-0.5 -h/3 0.5 \
0 -h/3 1
mkedge E12 c12
set aLabel12 0:12
Label Doc ${aLabel12}
SetShape Doc ${aLabel12} E12
checkshape E12
NewCommand Doc

puts "Create bsplinecurve"
bsplinecurve bc 2 3 0 3 1 1 2 3 10 0 7 1 7 0 7 1 3 0 8 1 0 0 7 1
mkedge E13 bc
set aLabel13 0:13
Label Doc ${aLabel13}
SetShape Doc ${aLabel13} E13
checkshape E13
NewCommand Doc

puts "Create beziersurf - 8"
beziersurf s 3 4 \
0 0 0 10 0 5 20 0 0 \
0 10 2 10 10 3 20 10 2 \
0 20 10 10 20 20 20 20 10 \
0 30 0 10 30 0 20 30 0
mkface F14 s
set aLabel14 0:14
Label Doc ${aLabel14}
SetShape Doc ${aLabel14} F14
checkshape F14
NewCommand Doc

puts "Create bsplinesurf - 9"
bsplinesurf bs \
1 2 0 2 1 2 \
2 3 0 3 1 1 2 3 \
0 0 0 1 10 0 5 1 \
0 10 2 1 10 10 3 1 \
0 20 10 1 10 20 20 1 \
0 30 0 1 10 30 0 1
mkface F15 bs
set aLabel15 0:15
Label Doc ${aLabel15}
SetShape Doc ${aLabel15} F15
checkshape F15
NewCommand Doc

puts "Create revsurf - 7"
circle c 50 0 0 20
revsurf rs c 0 0 0 0 1 0
mkshell SH16 rs
set aLabel16 0:16
Label Doc ${aLabel16}
SetShape Doc ${aLabel16} SH16
checkshape SH16
NewCommand Doc

puts "Create an elliptic cylinder - 6 (extrusion)"
ellipse e 0 0 0 10 5
extsurf exs e 0 0 1
trimv exs exs 0 10
mkface F17 exs
set aLabel17 0:17
Label Doc ${aLabel17}
SetShape Doc ${aLabel17} F17
checkshape F17
NewCommand Doc

puts "Create a torus"
ptorus pt 100 70 10 150 230
set aLabel18 0:18
Label Doc ${aLabel18}
SetShape Doc ${aLabel18} pt
checkshape pt
NewCommand Doc

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

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

smallview
puts "==> Extract & display shapes"
erase
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
GetShape D 0:8 S8
GetShape D 0:9 S9
GetShape D 0:10 S10
GetShape D 0:11 S11
GetShape D 0:12 S12
GetShape D 0:13 S13
GetShape D 0:14 S14
GetShape D 0:15 S15
GetShape D 0:16 S16
GetShape D 0:17 S17
GetShape D 0:18 S18
don S2
puts "==> S2"
checkshape S2
wait 2
puts "==> S3"
don S3
checkshape S3
wait 2
puts "==> S4"
don S4
checkshape S4
wait 2
puts "==> S5"
don S5
checkshape S5
wait 2
puts "==> S6"
don S6
checkshape S6
wait 2
puts "==> S7"
don S7
checkshape S7
wait puts "==> S8"
don S8
checkshape S8
wait 2
puts "==> S9"
don S9
checkshape S9
wait 2
puts "==> S10"
don S10
checkshape S10
wait 2
puts "==> S11"
don S11
checkshape S11
wait 2
puts "==> S12"
don S12
checkshape S12
wait 2
puts "==> S13"
don S13
checkshape S13
wait 2
puts "==> S14"
don S14
checkshape S14
wait 2
puts "==> S15"
don S15
checkshape S15
wait 2
puts "==> S16"
don S16
checkshape S16
wait 2
puts "==> S17"
don S17
checkshape S17
wait 2
puts "==> S18"
don S18
checkshape S18
wait 2
display S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 S14 S15 S16 S17 S18
puts "Info: TEST COMPLETED"
