discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

simple way to chamfer

K
ken@volksswitch.org
Tue, Mar 3, 2020 5:55 PM

I would like to chamfer the top, outer edge of a random union of contiguous
shapes like this:

$fn=100;

linear_extrude (height=10);

union(){

square([10,5],true);

translate([3,2])

square([5,10]);

translate([-2,-4])

circle(r=2);    

}

I'd tried using "hull()" but that only works for completely convex unions.
At this point I'm doing the equivalent of "milling" the edge using a
succession of thin shapes based on an "offset" of the union.  Since I'm 3D
printing the object, the stair-stepped edge is what I would have gotten
anyway.

Just wondering if there's a smarter way.

Please don't suggest Minkowski.  It's just too slow.

Thanks,

Ken

I would like to chamfer the top, outer edge of a random union of contiguous shapes like this: $fn=100; linear_extrude (height=10); union(){ square([10,5],true); translate([3,2]) square([5,10]); translate([-2,-4]) circle(r=2); } I'd tried using "hull()" but that only works for completely convex unions. At this point I'm doing the equivalent of "milling" the edge using a succession of thin shapes based on an "offset" of the union. Since I'm 3D printing the object, the stair-stepped edge is what I would have gotten anyway. Just wondering if there's a smarter way. Please don't suggest Minkowski. It's just too slow. Thanks, Ken
W
Whosawhatsis
Tue, Mar 3, 2020 7:08 PM

Won't work now, but I was thinking that it would be REALLY useful for this
type of situation if linear_extrude had an offset parameter that you would
use the same way you use the scale parameter, but the ends would be
affected like they are by the offset module rather than the scale module.
It would take a little extra work to handle situations where negative
offsets make things go to zero-width or negative width, but it seems like a
logical addition that would be useful for a lot of things (draft angles!)
and it should be much faster than minkowski.

On March 3, 2020 at 09:56:18, ken@volksswitch.org (ken@volksswitch.org)
wrote:

I would like to chamfer the top, outer edge of a random union of contiguous
shapes like this:

$fn=100;

linear_extrude (height=10);

union(){

square([10,5],true);

translate([3,2])

square([5,10]);

translate([-2,-4])

circle(r=2);

}

I’d tried using “hull()” but that only works for completely convex unions.
At this point I’m doing the equivalent of “milling” the edge using a
succession of thin shapes based on an “offset” of the union.  Since I’m 3D
printing the object, the stair-stepped edge is what I would have gotten
anyway.

Just wondering if there’s a smarter way.

Please don’t suggest Minkowski.  It’s just too slow.

Thanks,

Ken


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

Won't work now, but I was thinking that it would be REALLY useful for this type of situation if linear_extrude had an offset parameter that you would use the same way you use the scale parameter, but the ends would be affected like they are by the offset module rather than the scale module. It would take a little extra work to handle situations where negative offsets make things go to zero-width or negative width, but it seems like a logical addition that would be useful for a lot of things (draft angles!) and it should be much faster than minkowski. On March 3, 2020 at 09:56:18, ken@volksswitch.org (ken@volksswitch.org) wrote: I would like to chamfer the top, outer edge of a random union of contiguous shapes like this: $fn=100; linear_extrude (height=10); union(){ square([10,5],true); translate([3,2]) square([5,10]); translate([-2,-4]) circle(r=2); } I’d tried using “hull()” but that only works for completely convex unions. At this point I’m doing the equivalent of “milling” the edge using a succession of thin shapes based on an “offset” of the union. Since I’m 3D printing the object, the stair-stepped edge is what I would have gotten anyway. Just wondering if there’s a smarter way. Please don’t suggest Minkowski. It’s just too slow. Thanks, Ken _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
A
adrianv
Tue, Mar 3, 2020 10:39 PM

I wrote a module offset_sweep and also convex_offset_extrude that make
extrusions while varying the offset parameter.  The former one can handle
arbitrary geometry, but you have to supply it as a point list.  The latter
one works by hulling so you can only use it on convex shapes, but it acts on
its children, so it takes geometry rather than a point list.

These modules are both part of the BOSL2 library.

https://github.com/revarbat/BOSL2/wiki

Whosawhatsis wrote

Won't work now, but I was thinking that it would be REALLY useful for this
type of situation if linear_extrude had an offset parameter that you would
use the same way you use the scale parameter, but the ends would be
affected like they are by the offset module rather than the scale module.
It would take a little extra work to handle situations where negative
offsets make things go to zero-width or negative width, but it seems like
a
logical addition that would be useful for a lot of things (draft angles!)
and it should be much faster than minkowski.

On March 3, 2020 at 09:56:18,

ken@

(

ken@

)
wrote:

I would like to chamfer the top, outer edge of a random union of
contiguous
shapes like this:

$fn=100;

linear_extrude (height=10);

union(){

 square([10,5],true);

 translate([3,2])

 square([5,10]);

 translate([-2,-4])

 circle(r=2);

}

I’d tried using “hull()” but that only works for completely convex unions.
At this point I’m doing the equivalent of “milling” the edge using a
succession of thin shapes based on an “offset” of the union.  Since I’m 3D
printing the object, the stair-stepped edge is what I would have gotten
anyway.

Just wondering if there’s a smarter way.

Please don’t suggest Minkowski.  It’s just too slow.

Thanks,

Ken


OpenSCAD mailing list

Discuss@.openscad

Discuss@.openscad

I wrote a module offset_sweep and also convex_offset_extrude that make extrusions while varying the offset parameter. The former one can handle arbitrary geometry, but you have to supply it as a point list. The latter one works by hulling so you can only use it on convex shapes, but it acts on its children, so it takes geometry rather than a point list. These modules are both part of the BOSL2 library. https://github.com/revarbat/BOSL2/wiki Whosawhatsis wrote > Won't work now, but I was thinking that it would be REALLY useful for this > type of situation if linear_extrude had an offset parameter that you would > use the same way you use the scale parameter, but the ends would be > affected like they are by the offset module rather than the scale module. > It would take a little extra work to handle situations where negative > offsets make things go to zero-width or negative width, but it seems like > a > logical addition that would be useful for a lot of things (draft angles!) > and it should be much faster than minkowski. > > On March 3, 2020 at 09:56:18, > ken@ > ( > ken@ > ) > wrote: > > I would like to chamfer the top, outer edge of a random union of > contiguous > shapes like this: > > > > $fn=100; > > linear_extrude (height=10); > > union(){ > > square([10,5],true); > > translate([3,2]) > > square([5,10]); > > translate([-2,-4]) > > circle(r=2); > > } > > > > I’d tried using “hull()” but that only works for completely convex unions. > At this point I’m doing the equivalent of “milling” the edge using a > succession of thin shapes based on an “offset” of the union. Since I’m 3D > printing the object, the stair-stepped edge is what I would have gotten > anyway. > > > > Just wondering if there’s a smarter way. > > > > Please don’t suggest Minkowski. It’s just too slow. > > > > Thanks, > > Ken > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- Sent from: http://forum.openscad.org/
P
Parkinbot
Wed, Mar 4, 2020 1:54 PM

It shouldn't be too difficult at least for the kind of code you showed.

  1. rewrite your code to use centered primitives only
  2. define a chamfer operator cf()
  3. apply cf() to each primitive being unioned.

E.g.

$fn=100;

union(){

cf(1,.9)square([10,5],true);

translate([3,2]+[5,10]/2) cf(1,.9)square([5,10], true);

translate([-2,-4])    cf(1,.9) circle(r=2);   

}

module cf(height = 1, scale = 1)
linear_extrude(height, scale = scale, center = true) children();

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

It shouldn't be too difficult at least for the kind of code you showed. 1. rewrite your code to use centered primitives only 2. define a chamfer operator cf() 3. apply cf() to each primitive being unioned. E.g. $fn=100; union(){ cf(1,.9)square([10,5],true); translate([3,2]+[5,10]/2) cf(1,.9)square([5,10], true); translate([-2,-4]) cf(1,.9) circle(r=2); } module cf(height = 1, scale = 1) linear_extrude(height, scale = scale, center = true) children(); -- Sent from: http://forum.openscad.org/
T
TLC123
Wed, Nov 18, 2020 5:37 PM

check out the latest pull request on this upcoming feature
Implement offset_extrude
https://github.com/openscad/openscad/pull/2079

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

check out the latest pull request on this upcoming feature Implement offset_extrude https://github.com/openscad/openscad/pull/2079 -- Sent from: http://forum.openscad.org/