Part Fragments booléens

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

Fragments Booléens Part

Emplacement du menu
Part → Découper → Fragments Booléens
Ateliers
Part
Raccourci par défaut
Aucun
Introduit dans la version
-
Voir aussi
TranchagePart, Part XOR, Join features, Part Booleans

Description

Outil permettant de calculer tous les fragments pouvant résulter de l'application d'opérations booléennes entre des formes d'entrée. Par exemple, pour deux sphères entrecroisées, trois solides non chevauchants mais touchants sont générés.

(sur l'image ci-dessus, les pièces ont été déplacées manuellement après, pour révéler le tranchage)

The output shape is always a compound. The content of the compound depends on input shape types and operation mode. That means, you don't immediately get access to individual pieces of the result - the pieces remain grouped together. The individual pieces can be extracted by exploding the compound (Draft Downgrade).

L'outil comporte trois modes: "Standard", "Split" et "CompSolid".

"Standard" et "Split" diffèrent par l'action de l'outil sur les fils, les shells et les compsolids: Pour "Split", ceux-ci sont séparés; Pour «Standard», ils sont conservés ensemble (on obtient des segments supplémentaires).

Compounding structure in "Standard" and "Split" modes follows the compounding structure of inputs. That is, if you feed in two compounds, each containing a sphere like on example above, the result will also contain two compounds, each containing the pieces of the originally contained sphere. That means, the common piece will be repeated twice in the result. Only if the input shperes are both not in compounds, the result will contain the common piece once.

In "CompSolid" mode, the solids are joined into a compsolid (compsolid is a set of solids connected by faces; they are related to solids like wires are related to edges, and shells are related to faces; the name is probably a shortened phrase "composite solid"). The output is a non-nested compound of compsolids

Comment l'utiliser

  1. Sélectionner les objets à connecter.
    L'ordre de sélection n'a pas d'importance, l'action est symétrique. Il suffit de sélectionner un élément de chaque objet (par ex. leurs faces). Il est aussi possible de sélectionner un composé contenant toutes les formes à connecter, par ex. un Réseau Draft.
  2. Lancer la commande Part BooleanFragments.

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

Properties

Boolean Fragments

  • DonnéesObjects: 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).
  • DonnéesMode: "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).
  • DonnéesTolerance: "fuzziness" value. This is an extra tolerance to apply when searching for intersections, in addition to tolerances stored in the input shapes.

Implementation details

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.

Programmation

L'outil peut être utilisé dans une macros et à partir de la console python en utilisant la fonction suivante:

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.


Example:

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

L'outil lui-même est implémenté en Python, voir /Mod/Part/BOPTools/SplitFeatures.py la où FreeCAD est installé.

Version

L'outil a été introduit dans FreeCAD v0.17.8053. FreeCAD doit être compilé avec OCC 6.9.0 ou version ultérieure; Sinon, l'outil n'est pas disponible.