discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Rounding a sharp corner?

MH
Mark Harrison
Sun, Aug 12, 2018 11:24 PM

Here's an X shape formed by cutting some ellipses out of a cube.
I would like to smooth the sharp corners on the sides by subtracting
a shape that will be tangent to the side ellipsis and the side of
the cube, as per the red markup in the attached image.

How can I calculate that shape, or otherwise smooth the sharp edge?

$fn=30;

ZZ=5;
WW=42;
HH=100;

difference() {
cube([WW,HH,ZZ]);
// top and bottom
translate([WW/2,0,0])  scale([1,2.5 ,1]) cylinder(ZZ,d=WW-(10));
translate([WW/2,HH,0]) scale([1,2.5,1]) cylinder(ZZ,d=WW-(10));
// sides
translate([0,HH/2,0]) scale([1,1.8,1]) cylinder(ZZ,r=WW/4);
translate([WW,HH/2,0]) scale([1,1.8,1]) cylinder(ZZ,r=WW/4);
// smooth the arms
// ???
}

Here's an X shape formed by cutting some ellipses out of a cube. I would like to smooth the sharp corners on the sides by subtracting a shape that will be tangent to the side ellipsis and the side of the cube, as per the red markup in the attached image. How can I calculate that shape, or otherwise smooth the sharp edge? $fn=30; ZZ=5; WW=42; HH=100; difference() { cube([WW,HH,ZZ]); // top and bottom translate([WW/2,0,0]) scale([1,2.5 ,1]) cylinder(ZZ,d=WW-(10)); translate([WW/2,HH,0]) scale([1,2.5,1]) cylinder(ZZ,d=WW-(10)); // sides translate([0,HH/2,0]) scale([1,1.8,1]) cylinder(ZZ,r=WW/4); translate([WW,HH/2,0]) scale([1,1.8,1]) cylinder(ZZ,r=WW/4); // smooth the arms // ??? }
P
Parkinbot
Mon, Aug 13, 2018 12:21 AM

Hm, better start in 2D and then try to use offset() for things like this.

ZZ=5;
WW=42;
HH=100;
os = 15;

linear_extrude(ZZ)
intersection()
{
square([WW,HH]);
difference()
{
offset(-os)offset(os)
{
translate([WW/2,0])  scale([1,2.5]) circle(d=WW);
translate([WW/2,HH,0]) scale([1,2.5,1]) circle(d=WW);
}
translate([WW/2,0])  scale([1,2.5]) circle(d=WW-(10));
translate([WW/2,HH,0]) scale([1,2.5,1]) circle(d=WW-(10));
}
}

--
Sent from: http://forum.openscad.org/

Hm, better start in 2D and then try to use offset() for things like this. ZZ=5; WW=42; HH=100; os = 15; linear_extrude(ZZ) intersection() { square([WW,HH]); difference() { offset(-os)offset(os) { translate([WW/2,0]) scale([1,2.5]) circle(d=WW); translate([WW/2,HH,0]) scale([1,2.5,1]) circle(d=WW); } translate([WW/2,0]) scale([1,2.5]) circle(d=WW-(10)); translate([WW/2,HH,0]) scale([1,2.5,1]) circle(d=WW-(10)); } } -- Sent from: http://forum.openscad.org/
MH
Mark Harrison
Mon, Aug 13, 2018 1:59 AM

On 8/12/18 5:21 PM, Parkinbot wrote:

Hm, better start in 2D and then try to use offset() for things like this.

This is perfect, thanks very much!

On 8/12/18 5:21 PM, Parkinbot wrote: > Hm, better start in 2D and then try to use offset() for things like this. This is perfect, thanks very much!
FV
Frank van der Hulst
Mon, Aug 13, 2018 6:18 AM

Minkowski is also good for rounding edges and corners.

On Mon, 13 Aug 2018, 2:00 PM Mark Harrison, marhar@gmail.com wrote:

On 8/12/18 5:21 PM, Parkinbot wrote:

Hm, better start in 2D and then try to use offset() for things like this.

Minkowski is also good for rounding edges and corners. On Mon, 13 Aug 2018, 2:00 PM Mark Harrison, <marhar@gmail.com> wrote: > On 8/12/18 5:21 PM, Parkinbot wrote: > > Hm, better start in 2D and then try to use offset() for things like this. > > This is perfect, thanks very much! > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
T
Troberg
Tue, Aug 14, 2018 4:02 PM

I use this handy little snippet for rounding corners in 2d:

module polyround(radius){
//Inside corners
offset(r=-radius)
offset(delta=radius)
//Outside corners
offset(r=radius)
offset(delta=-radius)
children();
}

//Sample code
//One sample shape
module poly(outer,inner){

polygon([[-outer,0],[-inner,inner],[0,outer],[inner,inner],[outer,0],[inner,-inner],[0,-outer],[-inner,-inner]]);
}

//Another sample shape
module poly2(){
translate([220,0,0])
difference(){
square([200,200], center=true);
square([100,100], center=true);
}
}

//First shape with rounded corners
polyround(10)
poly(100,30);

//Shape without rounded corners, for reference
translate([0,0,-1])
color("red")
poly(100,30);

//Second shape with rounded corners
polyround(10)
poly2();

//Shape without rounded corners, for reference
translate([0,0,-1])
color("red")
poly2();

--
Sent from: http://forum.openscad.org/

I use this handy little snippet for rounding corners in 2d: module polyround(radius){ //Inside corners offset(r=-radius) offset(delta=radius) //Outside corners offset(r=radius) offset(delta=-radius) children(); } //Sample code //One sample shape module poly(outer,inner){ polygon([[-outer,0],[-inner,inner],[0,outer],[inner,inner],[outer,0],[inner,-inner],[0,-outer],[-inner,-inner]]); } //Another sample shape module poly2(){ translate([220,0,0]) difference(){ square([200,200], center=true); square([100,100], center=true); } } //First shape with rounded corners polyround(10) poly(100,30); //Shape without rounded corners, for reference translate([0,0,-1]) color("red") poly(100,30); //Second shape with rounded corners polyround(10) poly2(); //Shape without rounded corners, for reference translate([0,0,-1]) color("red") poly2(); -- Sent from: http://forum.openscad.org/