discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Rectangle with one curved edge

JT
John Tucker
Thu, Apr 6, 2017 12:57 AM

I've embarrassed myself by asking stupid things on this list before;
I hope this isn't another. I'm trying to make a bit of a fiddly part.
It's to be a positive of an existing jaw which will later be a negative
(differenced) insert for a fit-over part.

The cross section is basically a rectangle with one side slightly
convex and the corners are slightly radiused. I had my first
printing (SLS) made without the convex face and the fit was
unacceptable. My question is: Is it possible to make an
intersection of an arc of a circle and a rectangle made by hulling
circles ?

Here's one of my attempts:
CX=9.525;    // Cross section
CR=1;        // Corner (fillet) Radius
X=CX-CR;    // Cen to Cen of Circles
H=CX-9;      // Cord height
R=(pow(CX,2)+(4pow(H,2)))/(8H);
$fn=64;

echo("radius= ",R);

module jawx(){
hull(){
translate([X/2-(1.15H),X/2])circle(CR); // 1.15 empirical
translate([X/2-(1.15
H),-X/2])circle(CR);// to approx tang pt
translate([-X/2,X/2])circle(CR);
translate([-X/2,-X/2])circle(CR);
}
}

intersection(){  //
%  linear_extrude(height=12) circle(r=R); // Extrude the disc
translate([2X-(.5H),0,0])

linear_extrude(height=12)  jawx(); // Extrude rect jaw x-section

}

I'm still using that crufty OpenSCAD version 2012.05.26 on Debian
3.2.86-1 i686 GNU/Linux.

TIA for any clues.

I've embarrassed myself by asking stupid things on this list before; I hope this isn't another. I'm trying to make a bit of a fiddly part. It's to be a positive of an existing jaw which will later be a negative (differenced) insert for a fit-over part. The cross section is basically a rectangle with one side slightly convex and the corners are slightly radiused. I had my first printing (SLS) made without the convex face and the fit was unacceptable. My question is: Is it possible to make an intersection of an arc of a circle and a rectangle made by hulling circles ? Here's one of my attempts: CX=9.525; // Cross section CR=1; // Corner (fillet) Radius X=CX-CR; // Cen to Cen of Circles H=CX-9; // Cord height R=(pow(CX,2)+(4*pow(H,2)))/(8*H); $fn=64; echo("radius= ",R); module jawx(){ hull(){ translate([X/2-(1.15*H),X/2])circle(CR); // 1.15 empirical translate([X/2-(1.15*H),-X/2])circle(CR);// to approx tang pt translate([-X/2,X/2])circle(CR); translate([-X/2,-X/2])circle(CR); } } intersection(){ // % linear_extrude(height=12) circle(r=R); // Extrude the disc translate([2*X-(.5*H),0,0]) # linear_extrude(height=12) jawx(); // Extrude rect jaw x-section } I'm still using that crufty OpenSCAD version 2012.05.26 on Debian 3.2.86-1 i686 GNU/Linux. TIA for any clues.
M
MichaelAtOz
Thu, Apr 6, 2017 2:47 AM

Something like this:

intersection(){ //
linear_extrude(height=12)
circle(r=R); // Extrude the disc
translate([2X-(.5H),-CX/2,0])
cube([CX,CX,12]);
}
translate([2X-(.5H),0,0])
linear_extrude(height=12)
jawx(); // Extrude rect jaw x-section


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!

View this message in context: http://forum.openscad.org/Rectangle-with-one-curved-edge-tp21097p21098.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Something like this: intersection(){ // linear_extrude(height=12) circle(r=R); // Extrude the disc translate([2*X-(.5*H),-CX/2,0]) cube([CX,CX,12]); } translate([2*X-(.5*H),0,0]) linear_extrude(height=12) jawx(); // Extrude rect jaw x-section ----- 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! -- View this message in context: http://forum.openscad.org/Rectangle-with-one-curved-edge-tp21097p21098.html Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Thu, Apr 6, 2017 2:59 AM

Don't be embarrassed. Even those who don't act makes mistakes.

Hull() doesn't help here.

To get a rectangle with rounded edges, intersect circles:

$fn = 120;
module arc_square(sx,sy,Rx,Ry) render()
intersection(){
translate([-Rx+sx/2,0]) circle(Rx);
translate([ Rx-sx/2,0]) circle(Rx);
translate([0,-Ry+sy/2]) circle(Ry);
translate([0, Ry-sy/2]) circle(Ry);
}


To round vertices, use offset:

offset(r) square([a,b], center=true);


To get both, a little math is needed:

a = 30; // rectangle width
b = 20; // rectangle height
e = 2;  // rect. side bulge

Rx = e/2 + bb/e/8;
Ry = e/2 + a
a/e/8; echo(Rx, Ry);
r = 3;
color("blue")
offset(r)
arc_square(a+2e-2r,b+2e-2r,Rx,Ry);

translate([0,0,2]) square([a,b],center=true); // just to compare

/*
Using Pythagoras
R^2 = (R-e)^2 + (a/2)^2
0 = -2eR + e^2 + (a/2)^2
R = e/2 + (a/2)^2 / e / 2
*/


Now just linear_extrude() this polygon.

BTW, to make a cylinder you don't need linear_extrude().

2017-04-05 21:57 GMT-03:00 John Tucker jart3@verizon.net:

I've embarrassed myself by asking stupid things on this list before;

I hope this isn't another. I'm trying to make a bit of a fiddly part.

It's to be a positive of an existing jaw which will later be a negative

(differenced) insert for a fit-over part.

The cross section is basically a rectangle with one side slightly

convex and the corners are slightly radiused. I had my first

printing (SLS) made without the convex face and the fit was

unacceptable. My question is: Is it possible to make an

intersection of an arc of a circle and a rectangle made by hulling

circles ?

Here's one of my attempts:

CX=9.525; // Cross section

CR=1; // Corner (fillet) Radius

X=CX-CR; // Cen to Cen of Circles

H=CX-9; // Cord height

R=(pow(CX,2)+(4pow(H,2)))/(8H);

$fn=64;

echo("radius= ",R);

module jawx(){

hull(){

translate([X/2-(1.15*H),X/2])circle(CR); // 1.15 empirical

translate([X/2-(1.15*H),-X/2])circle(CR);// to approx tang pt

translate([-X/2,X/2])circle(CR);

translate([-X/2,-X/2])circle(CR);

}

}

intersection(){ //

% linear_extrude(height=12) circle(r=R); // Extrude the disc

translate([2X-(.5H),0,0])

linear_extrude(height=12) jawx(); // Extrude rect jaw x-section

}

I'm still using that crufty OpenSCAD version 2012.05.26 on Debian

3.2.86-1 i686 GNU/Linux.

TIA for any clues.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Don't be embarrassed. Even those who don't act makes mistakes. Hull() doesn't help here. To get a rectangle with rounded edges, intersect circles: $fn = 120; module arc_square(sx,sy,Rx,Ry) render() intersection(){ translate([-Rx+sx/2,0]) circle(Rx); translate([ Rx-sx/2,0]) circle(Rx); translate([0,-Ry+sy/2]) circle(Ry); translate([0, Ry-sy/2]) circle(Ry); } ​ To round vertices, use offset: offset(r) square([a,b], center=true); ​ To get both, a little math is needed: a = 30; // rectangle width b = 20; // rectangle height e = 2; // rect. side bulge Rx = e/2 + b*b/e/8; Ry = e/2 + a*a/e/8; echo(Rx, Ry); r = 3; color("blue") offset(r) arc_square(a+2*e-2*r,b+2*e-2*r,Rx,Ry); # translate([0,0,2]) square([a,b],center=true); // just to compare /* Using Pythagoras R^2 = (R-e)^2 + (a/2)^2 0 = -2*e*R + e^2 + (a/2)^2 R = e/2 + (a/2)^2 / e / 2 */ ​ Now just linear_extrude() this polygon. BTW, to make a cylinder you don't need linear_extrude(). ​ 2017-04-05 21:57 GMT-03:00 John Tucker <jart3@verizon.net>: > I've embarrassed myself by asking stupid things on this list before; > > I hope this isn't another. I'm trying to make a bit of a fiddly part. > > It's to be a positive of an existing jaw which will later be a negative > > (differenced) insert for a fit-over part. > > > > The cross section is basically a rectangle with one side slightly > > convex and the corners are slightly radiused. I had my first > > printing (SLS) made without the convex face and the fit was > > unacceptable. My question is: Is it possible to make an > > intersection of an arc of a circle and a rectangle made by hulling > > circles ? > > > > Here's one of my attempts: > > CX=9.525; // Cross section > > CR=1; // Corner (fillet) Radius > > X=CX-CR; // Cen to Cen of Circles > > H=CX-9; // Cord height > > R=(pow(CX,2)+(4*pow(H,2)))/(8*H); > > $fn=64; > > > > echo("radius= ",R); > > > > module jawx(){ > > hull(){ > > translate([X/2-(1.15*H),X/2])circle(CR); // 1.15 empirical > > translate([X/2-(1.15*H),-X/2])circle(CR);// to approx tang pt > > translate([-X/2,X/2])circle(CR); > > translate([-X/2,-X/2])circle(CR); > > } > > } > > > > intersection(){ // > > % linear_extrude(height=12) circle(r=R); // Extrude the disc > > translate([2*X-(.5*H),0,0]) > > # linear_extrude(height=12) jawx(); // Extrude rect jaw x-section > > } > > > > I'm still using that crufty OpenSCAD version 2012.05.26 on Debian > > 3.2.86-1 i686 GNU/Linux. > > > > TIA for any clues. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
FV
Frank van der Hulst
Thu, Apr 6, 2017 3:22 AM

Minkowski() is a good way to radius corners.

On 6/04/2017 14:59, "Ronaldo Persiano" rcmpersiano@gmail.com wrote:

Don't be embarrassed. Even those who don't act makes mistakes.

Hull() doesn't help here.

To get a rectangle with rounded edges, intersect circles:

$fn = 120;
module arc_square(sx,sy,Rx,Ry) render()
intersection(){
translate([-Rx+sx/2,0]) circle(Rx);
translate([ Rx-sx/2,0]) circle(Rx);
translate([0,-Ry+sy/2]) circle(Ry);
translate([0, Ry-sy/2]) circle(Ry);
}


To round vertices, use offset:

offset(r) square([a,b], center=true);


To get both, a little math is needed:

a = 30; // rectangle width
b = 20; // rectangle height
e = 2;  // rect. side bulge

Rx = e/2 + bb/e/8;
Ry = e/2 + a
a/e/8; echo(Rx, Ry);
r = 3;
color("blue")
offset(r)
arc_square(a+2e-2r,b+2e-2r,Rx,Ry);

translate([0,0,2]) square([a,b],center=true); // just to compare

/*
Using Pythagoras
R^2 = (R-e)^2 + (a/2)^2
0 = -2eR + e^2 + (a/2)^2
R = e/2 + (a/2)^2 / e / 2
*/


Now just linear_extrude() this polygon.

BTW, to make a cylinder you don't need linear_extrude().

2017-04-05 21:57 GMT-03:00 John Tucker jart3@verizon.net:

I've embarrassed myself by asking stupid things on this list before;

I hope this isn't another. I'm trying to make a bit of a fiddly part.

It's to be a positive of an existing jaw which will later be a negative

(differenced) insert for a fit-over part.

The cross section is basically a rectangle with one side slightly

convex and the corners are slightly radiused. I had my first

printing (SLS) made without the convex face and the fit was

unacceptable. My question is: Is it possible to make an

intersection of an arc of a circle and a rectangle made by hulling

circles ?

Here's one of my attempts:

CX=9.525; // Cross section

CR=1; // Corner (fillet) Radius

X=CX-CR; // Cen to Cen of Circles

H=CX-9; // Cord height

R=(pow(CX,2)+(4pow(H,2)))/(8H);

$fn=64;

echo("radius= ",R);

module jawx(){

hull(){

translate([X/2-(1.15*H),X/2])circle(CR); // 1.15 empirical

translate([X/2-(1.15*H),-X/2])circle(CR);// to approx tang pt

translate([-X/2,X/2])circle(CR);

translate([-X/2,-X/2])circle(CR);

}

}

intersection(){ //

% linear_extrude(height=12) circle(r=R); // Extrude the disc

translate([2X-(.5H),0,0])

linear_extrude(height=12) jawx(); // Extrude rect jaw x-section

}

I'm still using that crufty OpenSCAD version 2012.05.26 on Debian

3.2.86-1 i686 GNU/Linux.

TIA for any clues.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Minkowski() is a good way to radius corners. On 6/04/2017 14:59, "Ronaldo Persiano" <rcmpersiano@gmail.com> wrote: > Don't be embarrassed. Even those who don't act makes mistakes. > > Hull() doesn't help here. > > To get a rectangle with rounded edges, intersect circles: > > $fn = 120; > module arc_square(sx,sy,Rx,Ry) render() > intersection(){ > translate([-Rx+sx/2,0]) circle(Rx); > translate([ Rx-sx/2,0]) circle(Rx); > translate([0,-Ry+sy/2]) circle(Ry); > translate([0, Ry-sy/2]) circle(Ry); > } > > ​ > To round vertices, use offset: > > offset(r) square([a,b], center=true); > > > ​ > To get both, a little math is needed: > > a = 30; // rectangle width > b = 20; // rectangle height > e = 2; // rect. side bulge > > Rx = e/2 + b*b/e/8; > Ry = e/2 + a*a/e/8; echo(Rx, Ry); > r = 3; > color("blue") > offset(r) > arc_square(a+2*e-2*r,b+2*e-2*r,Rx,Ry); > # translate([0,0,2]) square([a,b],center=true); // just to compare > > /* > Using Pythagoras > R^2 = (R-e)^2 + (a/2)^2 > 0 = -2*e*R + e^2 + (a/2)^2 > R = e/2 + (a/2)^2 / e / 2 > */ > > ​ > Now just linear_extrude() this polygon. > > BTW, to make a cylinder you don't need linear_extrude(). > ​ > > 2017-04-05 21:57 GMT-03:00 John Tucker <jart3@verizon.net>: > >> I've embarrassed myself by asking stupid things on this list before; >> >> I hope this isn't another. I'm trying to make a bit of a fiddly part. >> >> It's to be a positive of an existing jaw which will later be a negative >> >> (differenced) insert for a fit-over part. >> >> >> >> The cross section is basically a rectangle with one side slightly >> >> convex and the corners are slightly radiused. I had my first >> >> printing (SLS) made without the convex face and the fit was >> >> unacceptable. My question is: Is it possible to make an >> >> intersection of an arc of a circle and a rectangle made by hulling >> >> circles ? >> >> >> >> Here's one of my attempts: >> >> CX=9.525; // Cross section >> >> CR=1; // Corner (fillet) Radius >> >> X=CX-CR; // Cen to Cen of Circles >> >> H=CX-9; // Cord height >> >> R=(pow(CX,2)+(4*pow(H,2)))/(8*H); >> >> $fn=64; >> >> >> >> echo("radius= ",R); >> >> >> >> module jawx(){ >> >> hull(){ >> >> translate([X/2-(1.15*H),X/2])circle(CR); // 1.15 empirical >> >> translate([X/2-(1.15*H),-X/2])circle(CR);// to approx tang pt >> >> translate([-X/2,X/2])circle(CR); >> >> translate([-X/2,-X/2])circle(CR); >> >> } >> >> } >> >> >> >> intersection(){ // >> >> % linear_extrude(height=12) circle(r=R); // Extrude the disc >> >> translate([2*X-(.5*H),0,0]) >> >> # linear_extrude(height=12) jawx(); // Extrude rect jaw x-section >> >> } >> >> >> >> I'm still using that crufty OpenSCAD version 2012.05.26 on Debian >> >> 3.2.86-1 i686 GNU/Linux. >> >> >> >> TIA for any clues. >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
M
MichaelAtOz
Thu, Apr 6, 2017 3:33 AM

one side slightly convex

using that crufty OpenSCAD version 2012.05.26

Thus no offset()


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!

View this message in context: http://forum.openscad.org/Rectangle-with-one-curved-edge-tp21097p21102.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

> one side slightly convex > using that crufty OpenSCAD version 2012.05.26 Thus no offset() ----- 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! -- View this message in context: http://forum.openscad.org/Rectangle-with-one-curved-edge-tp21097p21102.html Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Thu, Apr 6, 2017 4:22 AM

2017-04-06 0:33 GMT-03:00 MichaelAtOz oz.at.michael@gmail.com:

one side slightly convex

using that crufty OpenSCAD version 2012.05.26

Thus no offset()

Does it have minkowski() ?

module offset(r) {
very_big = 1e16; // something greater then the children size
render()
if(r>0)
minkowski(){
children();
circle(r);
}
else
difference(){
square(very_big-1,center=true);
minkowski(){
difference(){
square(very_big,center=true);
children();
}
circle(-r);
}
}
}

2017-04-06 0:33 GMT-03:00 MichaelAtOz <oz.at.michael@gmail.com>: > > one side slightly convex > > > using that crufty OpenSCAD version 2012.05.26 > > Thus no offset() > Does it have minkowski() ? module offset(r) { very_big = 1e16; // something greater then the children size render() if(r>0) minkowski(){ children(); circle(r); } else difference(){ square(very_big-1,center=true); minkowski(){ difference(){ square(very_big,center=true); children(); } circle(-r); } } }
NH
nop head
Thu, Apr 6, 2017 10:24 AM

Ronaldo,
Why does your offset square example above have slightly curved edges? It
should have straight edges and rounded corners and does when I try it.

On 6 April 2017 at 05:22, Ronaldo Persiano rcmpersiano@gmail.com wrote:

2017-04-06 0:33 GMT-03:00 MichaelAtOz oz.at.michael@gmail.com:

one side slightly convex

using that crufty OpenSCAD version 2012.05.26

Thus no offset()

Does it have minkowski() ?

module offset(r) {
very_big = 1e16; // something greater then the children size
render()
if(r>0)
minkowski(){
children();
circle(r);
}
else
difference(){
square(very_big-1,center=true);
minkowski(){
difference(){
square(very_big,center=true);
children();
}
circle(-r);
}
}
}


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Ronaldo, Why does your offset square example above have slightly curved edges? It should have straight edges and rounded corners and does when I try it. On 6 April 2017 at 05:22, Ronaldo Persiano <rcmpersiano@gmail.com> wrote: > 2017-04-06 0:33 GMT-03:00 MichaelAtOz <oz.at.michael@gmail.com>: > >> > one side slightly convex >> >> > using that crufty OpenSCAD version 2012.05.26 >> >> Thus no offset() >> > > Does it have minkowski() ? > > module offset(r) { > very_big = 1e16; // something greater then the children size > render() > if(r>0) > minkowski(){ > children(); > circle(r); > } > else > difference(){ > square(very_big-1,center=true); > minkowski(){ > difference(){ > square(very_big,center=true); > children(); > } > circle(-r); > } > } > } > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
RP
Ronaldo Persiano
Thu, Apr 6, 2017 6:29 PM

2017-04-06 7:24 GMT-03:00 nop head nop.head@gmail.com:

Ronaldo,
Why does your offset square example above have slightly curved edges? It
should have straight edges and rounded corners and does when I try it.

You are right. The second image is a wrong image. That is what I should
have include instead:

I should correct myself in the statement that hull() would not help here.
It is possible to do it just with hull, without offset() or minkowski().
But the the math would be a little more complicate and I mention it here
for completeness. The solution would be the intersection of the rounded
edge rectangle with 4 big triangles with rounded vertices (a hull of 3
circles) well dimensioned and positioned.

2017-04-06 7:24 GMT-03:00 nop head <nop.head@gmail.com>: > Ronaldo, > Why does your offset square example above have slightly curved edges? It > should have straight edges and rounded corners and does when I try it. > > You are right. The second image is a wrong image. That is what I should have include instead: ​ I should correct myself in the statement that hull() would not help here. It is possible to do it just with hull, without offset() or minkowski(). But the the math would be a little more complicate and I mention it here for completeness. The solution would be the intersection of the rounded edge rectangle with 4 big triangles with rounded vertices (a hull of 3 circles) well dimensioned and positioned.
C
cbernhardt
Fri, Apr 7, 2017 12:35 PM

Do you have access to a CAD program that produces a DXF file?
The simple way would be to draw the profile in cad using your exact
dimensions and then import it into OpenSCAD.
http://forum.openscad.org/file/n21113/rect.jpg

--
View this message in context: http://forum.openscad.org/Rectangle-with-one-curved-edge-tp21097p21113.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Do you have access to a CAD program that produces a DXF file? The simple way would be to draw the profile in cad using your exact dimensions and then import it into OpenSCAD. <http://forum.openscad.org/file/n21113/rect.jpg> -- View this message in context: http://forum.openscad.org/Rectangle-with-one-curved-edge-tp21097p21113.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
phormix
Thu, Oct 11, 2018 7:08 AM

Bit of a necropost here but I had a similar question with rounded corners and
though I'd share my formulae, which combine and outer/inner cube and
cylinders to create beveled corners

module beveled_rect(w,d,h,r){
union() {
translate([r,r,h/2]) cylinder(r = r, h = h, center = true);
translate([w-r,r,h/2]) cylinder(r = r, h = h, center = true);
translate([r,0, 0]) cube([w-(r*2),r,h]);

translate([r,d-r,h/2]) cylinder(r = r, h = h, center = true);
translate([w-r,d-r,h/2]) cylinder(r = r, h = h, center = true);
translate([r,d-r, 0]) cube([w-(r*2),r,h]);

translate([0, r, 0]) cube([w,d-(r*2),h]);
}
}

module beveled_rect_bot(w,d,h,r){
union() {
translate([r,r,h/2]) cylinder(r = r, h = h, center = true);
translate([w-r,r,h/2]) cylinder(r = r, h = h, center = true);
translate([r,0, 0]) cube([w-(r*2),r,h]);

translate([0, r, 0]) cube([w,d-r,h]);
}
}

This of course focuses on bevelled/rounded corners, but one could just as
easily do the same logic with the whole edge.

As I make formulae etc I'll be posting them to my own wiki as well:

https://wiki.phormix.com/pub/index.php?title=OpenSCAD_Modules

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

Bit of a necropost here but I had a similar question with rounded corners and though I'd share my formulae, which combine and outer/inner cube and cylinders to create beveled corners module beveled_rect(w,d,h,r){ union() { translate([r,r,h/2]) cylinder(r = r, h = h, center = true); translate([w-r,r,h/2]) cylinder(r = r, h = h, center = true); translate([r,0, 0]) cube([w-(r*2),r,h]); translate([r,d-r,h/2]) cylinder(r = r, h = h, center = true); translate([w-r,d-r,h/2]) cylinder(r = r, h = h, center = true); translate([r,d-r, 0]) cube([w-(r*2),r,h]); translate([0, r, 0]) cube([w,d-(r*2),h]); } } module beveled_rect_bot(w,d,h,r){ union() { translate([r,r,h/2]) cylinder(r = r, h = h, center = true); translate([w-r,r,h/2]) cylinder(r = r, h = h, center = true); translate([r,0, 0]) cube([w-(r*2),r,h]); translate([0, r, 0]) cube([w,d-r,h]); } } This of course focuses on bevelled/rounded corners, but one could just as easily do the same logic with the whole edge. As I make formulae etc I'll be posting them to my own wiki as well: https://wiki.phormix.com/pub/index.php?title=OpenSCAD_Modules -- Sent from: http://forum.openscad.org/