Round anything - Retrospective rounding/filleting module

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

Round anything - Retrospective rounding/filleting module

irevdev
Hi All,

I wrote this module last week and it is what I think is an incredibly powerful module that will allow you to fillet any OpenSCAD models retrospectively while keeping the original dimensions. Models don't need to be designed again with rounded cubes etc, just throw minkowskiRound() out the front of it and your good to go. But I can't help but thinking that surely someone has done this before? I figured this is the best place to ask!?.

Biggest downside is that it is very computationally intensive, needs low $fn unless you are willing to wait a long time (12 hours plus).

Github page here

Thingiverse page also
Reply | Threaded
Open this post in threaded view
|

Re: Round anything - Retrospective rounding/filleting module

doug.moen
You aren't the first person to discover these techniques (they are easy to find using google), but the way that you have packaged them in a module is very nice. Thanks for posting this.

You might be able to get rid of the envelopeCube argument. Take a look at this:
https://www.reddit.com/r/openscad/comments/5u96tj/how_can_i_set_a_fillet_in_the_edges_of_this_shape/

PS, The copyright notice in MinkowskiRound.scad says LGPL 2.1+ but the LICENSE file says GPL 3.

On 9 July 2017 at 06:36, irevdev <[hidden email]> wrote:
Hi All,

I wrote this module last week and it is what I think is an incredibly
powerful module that will allow you to fillet any OpenSCAD models
retrospectively while keeping the original dimensions. Models don't need to
be designed again with rounded cubes etc, just throw minkowskiRound() out
the front of it and your good to go. But I can't help but thinking that
surely someone has done this before? I figured this is the best place to
ask!?.

Biggest downside is that it is very computationally intensive, needs low $fn
unless you are willing to wait a long time (12 hours plus).

Github page here <https://github.com/Irev-Dev/Round-Anything>

Thingiverse page also <https://www.thingiverse.com/thing:2419664>



--
View this message in context: http://forum.openscad.org/Round-anything-Retrospective-rounding-filleting-module-tp21794.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.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: Round anything - Retrospective rounding/filleting module

Ronaldo
In reply to this post by irevdev
The strategy you use is similar to the one applied to round 2D polygons:

module round_external(r) offset(r)   offset(-r) children();
module round_internal(r) offset(-r)  offset(r)  children();

It would be valuable to define a 3Doffset as the base tool for roundings. 3Doffset may have it own applications besides filleting.

I am working now in a fast operator (module) that builds the bounding box of an object. It may well exempt the need to specify the envelopeCube.


2017-07-09 7:36 GMT-03:00 irevdev <[hidden email]>:
Hi All,

I wrote this module last week and it is what I think is an incredibly
powerful module that will allow you to fillet any OpenSCAD models
retrospectively while keeping the original dimensions. Models don't need to
be designed again with rounded cubes etc, just throw minkowskiRound() out
the front of it and your good to go. But I can't help but thinking that
surely someone has done this before? I figured this is the best place to
ask!?.

Biggest downside is that it is very computationally intensive, needs low $fn
unless you are willing to wait a long time (12 hours plus).

Github page here <https://github.com/Irev-Dev/Round-Anything>

Thingiverse page also <https://www.thingiverse.com/thing:2419664>



--
View this message in context: http://forum.openscad.org/Round-anything-Retrospective-rounding-filleting-module-tp21794.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.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: Round anything - Retrospective rounding/filleting module

MichaelAtOz
Administrator
Ronaldo wrote
I am working now in a fast operator (module) that builds the bounding box
of an object. It may well exempt the need to specify the envelopeCube.
Have you seen the second example here?
Admin - PM me if you need anything,
or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|

Re: Round anything - Retrospective rounding/filleting module

Ronaldo
2017-07-09 23:54 GMT-03:00 MichaelAtOz <[hidden email]>:
Ronaldo wrote
> I am working now in a fast operator (module) that builds the bounding box
> of an object. It may well exempt the need to specify the envelopeCube.

Have you seen the second example  here
<https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Commented_Example_Projects>
?

I was not aware of that. Thank you to drive my attention to it. 

Interesting approach although it fails in some simple cases like:

module P() { translate([500,100,10]) cube(20); translate([600,100,50]) cube(30); }
%BoundingBox() P();
P();

I use a different one: projection and linear_extrude, yes, but minkowski instead intersection. As the minkowski operations are just on blocks (like cubes), they are fast enough.

I will publish it here after polishing and testing enough. It is a shame that we cannot do minkowski mixing 1D, 2D and 3D objects. Many things would be easier then.


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

Re: Round anything - Retrospective rounding/filleting module

irevdev
Thanks Doug for pointing out the license discrepancy, I made it LGPL 2.1 originally because I was planning on trying to get it pulled into the MCAD library, but that project seems kind of dead so changed it to my preference GPL. Fixed now.

I had a look at the reddit post and that's more or less how I had the module originally but I added he envelope cube because it allowed me to remove excess minkowski() calls. i.e. the reddit code only does outside radius's and uses 3 minkowski() calls where as my minkowskiOutsideRound() module only uses two. I understand that differencing it with a giant cube is not very elegant but I'm happy with it since it saves time (I did test this and it was quicker).

Exactly Ronaldo, it was that 2d rounding method that got me thinking about this, and a 3Doffset that was nicer to my computer than minkowski(){children; sphere} would be great. Both for this rounding application but I would appreciate it for adding tolerances by differencing a two parts with one slightly expanded. Bounding box is a good idea, I'll look into it (though feel free to make a pull request).
Reply | Threaded
Open this post in threaded view
|

Re: Round anything - Retrospective rounding/filleting module

Ronaldo
In reply to this post by MichaelAtOz
Here is my version of an operator that computes the bounding box of a model. Its concept is simple: hull() the projection of the model on each axis (1D sets) and minkowski() them. As there is no way to define a 1D set in OpenSCAD, the projections are aproximated by a stick whose length is the size of the projection.

// offset may be either undef, a number or a vector of 3 numbers
module bbox(offset=0) {

    // a 3D approximation of the projection of children on X axis
    module xProjection()
        translate([0,1/2,-1/2])
            linear_extrude(1)
                hull()
                    projection()
                        rotate([90,0,0])
                            linear_extrude(1)
                                projection() children();

    module bbx() // a bounding box with an offset of 1 in all axis
        minkowski() {
            xProjection() children();
            rotate(-90)
                xProjection() rotate(90) children();
                rotate([0,-90,0])
                    xProjection() rotate([0,90,0]) children();
        }
   
    // compute the offset of children (a cube) in the 3 axis
    module offset(offs)
        if(max(offs)>0) union() {
            children();
            translate(offs) children();
            translate(-offs) children();
        }
        else intersection() {
            children();
            translate(offs) children();
            translate(-offs) children();
        }

    offs = len(offset)==3 ? offset  - [1,1,1] :
           offset==undef ? -[1,1,1] :
                (offset-1)*[1,1,1];
    offset([offs[0],0,0])
        offset([0,offs[1],0])
            offset([0,0,offs[2]])
                bbx() children();
}
The following image shows the bounding box (transparent) of a red model and the projections on the axis in blue.