home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 182 / dpcs0403.iso / Business / Amapi 5.15 / Amapi5.15w / data1.cab / Common / Macros / Cylinder.tcl < prev    next >
Encoding:
Text File  |  2001-06-05  |  1.3 KB  |  48 lines

  1. #SPEC -realnameid 0
  2.  
  3. # messages table
  4. #@@%000@@FR@@Faire un cylindre@@
  5. #@@%000@@US@@Make a cylinder@@
  6. #@@%001@@FR@@nb tranches@@
  7. #@@%001@@US@@steps@@
  8. #@@%002@@FR@@hauteur@@
  9. #@@%002@@US@@height@@
  10. #@@%003@@FR@@rayon@@
  11. #@@%003@@US@@radius@@
  12.  
  13. .amapi loadmsg Cylinder.tcl mymsg
  14. set res [getvalue \
  15.     -type1 ''int'' -name1 ''[mymsg -ref 1]'' \
  16.     -value1 10 -type2 ''world'' -name2 ''[mymsg -ref 2]'' \
  17.     -value2 5 -type3 ''world'' -name3 ''[mymsg -ref 3]'' -value3 4]
  18. mymsg -free
  19. if {$res == ""} return
  20.  
  21. set nbslices [.match $res result1 -int]
  22. set high [.match $res result2 -world]
  23. set radiu [.match $res result3 -world]
  24.  
  25. set oldplane [.amapi plane]
  26. .amapi setplane -viewup
  27. set circ [.match [circle -radius [.world2unit $radiu] -numpts 8 -orig {0 0 0}] shape -shape]
  28. if {$circ == ""} return
  29. newshape mycircle $circ
  30.  
  31. .amapi setplane -viewfront
  32. set pt1 [lindex [mycircle -points] 0]
  33. set pt2 [list [lindex $pt1 0] [expr [lindex $pt1 1] + $high] [lindex $pt1 2]]
  34.  
  35. newshape myprofil {
  36.     addpoint $pt1
  37.     addpoint $pt2
  38. }
  39. myprofil -status open 
  40. myprofil -checkin
  41.  
  42. set prof [myprofil -ref]
  43. set profil [smooth -shape $prof -range $nbslices]
  44.  
  45. extrude -curve1 $circ -curve2 $profil -close
  46. set newplane [.match $oldplane plane -string]
  47. .amapi setplane $newplane
  48.