simple way to chamfer

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

simple way to chamfer

khackbarth

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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: simple way to chamfer

Whosawhatsis
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, [hidden email] ([hidden email]) 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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: simple way to chamfer

adrianv
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/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: simple way to chamfer

Parkinbot
In reply to this post by khackbarth
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/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org