# specifying a section of a cylinder?

4 messages
Open this post in threaded view
|

## specifying a section of a cylinder?

 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
Open this post in threaded view
|

## Re: specifying a section of a cylinder?

 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 radiusIf the multitude of answers presented in math.stackexchange.com doesn't work for you, give this one a try: More options for chord calculations