Part: Boolean Fragments

From FreeCAD Documentation
Revision as of 18:51, 25 October 2018 by Luc (talk | contribs)

Part BooleanFragments

Menu location
Part → Split → Boolean Fragments
Workbenches
Part
Default shortcut
None
Introduced in version
-
See also
Part Slice, Part XOR, Join features, Part Booleans

Descriere

Tool to compute all fragments that can result from applying Boolean operations between input shapes. For example, for two intersecting spheres, three non-overlapping but touching solids are generated.

(pe imaginea de mai sus, piesele au fost mutate separat manual după aceea, pentru a dezvălui felierea)

Forma de ieșire este întotdeauna un compus. Conținutul compusului depinde de tipurile de intrare și de modul de operare. Asta înseamnă că nu primești imediat accesul la piesele individuale ale rezultatului - piesele rămân grupate împreună. Piesele individuale pot fi extrase prin explodarea compusului (Draft Downgrade).

Instrumentul are trei moduri: "Standard", "Split" și "CompSolid".

"Standard" și "Split" diferă de acțiunea instrumentului pe fire/polilinii, shells și compsolids: dacă este "Split", acestea sunt separate; dacă este "Standard", acestea sunt păstrate împreună (obțineți segmente suplimentare).

Structura de comprimare în modurile "Standard" și "Split" urmează structura de compunere a intrărilor. Adică, dacă se alimentează cu doi compuși, fiecare conținând o sferă ca în exemplul de mai sus, rezultatul va conține de asemenea doi compuși, fiecare conținând bucățile sferei conținute inițial. Aceasta înseamnă că piesa comună va fi repetată de două ori în rezultat. Numai în cazul în care shperes de intrare ambele nu sunt în compuși, rezultatul va conține piesa comună o singură dată.

În modul "CompSolid", solidele sunt unite într-un compsolid (compsolid este un set de solide conectate prin fețe, ele sunt legate de solide, cum ar fi firele sunt legate de margini, și shell-urile sunt legate de fețe, numele fiind probabil o scurtă expresie "solid compozit"). Rezultatul este un compus non-imbricat de compsolids

How to use

  1. Select objects to be intersected.
    The order of selection is not important, since the action of the tool is symmetric. It is enough to select one sub-shape of each object (e.g., faces). You can also select a compound containing all the shapes to be connected, e.g. Draft Array.
  2. Invoke the Part BooleanFragments command.

A Boolean Fragments parametric object is created. Original objects are hidden, and the result of intersection is shown in 3D view.

Proprietăți

Boolean Fragments

  • DateObjects: List of objects to be intersected. Generally, at least two objects are needed, but a single compound containing the shapes to intersect will do as well. (as of FreeCAD v0.17.8053, this property is not displayed in property editor, and can only be accessed via Python).
  • DateMode: "Standard", "Split", or "CompSolid". "Standard" is default. Standard and Split differ by the action of the tool on aggregation type shapes: if Split, those are separated; otherwise they are kept together (get extra segments).
  • DateTolerance: "fuzziness" value. This is an extra tolerance to apply when searching for intersections, in addition to tolerances stored in the input shapes.

Implementarea detaliilor

Boolean Fragments tool in "Standard mode" is OpenCascade's General Fuse Operator (GFA). It accepts a combination of probably all shape types, and the logic of output is quite convoluted. See OpenCascade user guide: Boolean operations.

For "Split" and "CompSolid" modes, extra post-processing is done by FreeCAD.

Script

The tool can by used in macros and from the python console by using the following function:

BOPTools.SplitFeatures.makeBooleanFragments(name)
  • Creates an empty BooleanFragments feature. The 'Objects' property must be assigned explicitly, afterwards.
  • Returns the newly created object.

BooleanFragments can also be applied to plain shapes, without the need to have a document object, via:

import BOPTools.SplitAPI
BOPTools.SplitAPI.booleanFragments(list_of_shapes, mode, tolerance = 0.0)

# OR, for Standard mode:

list_of_shapes = [App.ActiveDocument.Sphere.Shape, App.ActiveDocument.Sphere001.Shape]
pieces, map = list_of_shapes[0].generalFuse(list_of_shapes[1:], tolerance)
# pieces receives a compound of shapes; map receives a list of lists of shapes, defining list_of_shapes <--> pieces correspondence

This can be useful for making custom Python scripted features.


Exempluː

import BOPTools.SplitFeatures
j = BOPTools.SplitFeatures.makeBooleanFragments(name= 'BooleanFragments')
j.Objects = FreeCADGui.Selection.getSelection()

The tool itself is implemented in Python, see /Mod/Part/BOPTools/SplitFeatures.py under where FreeCAD is installed.

Versiune

Acest instrument a fost introdus în FreeCAD v0.17.8053. FreeCAD și necesită compilarea cu OCC 6.9.0 sau mai recent; altfel instrumentul este inutilizabil.