discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

sanity check, difference() with a unioned object

KB
Kenneth Beesley
Thu, Dec 12, 2019 3:46 AM

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

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
ER
Ezra Reynolds
Thu, Dec 12, 2019 3:52 AM

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 krbeesley@gmail.com 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
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

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 <krbeesley@gmail.com> 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 > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
JB
Jordan Brown
Thu, Dec 12, 2019 5:27 PM

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);
    }
}
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); } }