discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

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

P
Parkinbot
Sat, Dec 24, 2016 12:08 PM

Next time please give a full code example.
If you do a negative and a positive offset() with the same parameter the
result will be identity.

I guess you want to have your slot object with rounded edges at the
"original" size. Using offset() this is only possible, if you construct the
square part smaller and the hole part larger by the chamfer value.

$fn = 30;

s = 40;
round_chamfer=1;
translate([0,-s/2,0]) slot();
translate([0,0,0])
offset(round_chamfer)
slot(offs=round_chamfer);

module slot(a = 12, b = 16, r = 4, offs = 0)
{
difference()
{
square([a-2offs, b-2offs] , center = true);
hull()
{
circle(r+offs, center = true);
translate([a, 0])
circle(r+offs, center = true);
}
}
}

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

Next time please give a full code example. If you do a negative and a positive offset() with the same parameter the result will be identity. I guess you want to have your slot object with rounded edges at the "original" size. Using offset() this is only possible, if you construct the square part smaller and the hole part larger by the chamfer value. $fn = 30; s = 40; round_chamfer=1; translate([0,-s/2,0]) slot(); translate([0,0,0]) offset(round_chamfer) slot(offs=round_chamfer); module slot(a = 12, b = 16, r = 4, offs = 0) { difference() { square([a-2*offs, b-2*offs] , center = true); hull() { circle(r+offs, center = true); translate([a, 0]) circle(r+offs, center = true); } } } -- View this message in context: http://forum.openscad.org/how-to-make-round-chamfer-at-2D-object-tp19714p19715.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Sat, Dec 24, 2016 12:15 PM

If you do a negative and a positive offset() with the same parameter the

result will be identity.

No it will round the convex or concave corners (depending on the order)
with a radius equal to the offset. I use it regularly.

On 24 December 2016 at 12:08, Parkinbot rudolf@parkinbot.com wrote:

Next time please give a full code example.
If you do a negative and a positive offset() with the same parameter the
result will be identity.

I guess you want to have your slot object with rounded edges at the
"original" size. Using offset() this is only possible, if you construct the
square part smaller and the hole part larger by the chamfer value.

$fn = 30;

s = 40;
round_chamfer=1;
translate([0,-s/2,0]) slot();
translate([0,0,0])
offset(round_chamfer)
slot(offs=round_chamfer);

module slot(a = 12, b = 16, r = 4, offs = 0)
{
difference()
{
square([a-2offs, b-2offs] , center = true);
hull()
{
circle(r+offs, center = true);
translate([a, 0])
circle(r+offs, center = true);
}
}
}

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


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

>If you do a negative and a positive offset() with the same parameter the result will be identity. No it will round the convex or concave corners (depending on the order) with a radius equal to the offset. I use it regularly. On 24 December 2016 at 12:08, Parkinbot <rudolf@parkinbot.com> wrote: > Next time please give a full code example. > If you do a negative and a positive offset() with the same parameter the > result will be identity. > > I guess you want to have your slot object with rounded edges at the > "original" size. Using offset() this is only possible, if you construct the > square part smaller and the hole part larger by the chamfer value. > > > > $fn = 30; > > s = 40; > round_chamfer=1; > translate([0,-s/2,0]) slot(); > translate([0,0,0]) > offset(round_chamfer) > slot(offs=round_chamfer); > > module slot(a = 12, b = 16, r = 4, offs = 0) > { > difference() > { > square([a-2*offs, b-2*offs] , center = true); > hull() > { > circle(r+offs, center = true); > translate([a, 0]) > circle(r+offs, center = true); > } > } > } > > > > > > -- > View this message in context: http://forum.openscad.org/how- > to-make-round-chamfer-at-2D-object-tp19714p19715.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
J
jon
Sat, Dec 24, 2016 12:18 PM

If either of you (nop head, Parkinbot) could provide a small example, I
would appreciate it.

On 12/24/2016 7:15 AM, nop head wrote:

If you do a negative and a positive offset() with the same parameter

the result will be identity.

No it will round the convex or concave corners (depending on the
order) with a radius equal to the offset. I use it regularly.

On 24 December 2016 at 12:08, Parkinbot <rudolf@parkinbot.com
mailto:rudolf@parkinbot.com> wrote:

 Next time please give a full code example.
 If you do a negative and a positive offset() with the same
 parameter the
 result will be identity.
If either of you (nop head, Parkinbot) could provide a small example, I would appreciate it. On 12/24/2016 7:15 AM, nop head wrote: > >If you do a negative and a positive offset() with the same parameter > the result will be identity. > > No it will round the convex or concave corners (depending on the > order) with a radius equal to the offset. I use it regularly. > > On 24 December 2016 at 12:08, Parkinbot <rudolf@parkinbot.com > <mailto:rudolf@parkinbot.com>> wrote: > > Next time please give a full code example. > If you do a negative and a positive offset() with the same > parameter the > result will be identity. >
CA
Carsten Arnholm
Sat, Dec 24, 2016 12:30 PM

On 24. des. 2016 13:08, Parkinbot wrote:

I guess you want to have your slot object with rounded edges at the
"original" size. Using offset() this is only possible, if you construct the
square part smaller and the hole part larger by the chamfer value.

Using your slot() you can do the following to get rounded corners of the
original object, with original size and given radius:

$fn = 30;
rad = 1;
offset(r=rad)
offset(delta=-rad)
slot();

Carsten Arnholm

On 24. des. 2016 13:08, Parkinbot wrote: > I guess you want to have your slot object with rounded edges at the > "original" size. Using offset() this is only possible, if you construct the > square part smaller and the hole part larger by the chamfer value. Using your slot() you can do the following to get rounded corners of the original object, with original size and given radius: $fn = 30; rad = 1; offset(r=rad) offset(delta=-rad) slot(); Carsten Arnholm
NH
nop head
Sat, Dec 24, 2016 12:31 PM

$fn = 32;

module shape()
difference() {
square(40, center = true);
square(20, center = true);
}

color("red") offset(3) offset(-3) shape();

translate([50, 0, 0])
color("blue") offset(-3) offset(3) shape();

On 24 December 2016 at 12:18, jon jon@jonbondy.com wrote:

If either of you (nop head, Parkinbot) could provide a small example, I
would appreciate it.

On 12/24/2016 7:15 AM, nop head wrote:

If you do a negative and a positive offset() with the same parameter the

result will be identity.

No it will round the convex or concave corners (depending on the order)
with a radius equal to the offset. I use it regularly.

On 24 December 2016 at 12:08, Parkinbot rudolf@parkinbot.com wrote:

Next time please give a full code example.
If you do a negative and a positive offset() with the same parameter the
result will be identity.

$fn = 32; module shape() difference() { square(40, center = true); square(20, center = true); } color("red") offset(3) offset(-3) shape(); translate([50, 0, 0]) color("blue") offset(-3) offset(3) shape(); ​ On 24 December 2016 at 12:18, jon <jon@jonbondy.com> wrote: > If either of you (nop head, Parkinbot) could provide a small example, I > would appreciate it. > > On 12/24/2016 7:15 AM, nop head wrote: > > >If you do a negative and a positive offset() with the same parameter the > result will be identity. > > No it will round the convex or concave corners (depending on the order) > with a radius equal to the offset. I use it regularly. > > On 24 December 2016 at 12:08, Parkinbot <rudolf@parkinbot.com> wrote: > >> Next time please give a full code example. >> If you do a negative and a positive offset() with the same parameter the >> result will be identity. >> > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
P
Parkinbot
Sat, Dec 24, 2016 11:19 PM

runsun, you are right. It is obviously not identity (only the initial
example). So what do you do, if you want to have inner and outer edges
rounded?

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

runsun, you are right. It is obviously not identity (only the initial example). So what do you do, if you want to have inner and outer edges rounded? -- View this message in context: http://forum.openscad.org/how-to-make-round-chamfer-at-2D-object-tp19714p19724.html Sent from the OpenSCAD mailing list archive at Nabble.com.
CA
Carsten Arnholm
Sun, Dec 25, 2016 12:22 AM

On 25. des. 2016 00:19, Parkinbot wrote:

So what do you do, if you want to have inner and outer edges
rounded?

You apply both techniques at once.

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

$fn = 30;
rad = 1.5;

// causes outer loop rounding
offset(r=rad)
offset(r=-rad)
// causes inner loop rounding
offset(r=-rad)
offset(r=rad)
rectangle_with_hole();

Carsten Arnholm

On 25. des. 2016 00:19, Parkinbot wrote: > So what do you do, if you want to have inner and outer edges > rounded? You apply both techniques at once. 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); } } $fn = 30; rad = 1.5; // causes outer loop rounding offset(r=rad) offset(r=-rad) // causes inner loop rounding offset(r=-rad) offset(r=rad) rectangle_with_hole(); Carsten Arnholm
P
Parkinbot
Sun, Dec 25, 2016 3:41 AM

Cool

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

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