discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] how to make round chamfer at 2D object?

P
Parkinbot
Wed, Dec 28, 2016 12:20 PM

eexpss wrote

interesting. maybe next version offset could add one parameter
"both-direction=true",  so only one offset(5, true) can do it. lol

Would be good candidate to be included into a (standard) library:

$fn = 30;
rad = 1.5;

Offset(r = rad, keepsize=true) rectangle_with_hole();

module rectangle_with_hole(a = 12, b = 16, th = 4)
{
difference()
{
square([a,b],center=true);
square([a-2th,b-2th],center=true);
}
}

module Offset(r=0, delta=0, chamfer=false, keepsize = false)
{
if(keepsize)
offset(r) offset(-r) offset(-r) offset(r) children();
else
offset(r = r, chamfer = chamfer) children();
}

If we had a qualified naming scheme or at least a synonym to refer to
built-in primitives for overriding, like $offset() it could be expressed
more transparently in this way:

module offset(r=0, delta=0, chamfer=false, keepsize = false)
{
if(keepsize)
$offset(r) $offset(-r) $offset(-r) $offset(r) children();
else
$offset(r = r, chamfer = chamfer) children();
}

--
View this message in context: http://forum.openscad.org/how-to-make-round-chamfer-at-2D-object-tp19714p19799.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

eexpss wrote > interesting. maybe next version offset could add one parameter > "both-direction=true", so only one offset(5, true) can do it. lol Would be good candidate to be included into a (standard) library: > $fn = 30; > rad = 1.5; > > Offset(r = rad, keepsize=true) rectangle_with_hole(); > > module rectangle_with_hole(a = 12, b = 16, th = 4) > { > difference() > { > square([a,b],center=true); > square([a-2*th,b-2*th],center=true); > } > } > > module Offset(r=0, delta=0, chamfer=false, keepsize = false) > { > if(keepsize) > offset(r) offset(-r) offset(-r) offset(r) children(); > else > offset(r = r, chamfer = chamfer) children(); > } If we had a qualified naming scheme or at least a synonym to refer to built-in primitives for overriding, like $offset() it could be expressed more transparently in this way: > module offset(r=0, delta=0, chamfer=false, keepsize = false) > { > if(keepsize) > $offset(r) $offset(-r) $offset(-r) $offset(r) children(); > else > $offset(r = r, chamfer = chamfer) children(); > } -- View this message in context: http://forum.openscad.org/how-to-make-round-chamfer-at-2D-object-tp19714p19799.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Wed, Dec 28, 2016 8:38 PM

Parkinbot wrote

If we had a qualified naming scheme or at least a synonym to refer to
built-in primitives for overriding, like $offset() it could be expressed
more transparently in this way:

+1,000,000


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/how-to-make-round-chamfer-at-2D-object-tp19714p19802.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Parkinbot wrote > If we had a qualified naming scheme or at least a synonym to refer to > built-in primitives for overriding, like $offset() it could be expressed > more transparently in this way: +1,000,000 ----- 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/how-to-make-round-chamfer-at-2D-object-tp19714p19802.html Sent from the OpenSCAD mailing list archive at Nabble.com.