sanity check, difference() with a unioned object

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

sanity check, difference() with a unioned object

Kenneth Beesley
I need a quick sanity check.  Should it be OK to do

difference() {
        objectA();

        union() {
                objectB();
                objectC();
        }
}

or

difference() {
        objectA();
        objectD();
}

where objectD itself is built via union()?

Thanks,
Ken

*******************************
Kenneth R. Beesley, D.Phil.
PO Box 540475
North Salt Lake UT 84054
USA







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

Re: sanity check, difference() with a unioned object

shadowwynd
If b+c=d, then yes, they should be identical and should work just fine in openscad.

> On Dec 11, 2019, at 10:46 PM, Kenneth Beesley <[hidden email]> wrote:
>
> I need a quick sanity check.  Should it be OK to do
>
> difference() {
>    objectA();
>
>    union() {
>        objectB();
>        objectC();
>    }
> }
>
> or
>
> difference() {
>    objectA();
>    objectD();
> }
>
> where objectD itself is built via union()?
>
> Thanks,
> Ken
>
> *******************************
> Kenneth R. Beesley, D.Phil.
> PO Box 540475
> North Salt Lake UT 84054
> USA
>
>
>
>
>
>
>
> _______________________________________________
> 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: sanity check, difference() with a unioned object

JordanBrown
In reply to this post by Kenneth Beesley
On 12/11/2019 7:46 PM, Kenneth Beesley wrote:
I need a quick sanity check.  Should it be OK to do

difference() {
	objectA();

	union() {
		objectB();
		objectC();
	}
}

or

difference() {
	objectA();
	objectD();
}

where objectD itself is built via union()?

Of course.  You can difference (or intersect or union) any combination of objects.
Fine print:  must all be 3D or all be 2D, must be legal objects (manifold, et cetera).
Example:
difference() {
    cube(10, center=true);
    union () {
        translate([-1, 0, 5]) sphere(3);
        translate([2, 0, 5]) cube(4, center=true);
    }
}


  


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