discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

rounding of standard objects

KE
Karl Exler
Sat, Sep 30, 2023 1:02 PM

Dear all,

what is the preferred way to round edges of standard objects e.g an
cylinder(h=3,r=5) ?

Many thanks
Karl

Dear all, what is the preferred way to round edges of standard objects e.g an cylinder(h=3,r=5) ? Many thanks Karl
RD
Revar Desmera
Sat, Sep 30, 2023 1:28 PM

On Sep 30, 2023, at 6:02 AM, Karl Exler <karl.exler@meinklang.cc> wrote:

what is the preferred way to round edges of standard objects e.g an cylinder(h=3,r=5) ?

With the BOSL2 library, you do it like this:

cyl(h=3, r=5, rounding=1, $fn=24);

7f60f080-3992-11eb-9baf-22e99510b07f.pngshapes3d.scad

github.com

-Revar

JB
Jordan Brown
Mon, Oct 2, 2023 5:28 PM

On 9/30/2023 6:02 AM, Karl Exler wrote:

what is the preferred way to round edges of standard objects e.g an
cylinder(h=3,r=5) ?

As Revar says, using BOSL2 is the easiest.

If you want to DIY for some reason, the usual rounding techniques
involve positioning round things and then either hulling them or filling
in between them.

Here are two ways to make a rounded cylinder:

module roundcyl_hull(r, h, roundr) {
    hull() {
        for (z = [roundr, h-roundr]) {
            translate([0,0,z]) rotate_extrude()
                translate([r-roundr, 0]) circle(r=roundr);
        }
    }
}

roundcyl_hull(10, 20, 2);

module roundcyl_fill(r, h, roundr) {
    for (z = [roundr, h-roundr]) {
        translate([0,0,z]) rotate_extrude()
            translate([r-roundr, 0]) circle(r=roundr);
    }
    cylinder(h=h, r=r-roundr);
    translate([0,0,roundr]) cylinder(h=h-roundr*2, r=r);
}

translate([20,0,0]) roundcyl_fill(10, 20, 2);

Note that the "fill" variant (on the right) has a slight ridge at the
top and bottom.  That's because the circle being extruded has only 7
sides, and doesn't have a vertex pointing up that extends all the way to
the actual radius, while the fill cylinder does extend to the full
height.  This can be addressed by forcing the circle to have a multiple
of four sides.

Note also that there are several corner cases that this doesn't attempt
to address.  Both will, for instance, get into trouble if the cylinder
radius or height are less than twice the rounding radius.

On 9/30/2023 6:02 AM, Karl Exler wrote: > what is the preferred way to round edges of standard objects e.g an > cylinder(h=3,r=5) ? As Revar says, using BOSL2 is the easiest. If you want to DIY for some reason, the usual rounding techniques involve positioning round things and then either hulling them or filling in between them. Here are two ways to make a rounded cylinder: module roundcyl_hull(r, h, roundr) { hull() { for (z = [roundr, h-roundr]) { translate([0,0,z]) rotate_extrude() translate([r-roundr, 0]) circle(r=roundr); } } } roundcyl_hull(10, 20, 2); module roundcyl_fill(r, h, roundr) { for (z = [roundr, h-roundr]) { translate([0,0,z]) rotate_extrude() translate([r-roundr, 0]) circle(r=roundr); } cylinder(h=h, r=r-roundr); translate([0,0,roundr]) cylinder(h=h-roundr*2, r=r); } translate([20,0,0]) roundcyl_fill(10, 20, 2); Note that the "fill" variant (on the right) has a slight ridge at the top and bottom.  That's because the circle being extruded has only 7 sides, and doesn't have a vertex pointing up that extends all the way to the actual radius, while the fill cylinder does extend to the full height.  This can be addressed by forcing the circle to have a multiple of four sides. Note also that there are several corner cases that this doesn't attempt to address.  Both will, for instance, get into trouble if the cylinder radius or height are less than twice the rounding radius.
RW
Raymond West
Tue, Oct 3, 2023 9:48 AM

Is there some law about not using Minkowsk?

Is there some law about not using Minkowsk?
NH
nop head
Tue, Oct 3, 2023 9:50 AM

Only that it is glacialy slow if the shape is not convex.

On Tue, 3 Oct 2023, 10:48 Raymond West, raywest@raywest.com wrote:

Is there some law about not using Minkowsk?


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Only that it is glacialy slow if the shape is not convex. On Tue, 3 Oct 2023, 10:48 Raymond West, <raywest@raywest.com> wrote: > Is there some law about not using Minkowsk? > > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
AM
Adrian Mariano
Tue, Oct 3, 2023 10:52 AM

One of my early models used minkowski.  It was 20 minutes to preview.  Is
minkowski reliably fast on convex objects?

On Tue, Oct 3, 2023 at 5:51 AM nop head nop.head@gmail.com wrote:

Only that it is glacialy slow if the shape is not convex.

On Tue, 3 Oct 2023, 10:48 Raymond West, raywest@raywest.com wrote:

Is there some law about not using Minkowsk?


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

One of my early models used minkowski. It was 20 minutes to preview. Is minkowski reliably fast on convex objects? On Tue, Oct 3, 2023 at 5:51 AM nop head <nop.head@gmail.com> wrote: > Only that it is glacialy slow if the shape is not convex. > > On Tue, 3 Oct 2023, 10:48 Raymond West, <raywest@raywest.com> wrote: > >> Is there some law about not using Minkowsk? >> >> >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
RW
Rogier Wolff
Tue, Oct 3, 2023 12:13 PM

On Tue, Oct 03, 2023 at 10:48:30AM +0100, Raymond West wrote:

Is there some law about not using Minkowsk?

It is so unbelievably slow that in practice you can't use it outside
of trival examples.

Roger. 

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

On Tue, Oct 03, 2023 at 10:48:30AM +0100, Raymond West wrote: > Is there some law about not using Minkowsk? It is so unbelievably slow that in practice you can't use it outside of trival examples. Roger. -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a is going up. -- Chris Hadfield about flying up the space shuttle.
NS
Nathan Sokalski
Tue, Oct 3, 2023 4:33 PM

minkowski is at the top of my list when it comes to functionality & simplicity in OpenSCAD where it gives a correct preview. However, it is at the bottom when rendering, because I have very rarely had scenarios in which it renders successfully. Because of this, I generally avoid it, because I see no point in writing code that cannot be rendered, since I cannot export & print models that cannot be rendered. These same statements usually apply to hull().

Nathan Sokalski
njsokalski@hotmail.commailto:njsokalski@hotmail.com


From: Adrian Mariano avm4@cornell.edu
Sent: Tuesday, October 3, 2023 6:52 AM
To: OpenSCAD general discussion Mailing-list discuss@lists.openscad.org
Subject: [OpenSCAD] Re: rounding of standard objects

One of my early models used minkowski.  It was 20 minutes to preview.  Is minkowski reliably fast on convex objects?

On Tue, Oct 3, 2023 at 5:51 AM nop head <nop.head@gmail.commailto:nop.head@gmail.com> wrote:
Only that it is glacialy slow if the shape is not convex.

On Tue, 3 Oct 2023, 10:48 Raymond West, <raywest@raywest.commailto:raywest@raywest.com> wrote:

Is there some law about not using Minkowsk?

[X]


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.orgmailto:discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.orgmailto:discuss-leave@lists.openscad.org

minkowski is at the top of my list when it comes to functionality & simplicity in OpenSCAD where it gives a correct preview. However, it is at the bottom when rendering, because I have very rarely had scenarios in which it renders successfully. Because of this, I generally avoid it, because I see no point in writing code that cannot be rendered, since I cannot export & print models that cannot be rendered. These same statements usually apply to hull(). Nathan Sokalski njsokalski@hotmail.com<mailto:njsokalski@hotmail.com> ________________________________ From: Adrian Mariano <avm4@cornell.edu> Sent: Tuesday, October 3, 2023 6:52 AM To: OpenSCAD general discussion Mailing-list <discuss@lists.openscad.org> Subject: [OpenSCAD] Re: rounding of standard objects One of my early models used minkowski. It was 20 minutes to preview. Is minkowski reliably fast on convex objects? On Tue, Oct 3, 2023 at 5:51 AM nop head <nop.head@gmail.com<mailto:nop.head@gmail.com>> wrote: Only that it is glacialy slow if the shape is not convex. On Tue, 3 Oct 2023, 10:48 Raymond West, <raywest@raywest.com<mailto:raywest@raywest.com>> wrote: Is there some law about not using Minkowsk? [X] _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org<mailto:discuss-leave@lists.openscad.org> _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org<mailto:discuss-leave@lists.openscad.org>
P
pproj@posteo.de
Sat, Oct 7, 2023 3:33 PM

On 02.10.23 19:28, Jordan Brown wrote:

On 9/30/2023 6:02 AM, Karl Exler wrote:

what is the preferred way to round edges of standard objects e.g an
cylinder(h=3,r=5) ?

As Revar says, using BOSL2 is the easiest.

I do object.

Constructive lib is the easiest :) , something like like chamfer(-1,-1)
tube(d=10,wall=4,h=20)

https://github.com/solidboredom/constructive/blob/main/tutorials/basic-tutorial.md#advanced-building-block-chamfer--tube

it is chamfering not quite rounding (mainly for openscad performance
reasons), but in many cases this is what you actually want.

On 02.10.23 19:28, Jordan Brown wrote: > On 9/30/2023 6:02 AM, Karl Exler wrote: >> what is the preferred way to round edges of standard objects e.g an >> cylinder(h=3,r=5) ? > > As Revar says, using BOSL2 is the easiest. I do object. Constructive lib is the easiest :) , something like like chamfer(-1,-1) tube(d=10,wall=4,h=20) https://github.com/solidboredom/constructive/blob/main/tutorials/basic-tutorial.md#advanced-building-block-chamfer--tube it is chamfering not quite rounding (mainly for openscad performance reasons), but in many cases this is what you actually want.