#### Usage of the GF algorithm on C++ level
-~~~~
+~~~~{.cpp}
BOPAlgo_Builder aBuilder;
// Setting arguments
TopTools_ListOfShape aLSObjects = …; // Objects
#### Usage of the GF algorithm on Tcl level
-~~~~
+~~~~{.cpp}
# prepare the arguments
box b1 10 10 10
box b2 3 4 5 10 10 10
@subsubsection specification__boolean_8_3_1 API
On the low level the Splitter algorithm is implemented in class *BOPAlgo_Splitter*. The usage of this algorithm looks as follows:
-~~~~~
+~~~~{.cpp}
BOPAlgo_Splitter aSplitter;
// Setting arguments and tools
TopTools_ListOfShape aLSObjects = …; // Objects
}
//
const TopoDS_Shape& aResult = aSplitter.Shape(); // result of the operation
-~~~~~
+~~~~
@subsubsection specification__boolean_8_3_2 DRAW
The command *bsplit* implements the Splitter algorithm in DRAW. Similarly to the *bbuild* command for the General Fuse algorithm, the *bsplit* command should be used after the Pave Filler is filled.
-~~~~~
+~~~~{.cpp}
# s1 s2 s3 - objects
# t1 t2 t3 - tools
bclearobjects
baddtools t1 t2 t3
bfillds
bsplit result
-~~~~~
+~~~~
@subsection specification__boolean_8_4 Examples
Splitting a face by the set of edges:
-~~~~
+~~~~{.cpp}
# draw script for reproducing
bclearobjects
bcleartools
Splitting a plate by the set of cylinders:
-~~~~
+~~~~{.cpp}
# draw script for reproducing:
bclearobjects
bcleartools
#### C++ Level
The usage of the algorithm on the API level:
-~~~~
+~~~~{.cpp}
BOPAlgo_MakerVolume aMV;
// Set the arguments
TopTools_ListOfShape aLS = …; // arguments
#### Tcl Level
To use the algorithm in Draw the command mkvolume has been implemented. The usage of this command is following:
-~~~~
+~~~~{.php}
Usage: mkvolume r b1 b2 ... [-c] [-ni] [-ai]
Options:
-c - use this option to have input compounds considered as set of separate arguments (allows passing multiple arguments as one compound);
#### DRAW usage
The following set of new commands has been implemented to run the algorithm in DRAW Test Harness:
-~~~~
+~~~~{.php}
bcbuild : Initialization of the Cells Builder. Use: *bcbuild r*
bcadd : Add parts to result. Use: *bcadd r s1 (0,1) s2 (0,1) ... [-m material [-u]]*
bcaddall : Add all parts to result. Use: *bcaddall r [-m material [-u]]*
~~~~
Here is the example of the algorithm use on the DRAW level:
-~~~~
+~~~~{.php}
psphere s1 15
psphere s2 15
psphere s3 15
@subsection specification__boolean_10c_Cells_2 Examples
The following simple example illustrates the possibilities of the algorithm working on a cylinder and a sphere intersected by a plane:
-~~~~
+~~~~{.php}
pcylinder c 10 30
psphere s 15
ttranslate s 0 0 30
@figure{/specification/boolean_operations/images/cells_algorithm_001.png,"Arguments",160}
-~~~~
+~~~~{.php}
bclearobjects
bcleartools
baddobjects c s f
#### 1. Common for all arguments
-~~~~
+~~~~{.php}
bcremoveall
bcadd res c 1 s 1 f 1
~~~~
#### 2. Common between cylinder and face
-~~~~
+~~~~{.php}
bcremoveall
bcadd res f 1 c 1
~~~~
#### 3. Common between cylinder and sphere
-~~~~
+~~~~{.php}
bcremoveall
bcadd res c 1 s 1
~~~~
#### 4. Fuse of cylinder and sphere
-~~~~
+~~~~{.php}
bcremoveall
bcadd res c 1 -m 1
bcadd res s 1 -m 1
#### 5. Parts of the face inside solids - FUSE(COMMON(f, c), COMMON(f, s))
-~~~~
+~~~~{.php}
bcremoveall
bcadd res f 1 s 1 -m 1
bcadd res f 1 c 1 -m 1
@figure{/specification/boolean_operations/images/cells_algorithm_006_1.png,"Parts of the face inside solids",160}
-~~~~
+~~~~{.php}
bcremoveint res
~~~~
#### 6. Part of the face outside solids
-~~~~
+~~~~{.php}
bcremoveall
bcadd res f 1 c 0 s 0
~~~~
#### 7. Fuse operation (impossible using standard Boolean Fuse operation)
-~~~~
+~~~~{.php}
bcremoveall
bcadd res c 1 -m 1
bcadd res s 1 -m 1
* 1 - for partial coincidence;
* 2 - for full coincidence
-~~~~
+~~~~{.php}
bglue 1
~~~~
* 0 - default value, the safe mode is switched off;
* 1 - the safe mode will be switched on.
-~~~~
+~~~~{.php}
bnondestructive 1
~~~~
* 0 - disabling the classification;
* 1 - default value, enabling the classification.
-~~~~
+~~~~{.php}
bcheckinverted 0
~~~~
To enable/disable the usage of OBB in the operation in DRAW it is necessary to call the *buseobb* command with the appropriate value:
* 0 - disabling the usage of OBB;
* 1 - enabling the usage of OBB.
-~~~~
+~~~~{.php}
buseobb 1
~~~~
These messages can be localized; for that put translated version to separate file and load it in the application by call to *Message_MsgFile::Load()* .
Here is the example of how to use this system:
-~~~~~
+~~~~{.php}
BOPAlgo_PaveFiller aPF;
aPF.SetArguments(...);
aPF.Perform();
}
...
}
-~~~~~
+~~~~
DRAW commands executing Boolean operations output errors and warnings generated by these operations in textual form.
Additional option allows saving shapes for which warnings have been generated, as DRAW variables.
To activate this option, run command *bdrawwarnshapes* with argument 1 (or with 0 to deactivate):
-~~~~
+~~~~{.php}
bdrawwarnshapes 1
~~~~
Example of the overlapping faces:
-~~~~
+~~~~{.php}
plane p 0 0 0 0 0 1
mkface f1 p -10 10 -10 10
mkface f2 p 0 20 -10 10
But in the CUT operation on the same edges, the tool edge will be Deleted from the result and, thus, will not have any Modified shapes.
Example of the intersecting edges:
-~~~~
+~~~~{.php}
line l1 0 0 0 1 0 0
mkedge e1 l1 -10 10
As for the operation with intersecting faces, consider the following example:
-~~~~
+~~~~{.php}
plane p1 0 0 0 0 0 1
mkface f1 p1 -10 10 -10 10
Here is the simple example of simplification of the result of Fuse operation of two boxes:
-~~~~
+~~~~{.php}
bsimplify -f 1
box b1 10 10 15
#### C++ Level
-~~~~
+~~~~{.cpp}
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BRepAlgoAPI_BuilderAlgo.hxx>
#### Tcl Level
-~~~~
+~~~~{.php}
# prepare the arguments
box b1 10 10 10
box b2 3 4 5 10 10 10
#### C++ Level
-~~~~
+~~~~{.cpp}
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BRepAlgoAPI_Splitter.hxx>
#### Tcl Level
-~~~~
+~~~~{.php}
# prepare the arguments
# objects
box b1 10 10 10
#### C++ Level
-~~~~
+~~~~{.cpp}
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include < BRepAlgoAPI_Common.hxx>
#### Tcl Level
-~~~~
+~~~~{.php}
# prepare the arguments
box b1 10 10 10
box b2 7 0 4 10 10 10
#### C++ Level
-~~~~
+~~~~{.cpp}
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include < BRepAlgoAPI_Fuse.hxx>
#### Tcl Level
-~~~~
+~~~~{.php}
# prepare the arguments
box b1 10 10 10
box b2 7 0 4 10 10 10
#### C++ Level
-~~~~
+~~~~{.cpp}
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include < BRepAlgoAPI_Cut.hxx>
#### Tcl Level
-~~~~
+~~~~{.php}
# prepare the arguments
box b1 10 10 10
box b2 7 0 4 10 10 10
#### C++ Level
-~~~~
+~~~~{.cpp}
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include < BRepAlgoAPI_Section.hxx>
#### Tcl Level
-~~~~
+~~~~{.php}
# prepare the arguments
box b1 10 10 10
box b2 3 4 5 10 10 10