-
Notifications
You must be signed in to change notification settings - Fork 9
Boolean operations on arrays, Compound structure
- Arrays of shapes are compounds.
- Nested arrays produce nested compounds.
- A compound with touching or intersecting shapes cannot be used for Part Boolean operations (BOP) (except when you use a compound as the single input for some BOPs, in this case inner (nested) compounds must have no intersections within).
- Compound nesting can be removed with Downgrade To Leaves tool.
- Use Lattice's Shape Info Tool to quickly examine compound structure.
Compound is a type of OpenCascade Shape. Compound is just a group of any other shapes.
When you create an array in FreeCAD (be it a Draft workbench array or Lattice2 array, except PartDesign), what you usually get is a Compound. For example, if you make a Draft Polar Array of boxes, the type of shape of the array is a compound of solids.
Compounds can be nested. For example, if you make a Draft Polar Array of another Draft Array, you'll get a Compound of Compounds. Same happens in Lattice2: if you populate an array of shapes onto an array of placements, you get a super-array with nested compound structure. This is not obvious in FreeCAD, so Lattice2 provides Shape Info Tool to reveal the structure.
When doing Part Boolean operations between compounds, FreeCAD assumes that shapes within those compounds do not intersect or touch each other (or if they do touch, the touching geometry is shared, which actually never happens by itself when arraying objects). This is done to save on computations. If they do actually intersect, the operation will likely either fail completely, or produce an invalid result.
The easiest way to test if there are invalid intersections within a (compound or not) shape is to use Part CheckGeometry with BOPCheck enabled.
Some of Part Booleans accept a single compound as an input, then this assumption is of course dropped. However, if it's a compound of compounds, it is still assumed that shapes inside of each inner compound do not touch or intersect. This will cause problems when trying to fuse arrays made in several steps.
For example, consider this 2d array of spheres, made by first making a 1d array of a sphere and then another 1d array of the array. Attempting to fuse it together produces an invalid shape:
If you look closely at the result, you should notice that FreeCAD missed all intersections within rows of spheres, but did properly compute the intersections between the rows. This is because it assumed there are no intersections within the nested compounds.
There are several ways of dealing with this problem.
That is, populate one array first, then apply Part Union, then populate the other array, then Union again.
That is, populate as you see fit. But before fusing it all together, apply Lattice2 Downgrade to Leaves. This will remove compound nesting, and make FreeCAD consider all intersections.
That is, instead of populating LinearArray001 with shapes, populate it with LinearArray. This will create a 2d array of placements, which can be populated in one go and produce a non-nested compound. (Lattice2 does not have nesting in arrays of placements, they are always flat.)
Introduction to Lattice workbench
Boolean operations on arrays, Compound structure
Shape-driven arrays, Draft arrays in Lattice2
"Subsequencing" (sublink iteration, TopoSeries)
- (common pieces)
-- Common properties of placement features
-- Common properties of array generators
- (features)
-- Single Placement
-- Attached Placement
-- Array an attached Placement
-- Linear Array
-- Polar Array
-- Array From Shape
-- Invert placements
-- Join Arrays
-- Array Filter
-- Project Array
-- Resample Array
-- Populate With Copies
-- Populate With Children
-- Mirror
-- PartDesign Pattern
-- Downgrade
-- SubLink
-- Subsequence
-- Make Compound
-- Compound Filter
-- Fuse Compound
-- Bounding Box
-- Shape String
-- ParaSeries
-- TopoSeries
-- Shape info feature
- (tools)
-- Explode Array
-- Explode Compound
-- Inspect tool
-- Substitute Object
-- Expose links to subelements
-- Recompute controlling tools