Filleting again...

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

Filleting again...

stressless
This post was updated on .
Bonjour !

Filleting 3D parts is still an enigma for me.
I'd like to obtain this (uses minkowsky)


The minkowsky transformation takes ages to render and screws up dimensions.

How can I obtain the filleted part above without using minkowsky ?

Here is the code :

//offset_3d() {
    difference() {
        cube([50, 50, 35], center = true);
        union() {
            translate([31,0,0])
                cube([75, 65, 29.8], center = true);
            translate([-35, 0, 0])
                cylinder(h= 60, r1= 25, r2=25, center = true, $fn=20);
            translate([-14,-26,0])
                cylinder (h=30, d=12, center= true, $fn=100);
            translate([-14,26,0])
                cylinder (h=30, d=12, center= true, $fn=50);

       }
    }
//}


module offset_3d(r=1.5) {
  for(k=[0:$children-1]) minkowski() {
        children(k);
        sphere(r=r,$fn=8);
  }
}
//* * * * * * * * * * * * * *

Thanks in advance for any input.
Dan
Reply | Threaded
Open this post in threaded view
|

Re: Fileting again...

Ronaldo
My computer has rendered your model in 103 sec. It is a reasonable time.

Yes, minkowski() changes the model dimensions adding the dimensions of the two (or more) models it operates on. To solve this, subtract the sphere diameter from each positive cube and add it to each negative primitive dimensions composing your model before applying minkowski. That is, apply minkowski to a negative offset of your model. This process has some constraints.

module filleted_model(rad=1.2) {
    // for rad>1.2, some parts of the model would vanish in the negative offset
    if(rad>1.2) model(); // your original model, without filleting
    else
    offset_3d(rad)
        difference() {
            cube([50-2*rad, 50-2*rad, 35-2*rad], center = true); // positive
            union() { // negative
                translate([31,0,0])
                    cube([75+2*rad, 65+2*rad, 29.8+2*rad], center = true);
                translate([-35, 0, 0])
                    cylinder(h= 60+2*rad, r1= 25+rad, r2=25+rad, center = true, $fn=20);
                translate([-14,-26,0])
                    cylinder (h=30+2*rad, d=12+2*rad, center= true, $fn=100);
                translate([-14,26,0])
                    cylinder (h=30+2*rad, d=12+2*rad, center= true, $fn=50);

           }
        }
}


I don't know any other way to do it.

2017-02-27 7:18 GMT-03:00 stressless <[hidden email]>:

The minkowsky transformation takes ages to render and screws up dimensions.

How can I obtain the fileted part seen in top pic. without using minkowsky ?


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

Re: Filleting again...

noil
In reply to this post by stressless
If I understood correctly, what it is, you want this should do the trick:

module offset_3d(r=1.5, size=60)
{
    difference()
    {
        children();
        difference()
        {
            children();
            minkowski()
            {
                difference()
                {
                    cube(size,center=true);
                    children();
                }
                sphere(r,$fn=8);
            }
        }
    }
}
Reply | Threaded
Open this post in threaded view
|

Re: Filleting again...

Ronaldo
It works but the following is simpler and faster:

module negative_offset_3d(r=1, size=1000){
    difference()
    {
        cube(size-1,center=true);
        minkowski()
        {
            difference()
            {
                cube(size,center=true);
                children();
            }
            sphere(r,$fn=8);
        }
    }
}
If you don't know the diameter of the model (size), you will need a second minkowski, though.
Reply | Threaded
Open this post in threaded view
|

Re: Filleting again...

stressless
Ronaldo and Noil,

Thanks for your input but I cannot make it work. I get no filleting on my part at all using your solutions.
As an example, could you please integrate these modules into my original code so that I can understand ? (blushing Newbie)

Here it is again :

$fn=20;
offset_3d() {
    difference() {
        cube([50, 50, 35], center = true);
        union() {
            translate([31,0,0])
                cube([75, 65, 31.8], center = true);
            translate([-35, 0, 0])
                cylinder(h= 60, r1= 25, r2=25, center = true);
            translate([-14,-26,0])
                cylinder (h=30, d=12, center= true, $fn=20);
            translate([-14,26,0])
                cylinder (h=30, d=12, center= true, $fn=20);
       }
    }
}

module offset_3d(r=1.0) {
  for(k=[0:$children-1]) minkowski() {
    children(k);
    sphere(r=r,$fn=8);
  }
}

Thanks a bunch.
Dan



On Tue, Feb 28, 2017 at 4:20 PM, Ronaldo [via OpenSCAD] <[hidden email]> wrote:
It works but the following is simpler and faster:

module negative_offset_3d(r=1, size=1000){
    difference()
    {
        cube(size-1,center=true);
        minkowski()
        {
            difference()
            {
                cube(size,center=true);
                children();
            }
            sphere(r,$fn=8);
        }
    }
}
If you don't know the diameter of the model (size), you will need a second minkowski, though.


If you reply to this email, your message will be added to the discussion below:
http://forum.openscad.org/Filleting-again-tp20610p20650.html
To unsubscribe from Filleting again..., click here.
NAML



--
* * * * * * * * * * * * * * * * * * * *
- Composants électroniques pour votre Hobby => www.pepTronic.ch


Reply | Threaded
Open this post in threaded view
|

Re: Filleting again...

Ronaldo
In the following code, it is used a general offset_3d module that accepts both positive and negative offsets.
To apply the filleting we proceed like in the 2D case: first offset the model by -r then offset it by r so that the object general dimensions are preserved. Note that I have chosen r=0.7 instead of r=1 in your example; the thickness of the two horizontal flaps is (35-31.8)/2 = 1.6 so the maximum offset radius should be 0.8 otherwise some parts of your object will vanish with the negative offset. Try it to see.


render()
//offset_3d(-0.7)
//offset_3d(0.7)
offset_3d(0.7)
offset_3d(-0.7) stressless_model()

module stressless_model()
    difference() {
        cube([50, 50, 35], center = true);
        union() {
            translate([31,0,0])
                cube([75, 65, 31.8], center = true);
            translate([-35, 0, 0])
                cylinder(h= 60, r1= 25, r2=25, center = true);
            translate([-14,-26,0])
                cylinder (h=30, d=12, center= true, $fn=20);
            translate([-14,26,0])
                cylinder (h=30, d=12, center= true, $fn=20);
       }
    }

module offset_3d(r=1, size=1e12) {
    n = $fn==undef ? 12: $fn;
    if(r==0) children();
    else
        if( r>0 )
            minkowski(){
                children();
                sphere(r, $fn=n);
            }
    else {
        size2 = size*[1,1,1];
        size1 = size2*0.99;
        difference(){
            cube(size2, center=true);
            minkowski(){
                difference(){
                    cube(size1, center=true);
                    children();
                }
                sphere(-r, $fn=n);;
            }
        }
    }
}


 
​This filleting is applied only on "convex edges" (the edges whose outer dihedral angle is greater than 180 degrees). To fillet the other edges the offset operation order should be inverted. To fillet all edges 4 offset_3d() operations should be applied in sequence (uncomment the two commented lines to see it - be very patient).

Each offset_3d() operation involves a minkowski and increases the number of vertices of the model. So, the next offset_3d() will take even longer time. My rather old notebook spent more than 7 min to render the code above.


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

Re: Filleting again...

stressless
Ronaldo wrote
In the following code, it is used a general offset_3d module that accepts both positive and negative offsets. To apply the filleting we proceed like in the 2D case: first offset the model by -r then offset it by r so that the object general dimensions are preserved. Note that I have chosen r=0.7 instead of r=1 in your example; the thickness of the two horizontal flaps is (35-31.8)/2 = 1.6 so the maximum offset radius should be 0.8 otherwise some parts of your object will vanish with the negative offset.
Got it ! Thanks for the explanation and for your time helping me with this.

Dan

* * * * * * * * * * * * * *