cutter.tcl 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # Sample: creation of milling cutter
  2. #Category: Modeling
  3. #Title: Milling cutter
  4. pload MODELING VISUALIZATION
  5. # parameters
  6. dset R 10. ;# outer radius
  7. dset H 20. ;# height of the spiral part
  8. dset a 0.5*pi ;# total angle of spiral rotation
  9. # make profile
  10. circle outer 0 0 0 0 0 1 R
  11. circle inner 0 0 0 0 0 1 R-2
  12. circle round 3 6 0 0 0 1 5
  13. polyline cut -2 0 0 -2 R+1 0 0.5 R+1 0 -1 0 0 -2 0 0
  14. proc _curvetoface {name} {
  15. uplevel #0 mkedge $name $name
  16. uplevel #0 wire $name $name
  17. uplevel #0 mkface $name p0 $name
  18. }
  19. plane p0
  20. _curvetoface outer
  21. _curvetoface inner
  22. _curvetoface round
  23. mkface cut p0 cut
  24. bcommon teeth cut round
  25. bcommon teeth teeth outer
  26. tcopy inner profile
  27. set nbteeths 25
  28. for {set i 0} {$i < $nbteeths} {incr i} {
  29. bfuse profile profile teeth
  30. trotate teeth 0 0 0 0 0 1 360./$nbteeths
  31. }
  32. unifysamedom profile profile
  33. # sweep profile along curved shape
  34. polyline sp 0 0 0 0 0 H
  35. cylinder ss 0 0 0 0 0 1 1 0 0 R
  36. vertex v1 R 0 0
  37. vertex v2 R 0 H
  38. line ll 0 0 a H
  39. trim ll ll 0 sqrt(a*a+H*H)
  40. trotate v2 0 0 0 0 0 1 180.*a/pi
  41. mkedge ee ll ss v1 v2
  42. wire gg ee
  43. donly profile sp gg
  44. explode profile w
  45. tcopy profile_1 profile_2
  46. tcopy profile_1 profile_3
  47. tscale profile_1 0 0 0 1./(R-2)
  48. ttranslate profile_2 0 0 H/2
  49. tscale profile_2 0 0 H/2 4./(R-2)
  50. ttranslate profile_3 0 0 H
  51. tscale profile_3 0 0 H 3./(R-2)
  52. mksweep sp
  53. setsweep -G gg 0 0
  54. addsweep profile_1
  55. addsweep profile_2
  56. addsweep profile_3
  57. vclear
  58. buildsweep base -S
  59. # make a shank
  60. plane p1 0 0 H 0 0 1
  61. pcylinder shank p1 1.4 H
  62. plane p2 0 0 H+1 0 0 1
  63. pcylinder sh2 p2 1.5 H-1
  64. bfuse shank shank sh2
  65. bfuse cutter base shank
  66. # check result
  67. checkshape cutter
  68. # show result
  69. incmesh cutter 0.01
  70. vdisplay cutter
  71. vsetdispmode cutter 1
  72. vrenderparams -msaa 8
  73. incmesh profile_1 0.01; vdisplay profile_1
  74. vfit