Discussion:
[OpenSCAD] Rounding a sharp corner?
Mark Harrison
2018-08-12 23:24:56 UTC
Permalink
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
// ???
}
Parkinbot
2018-08-13 00:21:03 UTC
Permalink
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/
Mark Harrison
2018-08-13 01:59:54 UTC
Permalink
Post by Parkinbot
Hm, better start in 2D and then try to use offset() for things like this.
This is perfect, thanks very much!
Frank van der Hulst
2018-08-13 06:18:50 UTC
Permalink
Minkowski is also good for rounding edges and corners.
Post by Mark Harrison
Post by Parkinbot
Hm, better start in 2D and then try to use offset() for things like this.
This is perfect, thanks very much!
_______________________________________________
OpenSCAD mailing list
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Troberg
2018-08-14 16:02:47 UTC
Permalink
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/

Loading...