discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

specifying a section of a cylinder?

MH
Mark Harrison
Sat, Jul 15, 2017 11:26 PM

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+(2radpercent)]) {
rotate([0,-90,0]) {
intersection() {
translate([2rad(1.0-percent),0,0])
cube([2rad,2rad,thick], center=true);
cylinder(thick, r=rad, center=true);
}
}
}
}
arc(5, 40, .1);

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);
F
fred_dot_u
Sat, Jul 15, 2017 11:39 PM

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
https://math.stackexchange.com/questions/564058/calculate-the-radius-of-a-circle-given-the-chord-length-and-height-of-a-segment

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 http://bfy.tw/CrMl

--
View this message in context: http://forum.openscad.org/specifying-a-section-of-a-cylinder-tp21827p21828.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

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 <https://math.stackexchange.com/questions/564058/calculate-the-radius-of-a-circle-given-the-chord-length-and-height-of-a-segment> 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 <http://bfy.tw/CrMl> -- View this message in context: http://forum.openscad.org/specifying-a-section-of-a-cylinder-tp21827p21828.html Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Sun, Jul 16, 2017 1:35 AM

Your approach is quite standard. To find the radius, see:

https://en.wikipedia.org/wiki/Circle#Sagitta

Your approach is quite standard. To find the radius, see: https://en.wikipedia.org/wiki/Circle#Sagitta > >
J
jsc
Sun, Jul 16, 2017 2:17 AM
https://softsolder.com/2013/08/02/making-finger-grip-dents-the-chord-equation/ -- View this message in context: http://forum.openscad.org/specifying-a-section-of-a-cylinder-tp21827p21831.html Sent from the OpenSCAD mailing list archive at Nabble.com.