Ceci est une ancienne révision du document !
Consigne : Réaliser un ressort ! >Il s'agit du défi de fin de l'atelier Programmer avec OpenSCAD.
méthode A (Méthode Bully)
nb_sphere=100; nbboucle=0.5;//nb_sphere/360 diamsphere=20; $fn=20; for ( i= [0:nb_sphere] ) rotate([0,0,i*(nbboucle*360/nb_sphere)]) { translate([0,2.5*diamsphere,i]){ sphere(d=diamsphere); } translate([0,-2.5*diamsphere,i]){ sphere(d=diamsphere); } translate([2.5*diamsphere,0,i]){ sphere(d=diamsphere); } translate([-2.5*diamsphere,0,i]){ sphere(d=diamsphere); } } difference(){ $fn=60; union(){ translate([0,0,-0.25*diamsphere]){ cylinder(r=3*diamsphere, h=10,center=true); } translate([0,0,5+nb_sphere]){ cylinder(r=3*diamsphere, h=10, center=true); } } translate([0,0,-diamsphere]){ cylinder(r=2*diamsphere,h=1.5*nb_sphere); } }
méthode B (Méthode Hélène)
p=50; //rayon par rapport au centre ds=10; // diamètre de la sphère pas=2; // pas iteration =200; // gère aussi la hauteur de la pièce // Le coeur du ressort for(positionX=[p,-p], positionY=[p,-p],i=[1:iteration]){ rotate([0,0,i*pas]) translate([positionX,positionY,i*pas]) sphere(ds, $fn=75); } //base et haut du ressort difference(){ union(){ translate([0,0,-ds]){cylinder(r=2*(p-ds)+2,h=ds,$fn=100);} translate([0,0,iteration*pas]){cylinder(r=2*(p-ds)+2,h=ds,$fn=100);} } translate([0,0,-ds-0.1]){cylinder(r=p+ds,h=iteration*pas+2*ds+0.2,$fn=100);} }