specifying a section of a cylinder?

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

specifying a section of a cylinder?

marhar
Here's a module that takes a slice of one side of a cylinder.

Two questions:

1.  I'm just getting started with composing things in modules.  Is
     the approach reasonable, or is there a better way to chop off
     the unused part of the cylinder?

2.  This module specifies the radius and a percentage of the circle
     to keep.  I would rather specify:

        - thickness (as is now)
        - length of chord
        - distance from chord to edge of cylinder

     If someone could give me a clue as to deriving the location and
     radius of the cylinder from the chord length and height, I would
     appreciate it!


module arc(thick, rad, percent) {
     translate([thick/2,0,-rad+(2*rad*percent)]) {
         rotate([0,-90,0]) {
             intersection() {
                 translate([2*rad*(1.0-percent),0,0])
                 cube([2*rad,2*rad,thick], center=true);
                 cylinder(thick, r=rad, center=true);
             }
         }
     }
}
arc(5, 40, .1);

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

snapz004.png (25K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: specifying a section of a cylinder?

fred_dot_u
When you speak of the chord of a cylinder, I hope you mean the chord of a circle created by a perpendicular slice of the cylinder. If you add in the angle of the slice, the math goes way out of control.

On that note, there's a series of answers located here:

Various methods to calculate circle radius

If the multitude of answers presented in math.stackexchange.com doesn't work for you, give this one a try:

More options for chord calculations
Reply | Threaded
Open this post in threaded view
|

Re: specifying a section of a cylinder?

Ronaldo
In reply to this post by marhar
Your approach is quite standard. To find the radius, see:







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

Re: specifying a section of a cylinder?

jsc
In reply to this post by fred_dot_u