Advertisement
bk227865

kerstboom

Nov 3rd, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. // OpenSCAD program that draws a spiral (christmas) tree .... needs a while to calculate the STL depending on the step size.
  2.  
  3. step=5; // blockiness of the loops
  4. basis=90; // width of the tree (approximatly !!!!! need to reprogam this i think)
  5. lussen=10; // number of loops
  6. dikte=5; // thickness of the green led strp
  7. lushoogte=12; // height of the green strip to attach the leds to.
  8. boomhoogte=400; // height of the tree
  9.  
  10. hf=360/(boomhoogte-40)*lussen;
  11. versmalling=(basis)/(360*lussen);
  12. zmax=360*lussen;
  13. step=5;
  14.  
  15. module blad()
  16. {
  17. color([0.5,1,0.5])
  18. for (z=[step:step:zmax])
  19. {
  20. translate([0,0,z/hf])
  21. polyhedron(points=[
  22. [sin(z)*(versmalling*z),cos(z)*(versmalling*z),0],
  23. [sin(z+step)*(versmalling*(z+step)),cos(z+step)*(versmalling*(z+step)),step/hf],
  24. [sin(z+step)*(versmalling*(z+step)),cos(z+step)*(versmalling*(z+step)),lushoogte+(step/hf)],
  25. [sin(z)*(versmalling*z),cos(z)*(versmalling*z),lushoogte],
  26. [sin(z)*((versmalling*z)+dikte),cos(z)*(versmalling*z+dikte),0],
  27. [sin(z+step)*(versmalling*(z+step)+dikte),cos(z+step)*(versmalling*(z+step)+dikte),step/hf],
  28. [sin(z+step)*(versmalling*(z+step)+dikte),cos(z+step)*(versmalling*(z+step)+dikte),lushoogte+step/hf],
  29. [sin(z)*(versmalling*z+dikte),cos(z)*(versmalling*z+dikte),lushoogte]
  30. ],faces=[ [3,2,1],[1,0,3],[0,1,5],[4,0,5],[2,3,6],[3,7,6],[6,7,5],[7,4,5],[2,6,1],[6,5,1],[7,3,0],[4,7,0] ]);
  31. }
  32. }
  33.  
  34. module tak()
  35. {
  36. color([0.5,0.2,0]) translate([0,0,0])cylinder(h=boomhoogte,r=5,$fn=40);
  37. for (z=[120*4:120:zmax])
  38. {
  39. rotate([0,0,-z+90])
  40. translate([0,-2.5,z/hf+2])
  41. color([0.5,0.2,0])
  42. cube([versmalling*z+(5/2),5,lushoogte-4]);
  43. }
  44.  
  45. }
  46.  
  47. ;
  48. module boom()
  49. {
  50. blad();
  51. tak();
  52. }
  53.  
  54. difference()
  55. {
  56. boom();
  57. color([0.5,0.2,0]) translate([0,0,-1])cylinder(h=boomhoogte+2,r=2.2,$fn=40);
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement