discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] Logic operation among objects

RU
Richard Urwin
Sun, Oct 16, 2016 2:53 PM

ManuelSuarez wrote

Dear all, it is possible do: objectA && objectB?

the reason is that i have an object with holes but when i place them very
close the holes are filled by the second one. There is a way to preserve
the holes?

Thanks in advance

What you need to do is to union only those parts of the objects that do not
overlap. So you can first remove the overlap from each part.

union()
{
difference()
{
ObjectA;
ObjectBWithoutHoles;
}
difference()
{
ObjectB;
ObjectAWithoutHoles;
}
}

This is only a sketch. The rotates and transforms have to be duplicated in
the relevant locations. As written it would probably create a non-manifold
surface where the two touch; you should probably scale down or move the
subtracted objects so that the union ends up overlapping the the resulting
objects by a tiny amount. In creating "ObjectXWithoutHoles" you could
simplify it further; in some cases a bounding cube would be good enough.

--
View this message in context: http://forum.openscad.org/Logic-operation-among-objects-tp18725p18727.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

ManuelSuarez wrote > Dear all, it is possible do: objectA && objectB? > > the reason is that i have an object with holes but when i place them very > close the holes are filled by the second one. There is a way to preserve > the holes? > > Thanks in advance What you need to do is to union only those parts of the objects that do not overlap. So you can first remove the overlap from each part. union() { difference() { ObjectA; ObjectBWithoutHoles; } difference() { ObjectB; ObjectAWithoutHoles; } } This is only a sketch. The rotates and transforms have to be duplicated in the relevant locations. As written it would probably create a non-manifold surface where the two touch; you should probably scale down or move the subtracted objects so that the union ends up overlapping the the resulting objects by a tiny amount. In creating "ObjectXWithoutHoles" you could simplify it further; in some cases a bounding cube would be good enough. -- View this message in context: http://forum.openscad.org/Logic-operation-among-objects-tp18725p18727.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Sun, Oct 16, 2016 3:39 PM

Or alternatively:

difference(){
union() {
ObjectAWithoutHoles;
ObjectBWithoutHoles;
}
ObjectAHoles;
ObjectBHoles;
}

--
View this message in context: http://forum.openscad.org/Logic-operation-among-objects-tp18725p18731.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Or alternatively: > difference(){ > union() { > ObjectAWithoutHoles; > ObjectBWithoutHoles; > } > ObjectAHoles; > ObjectBHoles; > } -- View this message in context: http://forum.openscad.org/Logic-operation-among-objects-tp18725p18731.html Sent from the OpenSCAD mailing list archive at Nabble.com.