[OpenSCAD] Logic operation among objects

Richard Urwin soronlin+openscad at googlemail.com
Sun Oct 16 10:53:02 EDT 2016


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.




More information about the Discuss mailing list