Ring with simple CSG compling

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Ring with simple CSG compling

Higraphics
Hello evey body
,
i can make ring by 2 cylinder under a difference function
_______________________________________________
module ring_in(){
translate([0,0,1.5])
    rotate([0,90,0]){
    cylinder(r=4.8, h=1, center=true, $fn=130);
    }
}
module ring_out(){
translate([0,0,1.1])
    scale([1,1.3,1.2]){
        rotate([0,90,0]){
        cylinder(r=2.8, h=1.1, center=true, $fn=130);
        }
    }
}
module Ring(){
difference(){
    ring_in();
    ring_out();
}
}
_____________________________________________________
but i like to make is smooth not shape as this method below
something like that:
<http://forum.openscad.org/file/t2643/torus-simple-3d-shape-isolated-on-transparent-background-volumetric-round-ring-golden-color-PHWE6F.jpg>



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Ring with simple CSG compling

Ronaldo
What you want is called a circular torus. If the circular section radius is constant as seems to be in your picture, you can get it by doing a rotate_extrude of a circle.

module ring(r, R) {
  rotate_extrude()
    translate([R,0,0])
      circle(r);
}

$fn=24;
scale([1,1.3,1.2])
rotate([0,90,0])
ring(0.4,1.5);

If you want the section radius changes along the circular path then you will need to compute all vertices of the torus surface and build a polyhedron(), a much harder task. The use of some library support may simplify part of the task.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org