1. The result of Boolean operation on the arguments of collection type, containers WIRE/SHELL/COMPSOLID, is now also a collection.
The result of Boolean operation on arguments of non-collection types is now a compound containing the splits of arguments directly, without its enclosure into containers.
Thus, if there were no containers, such as WIRE/SHELL/COMPSOLID, in the input arguments there will be no such containers in the result of BOP.
2. The containers of type WIRE included into result should now also (as the SHELLs) have coherent orientation of its sub-shapes.
For that the new method has been implemented (BOPTools_AlgoTools::OrientEdgesOnWire(TopoDS_Shape&)) which reorients edges of the given shape for correct ordering.
3. The duplicating containers, i.e. containers with the contents completely included in other containers, are now avoided in the result of BOP.
4. Documentation has been updated.
5. New test cases for the issue.
6. Adjusting test cases to current behavior.
* The result of the operation Cut is defined for arguments *S1* and *S2* that have values of dimensions *Dim(S2)* that should not be less than *Dim(S1)*. The dimension of the result is equal to *Dim(S1)*. The result of the operation *Cut12* is not defined for other cases. For example, it is impossible to cut an edge from a solid, because a solid without an edge is not defined.
* The result of the operation *Cut12* for arguments *S1* and *S2* contains the parts of argument *S1* that have state **OUT** relative to the opposite argument *S2*.
* The result of the operation *Cut21* for arguments *S1* and *S2* contains the parts of argument *S2* that have state **OUT** relative to the opposite argument *S1*.
+* For the arguments of collection type (WIRE, SHELL, COMPSOLID) the type will be passed in the result. For example, the result of Common operation between Shell and Wire will be a compound containing Wire.
+* For the arguments of collection type (WIRE, SHELL, COMPSOLID) containing overlapping parts the overlapping parts passed into result will be repeated for each container from the input shapes containing such parts. The containers completely included in other containers will be avoided in the result.
+* For the arguments of collection type (WIRE, SHELL, COMPSOLID) the containers included into result will have the same orientation as the original containers from arguments. In case of duplication its orientation will be defined by the orientation of the first container in arguments. Each container included into result will have coherent orientation of its sub-shapes.
+* The result of the operation Fuse for the arguments of collection type (WIRE, SHELL) will consist of the shapes of the same collection type. The overlapping parts (EDGES/FACES) will be shared among containers, but duplicating containers will be avoided in the result. For example, the result of Fuse operation between two fully coinciding wires will be one wire, but the result of Fuse operation between two partially coinciding wires will be two wires sharing coinciding edges.
+* The result of the operation Fuse for the arguments of type COMPSOLID will consist of the compound containing fused solids.
+* The result of the operation Common for the arguments of collection type (WIRE, SHELL, COMPSOLID) will consist of the unique containers containing the overlapping parts. For example, the result of Common operation between two fully overlapping wires will be one wire containing all splits of edges. The number of wires in the result of Common operation between two partially overlapping wires will be equal to the number of connexity blocks of overlapping edges.
@subsection occt_algorithms_9_4 Examples
explode r Sh
renamevar r_1 r
explode r e
-wire w r_4 r_1 r_7 r_8 r_9 r_10 r_11 r_12 r_13 r_14 r_22 r_23 r_24 r_25 r_19 r_20 r_21 r_26 r_35 r_31 r_32 r_33 r_34 r_36 r_37
+wire w r_4 r_1 r_20 r_21 r_22 r_23 r_24 r_25 r_26 r_7 r_30 r_31 r_32 r_33 r_27 r_28 r_29 r_11 r_38 r_34 r_35 r_36 r_37 r_16 r_17
tcopy w w1
tmirror w1 -6 0 0 0 1 0
wire w w w1
bfuse w w w3
bfuse w w w4
bfuse w w w5
+shape wsh Sh
+foreach f [explode w f] {add $f wsh}
+renamevar wsh w
unifysamedom r w
# keep only wires in compound
//
static
TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim);
+//
+static
+ void CollectContainers(const TopoDS_Shape& theS,
+ BOPCol_ListOfShape& theLSC);
+//
+static
+ void RemoveDuplicates(BOPCol_ListOfShape& theContainers);
+//
+static
+ void RemoveDuplicates(BOPCol_ListOfShape& theContainers,
+ const TopAbs_ShapeEnum theType);
+//
+static
+ Standard_Integer NbCommonItemsInMap(const BOPCol_MapOfShape& theM1,
+ const BOPCol_MapOfShape& theM2);
//=======================================================================
//=======================================================================
void BOPAlgo_BOP::BuildShape()
{
- Standard_Integer aDmin, aNbLCB;
- TopAbs_ShapeEnum aT1, aT2, aTR;
- TopoDS_Shape aR, aRC;
- TopoDS_Iterator aIt;
- BRep_Builder aBB;
- BOPCol_ListOfShape aLCB;
- BOPCol_ListIteratorOfListOfShape aItLCB;
- //
- myErrorStatus=0;
- //
BuildRC();
//
- aDmin=myDims[1];
- if (myDims[0]<myDims[1]) {
- aDmin=myDims[0];
- }
- //
- if (!aDmin) {
- myShape=myRC;
+ if ((myOperation == BOPAlgo_FUSE) && (myDims[0] == 3)) {
+ BuildSolid();
return;
}
//
- else if (aDmin==1 || aDmin==2) { //edges, faces
- aT1=TopAbs_VERTEX;
- aT2=TopAbs_EDGE;
- aTR=TopAbs_WIRE;
- if (aDmin==2) {
- aT1=TopAbs_EDGE;
- aT2=TopAbs_FACE;
- aTR=TopAbs_SHELL;
+ Standard_Integer i;
+ TopAbs_ShapeEnum aType, aT1, aT2;
+ BOPCol_ListOfShape aLSC, aLCB;
+ BOPCol_ListIteratorOfListOfShape aItLS, aItLSIm, aItLCB;
+ TopoDS_Iterator aIt;
+ BRep_Builder aBB;
+ TopoDS_Shape aRC, aRCB;
+ //
+ BOPCol_MapOfShape aMSRC;
+ BOPTools::MapShapes(myRC, aMSRC);
+ //
+ // collect images of containers
+ for (i = 0; i < 2; ++i) {
+ const BOPCol_ListOfShape& aLS = !i ? myArguments : myTools;
+ //
+ aItLS.Initialize(aLS);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aS = aItLS.Value();
+ //
+ CollectContainers(aS, aLSC);
}
+ }
+ // make containers
+ BOPCol_ListOfShape aLCRes;
+ aItLS.Initialize(aLSC);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aSC = aItLS.Value();
//
- BOPTools_AlgoTools::MakeConnexityBlocks
- (myRC, aT1, aT2, aLCB);
- aNbLCB=aLCB.Extent();
- if (!aNbLCB) {
- myShape=myRC;
- return;
+ BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);
+ //
+ aIt.Initialize(aSC);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aS = aIt.Value();
+ if (myImages.IsBound(aS)) {
+ const BOPCol_ListOfShape& aLSIm = myImages.Find(aS);
+ //
+ aItLSIm.Initialize(aLSIm);
+ for (; aItLSIm.More(); aItLSIm.Next()) {
+ const TopoDS_Shape& aSIm = aItLSIm.Value();
+ if (aMSRC.Contains(aSIm)) {
+ aBB.Add(aRC, aSIm);
+ }
+ }
+ }
+ else if (aMSRC.Contains(aS)) {
+ aBB.Add(aRC, aS);
+ }
}
//
- BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);
+ aType = aSC.ShapeType();
+ switch (aType) {
+ case TopAbs_WIRE: {
+ aT1 = TopAbs_VERTEX;
+ aT2 = TopAbs_EDGE;
+ break;
+ }
+ case TopAbs_SHELL: {
+ aT1 = TopAbs_EDGE;
+ aT2 = TopAbs_FACE;
+ break;
+ }
+ default: {
+ aT1 = TopAbs_FACE;
+ aT2 = TopAbs_SOLID;
+ }
+ }
+ //
+ aLCB.Clear();
+ BOPTools_AlgoTools::MakeConnexityBlocks(aRC, aT1, aT2, aLCB);
+ if (aLCB.IsEmpty()) {
+ continue;
+ }
//
aItLCB.Initialize(aLCB);
for (; aItLCB.More(); aItLCB.Next()) {
- BOPTools_AlgoTools::MakeContainer(aTR, aR);
+ BOPTools_AlgoTools::MakeContainer(aType, aRCB);
//
- const TopoDS_Shape& aCB=aItLCB.Value();
+ const TopoDS_Shape& aCB = aItLCB.Value();
aIt.Initialize(aCB);
for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aS=aIt.Value();
- aBB.Add(aR, aS);
- }
- //
- if (aTR==TopAbs_SHELL) {
- BOPTools_AlgoTools::OrientFacesOnShell(aR);
+ const TopoDS_Shape& aCBS = aIt.Value();
+ aBB.Add(aRCB, aCBS);
}
//
- aBB.Add(aRC, aR);
- }
- myShape=aRC;
- }// elase if (aDmin==1 || aDmin==2) {
-
- else {//aDmin=3
- Standard_Integer aNbObjs, aNbTools;
- //
- aNbObjs=myArguments.Extent();
- aNbTools=myTools.Extent();
- //
- if (aNbObjs==1 && aNbTools==1) {
- if (myOperation==BOPAlgo_FUSE) {
- BuildSolid();
+ if (aType == TopAbs_WIRE) {
+ // reorient wire
+ BOPTools_AlgoTools::OrientEdgesOnWire(aRCB);
}
- else {
- myShape=myRC;
+ else if (aType == TopAbs_SHELL) {
+ BOPTools_AlgoTools::OrientFacesOnShell(aRCB);
}
+ //
+ aRCB.Orientation(aSC.Orientation());
+ //
+ aLCRes.Append(aRCB);
}
- else {
- BuildSolid();
+ }
+ //
+ RemoveDuplicates(aLCRes);
+ //
+ // add containers to result
+ TopoDS_Compound aResult;
+ aBB.MakeCompound(aResult);
+ //
+ aItLS.Initialize(aLCRes);
+ for (; aItLS.More(); aItLS.Next()) {
+ aBB.Add(aResult, aItLS.Value());
+ }
+ //
+ // add the rest of the shapes into result
+ BOPCol_MapOfShape aMSResult;
+ BOPTools::MapShapes(aResult, aMSResult);
+ //
+ aIt.Initialize(myRC);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aS = aIt.Value();
+ if (aMSResult.Add(aS)) {
+ aBB.Add(aResult, aS);
}
}
+ //
+ myShape = aResult;
}
//=======================================================================
//function : BuildSolid
}
return aRet;
}
+//=======================================================================
+//function : CollectContainers
+//purpose :
+//=======================================================================
+void CollectContainers(const TopoDS_Shape& theS,
+ BOPCol_ListOfShape& theLSC)
+{
+ TopAbs_ShapeEnum aType = theS.ShapeType();
+ if (aType == TopAbs_WIRE ||
+ aType == TopAbs_SHELL ||
+ aType == TopAbs_COMPSOLID) {
+ theLSC.Append(theS);
+ return;
+ }
+ //
+ if (aType != TopAbs_COMPOUND) {
+ return;
+ }
+ //
+ TopoDS_Iterator aIt(theS);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aS = aIt.Value();
+ CollectContainers(aS, theLSC);
+ }
+}
+
+//=======================================================================
+//function : RemoveDuplicates
+//purpose : Filters the containers with identical contents
+//=======================================================================
+void RemoveDuplicates(BOPCol_ListOfShape& theContainers)
+{
+ RemoveDuplicates(theContainers, TopAbs_WIRE);
+ RemoveDuplicates(theContainers, TopAbs_SHELL);
+ RemoveDuplicates(theContainers, TopAbs_COMPSOLID);
+}
+
+//=======================================================================
+//function : RemoveDuplicates
+//purpose : Filters the containers of given type with identical contents
+//=======================================================================
+void RemoveDuplicates(BOPCol_ListOfShape& theContainers,
+ const TopAbs_ShapeEnum theType)
+{
+ // get containers of given type
+ BOPCol_ListOfShape aLC;
+ BOPCol_ListIteratorOfListOfShape aItLC(theContainers);
+ for (; aItLC.More(); aItLC.Next()) {
+ const TopoDS_Shape& aC = aItLC.Value();
+ if (aC.ShapeType() == theType) {
+ aLC.Append(aC);
+ }
+ }
+ //
+ if (aLC.IsEmpty()) {
+ return;
+ }
+ //
+ // map containers to compare its contents
+ NCollection_IndexedDataMap<TopoDS_Shape, BOPCol_MapOfShape> aContents;
+ //
+ aItLC.Initialize(aLC);
+ for (; aItLC.More(); aItLC.Next()) {
+ const TopoDS_Shape& aC = aItLC.Value();
+ //
+ BOPCol_MapOfShape& aMC = aContents(aContents.Add(aC, BOPCol_MapOfShape()));
+ //
+ TopoDS_Iterator aIt(aC);
+ for (; aIt.More(); aIt.Next()) {
+ aMC.Add(aIt.Value());
+ }
+ }
+ //
+ // compare the contents of the containers and find duplicates
+ BOPCol_MapOfShape aDuplicates;
+ //
+ Standard_Integer i, j, aNb = aContents.Extent();
+ for (i = 1; i <= aNb; ++i) {
+ const TopoDS_Shape& aCi = aContents.FindKey(i);
+ if (aDuplicates.Contains(aCi)) {
+ continue;
+ }
+ const BOPCol_MapOfShape& aMi = aContents(i);
+ Standard_Integer aNbi = aMi.Extent();
+ //
+ for (j = i + 1; j <= aNb; ++j) {
+ const TopoDS_Shape& aCj = aContents.FindKey(j);
+ if (aDuplicates.Contains(aCj)) {
+ continue;
+ }
+ const BOPCol_MapOfShape& aMj = aContents(j);
+ Standard_Integer aNbj = aMj.Extent();
+ //
+ Standard_Integer aNbCommon = NbCommonItemsInMap(aMi, aMj);
+ //
+ if (aNbj == aNbCommon) {
+ aDuplicates.Add(aCj);
+ continue;
+ }
+ //
+ if (aNbi == aNbCommon) {
+ aDuplicates.Add(aCi);
+ break;
+ }
+ }
+ }
+ //
+ if (aDuplicates.IsEmpty()) {
+ return;
+ }
+ //
+ // remove duplicating containers
+ aItLC.Initialize(theContainers);
+ for (; aItLC.More(); ) {
+ const TopoDS_Shape& aC = aItLC.Value();
+ if (aDuplicates.Contains(aC)) {
+ theContainers.Remove(aItLC);
+ continue;
+ }
+ aItLC.Next();
+ }
+}
+
+//=======================================================================
+//function : NbCommonItemsInMap
+//purpose : Counts the items contained in both maps
+//=======================================================================
+Standard_Integer NbCommonItemsInMap(const BOPCol_MapOfShape& theM1,
+ const BOPCol_MapOfShape& theM2)
+{
+ const BOPCol_MapOfShape* aMap1 = &theM1;
+ const BOPCol_MapOfShape* aMap2 = &theM2;
+ //
+ if (theM2.Extent() < theM1.Extent()) {
+ aMap1 = &theM2;
+ aMap2 = &theM1;
+ }
+ //
+ Standard_Integer iCommon = 0;
+ for (BOPCol_MapIteratorOfMapOfShape aIt(*aMap1); aIt.More(); aIt.Next()) {
+ if (aMap2->Contains(aIt.Value())) {
+ ++iCommon;
+ }
+ }
+ return iCommon;
+}
-- theLCB (as list of compounds)
-- in terms of connexity by the shapes of theType
+ OrientEdgesOnWire (myclass;
+ theW :out Shape from TopoDS);
+ ---Purpose:
+ -- Correctly orients edges on the wire.
+
OrientFacesOnShell (myclass;
- theS :out Shape from TopoDS);
+ theS :out Shape from TopoDS);
+ ---Purpose:
+ -- Correctly orients faces on the shell.
CorrectTolerances (myclass;
theS: Shape from TopoDS;
//
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
+#include <BOPCol_MapOfOrientedShape.hxx>
//
#include <IntTools_ShrunkRange.hxx>
#include <Precision.hxx>
//
+#include <TopoDS.hxx>
+//
static
Standard_Real AngleWithRef(const gp_Dir& theD1,
}// for (; aIt.More(); aIt.Next())
}
//=======================================================================
+// function: OrientEdgesOnWire
+// purpose: Reorient edges on wire for correct ordering
+//=======================================================================
+void BOPTools_AlgoTools::OrientEdgesOnWire(TopoDS_Shape& theWire)
+{
+ // make vertex-edges connexity map
+ BOPCol_IndexedDataMapOfShapeListOfShape aVEMap;
+ BOPTools::MapShapesAndAncestors(theWire, TopAbs_VERTEX, TopAbs_EDGE, aVEMap);
+ //
+ if (aVEMap.IsEmpty()) {
+ return;
+ }
+ //
+ BRep_Builder aBB;
+ // new wire
+ TopoDS_Wire aWire;
+ aBB.MakeWire(aWire);
+ // fence map
+ BOPCol_MapOfOrientedShape aMFence;
+ //
+ TopoDS_Iterator aIt(theWire);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Edge& aEC = TopoDS::Edge(aIt.Value());
+ if (!aMFence.Add(aEC)) {
+ continue;
+ }
+ //
+ // add edge to a wire as it is
+ aBB.Add(aWire, aEC);
+ //
+ TopoDS_Vertex aV1, aV2;
+ TopExp::Vertices(aEC, aV1, aV2, Standard_True);
+ //
+ if (aV1.IsSame(aV2)) {
+ // closed edge, go to the next edge
+ continue;
+ }
+ //
+ // orient the adjacent edges
+ for (Standard_Integer i = 0; i < 2; ++i) {
+ TopoDS_Shape aVC = !i ? aV1 : aV2;
+ //
+ for (;;) {
+ const BOPCol_ListOfShape& aLE = aVEMap.FindFromKey(aVC);
+ if (aLE.Extent() != 2) {
+ // free vertex or multi-connexity, go to the next edge
+ break;
+ }
+ //
+ Standard_Boolean bStop = Standard_True;
+ //
+ BOPCol_ListIteratorOfListOfShape aItLE(aLE);
+ for (; aItLE.More(); aItLE.Next()) {
+ const TopoDS_Edge& aEN = TopoDS::Edge(aItLE.Value());
+ if (aMFence.Contains(aEN)) {
+ continue;
+ }
+ //
+ TopoDS_Vertex aVN1, aVN2;
+ TopExp::Vertices(aEN, aVN1, aVN2, Standard_True);
+ if (aVN1.IsSame(aVN2)) {
+ // closed edge, go to the next edge
+ break;
+ }
+ //
+ // change orientation if necessary and go to the next edges
+ if ((!i && aVC.IsSame(aVN2)) || (i && aVC.IsSame(aVN1))) {
+ aBB.Add(aWire, aEN);
+ }
+ else {
+ aBB.Add(aWire, aEN.Reversed());
+ }
+ aMFence.Add(aEN);
+ aVC = aVC.IsSame(aVN1) ? aVN2 : aVN1;
+ bStop = Standard_False;
+ break;
+ }
+ //
+ if (bStop) {
+ break;
+ }
+ }
+ }
+ }
+ //
+ theWire = aWire;
+}
+//=======================================================================
// function: OrientFacesOnShell
// purpose:
//=======================================================================
restore [locate_data_file case_3_wire.brep] a
restore [locate_data_file offset_wire_034.brep] b
bfuse result a b
-set length 739.311
+set length 1085.29
set nbsh_v 14
set nbsh_e 14
restore [locate_data_file case_3_wire.brep] a
restore [locate_data_file case_3_wire2.brep] b
bfuse result a b
-set length 739.311
+set length 1085.29
set nbsh_v 20
set nbsh_e 20
restore [locate_data_file case_3_wire.brep] a
restore [locate_data_file case_3_wire5.brep] b
bfuse result a b
-set length 862.192
+set length 928.558
set nbsh_v 12
set nbsh_e 13
restore [locate_data_file case_9_wire.brep] a
restore [locate_data_file case_9_wire1.brep] b
bfuse result a b
-set length 1809.78
+set length 1953.57
set nbsh_v 8
set nbsh_e 9
restore [locate_data_file case_9_wire.brep] a
restore [locate_data_file case_9_wire2.brep] b
bfuse result a b
-set length 1982.81
+set length 2126.59
set nbsh_v 10
set nbsh_e 11
restore [locate_data_file case_9_wire.brep] a
restore [locate_data_file case_9_wire3.brep] b
bfuse result a b
-set length 2046.69
+set length 2126.59
set nbsh_v 10
set nbsh_e 11
restore [locate_data_file case_9_wire_a.brep] a
restore [locate_data_file case_9_wire1.brep] b
bfuse result a b
-set length 1377.51
+set length 1521.3
set nbsh_v 7
set nbsh_e 7
restore [locate_data_file offset_wire_034.brep] b
bop a b
bopfuse result
-set length 739.311
+set length 1085.29
set nbsh_v 14
set nbsh_e 14
restore [locate_data_file case_3_wire2.brep] b
bop a b
bopfuse result
-set length 739.311
+set length 1085.29
set nbsh_v 20
set nbsh_e 20
restore [locate_data_file case_3_wire5.brep] b
bop a b
bopfuse result
-set length 862.192
+set length 928.558
set nbsh_v 12
set nbsh_e 13
restore [locate_data_file case_9_wire1.brep] b
bop a b
bopfuse result
-set length 1809.78
+set length 1953.57
set nbsh_v 8
set nbsh_e 9
restore [locate_data_file case_9_wire2.brep] b
bop a b
bopfuse result
-set length 1982.81
+set length 2126.59
set nbsh_v 10
set nbsh_e 11
restore [locate_data_file case_9_wire3.brep] b
bop a b
bopfuse result
-set length 2046.69
+set length 2126.59
set nbsh_v 10
set nbsh_e 11
restore [locate_data_file case_9_wire1.brep] b
bop a b
bopfuse result
-set length 1377.51
+set length 1521.3
set nbsh_v 7
set nbsh_e 7
bopfuse result
-set square 850
+set square 1200
bopfuse result
-set square 800
+set square 1200
bopfuse result
-set square 468.629
+set square 800
bopfuse result
-set square 11868.2
+set square 13962.6
bopfuse result
-set square 87964.6
+set square 125664
+puts "TODO OCC26619 ALL: Error : The area of the resulting shape is"
+
source [locate_data_file 20000_et1_401-ta6027.prt.2.gdml.tcl]
## image is differ from application
-set square 3.52888e+07
+set square 1.50445e+007
set nb_e_good 12
set nb_w_good 2
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 29
+set nb_shape_good 28
set 2dviewer 0
set nb_e_good 12
set nb_w_good 2
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 29
+set nb_shape_good 28
set 2dviewer 0
set nb_v_good 3
set nb_e_good 4
-set nb_w_good 1
+set nb_w_good 0
set nb_f_good 0
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 9
+set nb_shape_good 8
set 2dviewer 0
set nb_v_good 5
set nb_e_good 4
-set nb_w_good 1
+set nb_w_good 0
set nb_f_good 0
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 11
+set nb_shape_good 10
set 2dviewer 0
set nb_v_good 3
set nb_e_good 2
-set nb_w_good 1
+set nb_w_good 0
set nb_f_good 0
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 7
+set nb_shape_good 6
set 2dviewer 0
set nb_e_good 12
set nb_w_good 4
set nb_f_good 2
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 31
+set nb_shape_good 30
set 3dviewer 1
set nb_e_good 62
set nb_w_good 30
set nb_f_good 29
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 157
+set nb_shape_good 156
set 3dviewer 1
set nb_v_good 2
set nb_e_good 1
-set nb_w_good 1
-set nb_shape_good 5
+set nb_w_good 0
+set nb_shape_good 4
+
set length 48.4459
set command bopfuse
set nb_v_good 2
set nb_e_good 1
-set nb_w_good 1
+set nb_w_good 0
set nb_f_good 0
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 5
+set nb_shape_good 4
set nb_e_good 16
set nb_w_good 1
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 36
+set nb_shape_good 35
set 2dviewer 0
set nb_e_good 15
set nb_w_good 4
set nb_f_good 4
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 34
+set nb_shape_good 33
set 2dviewer 0
# Analysis of "nbshapes result"
set nb_v_good 6
set nb_e_good 4
-set nb_w_good 2
+set nb_w_good 0
set nb_f_good 0
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 13
+set nb_shape_good 11
set 2dviewer 1
set nb_v_good 2
set nb_e_good 1
-set nb_w_good 1
+set nb_w_good 0
set nb_f_good 0
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 5
+set nb_shape_good 4
set 2dviewer 1
bop curve circle
bopcut result
-explode result
-if { [llength [explode result_1]] != 4 } {
- puts "Error: wrong number of intersections. Should be result_1_1 result_1_2 result_1_3 result_1_4"
+if { [llength [explode result]] != 4 } {
+ puts "Error: wrong number of intersections. Should be result_1 result_2 result_3 result_4"
} else {
puts "OK: right number of intersections"
}
-explode result_1_2
-set info1 [dump result_1_2_1]
+explode result_2
+set info1 [dump result_2_1]
regexp {Point 3D +: +([-0-9.+eE]+), +([-0-9.+eE]+), +([-0-9.+eE]+)} $info1 full x1 y1 z1
regexp {Tolerance +: +([-0-9.+eE]+)} $info1 full tol1
}
-set info2 [dump result_1_2_2]
+set info2 [dump result_2_2]
regexp {Point 3D +: +([-0-9.+eE]+), +([-0-9.+eE]+), +([-0-9.+eE]+)} $info2 full x2 y2 z2
regexp {Tolerance +: +([-0-9.+eE]+)} $info2 full tol2
bfillds
bbop result 2
-set square 103838
-
-set nb_v_good 106
-set nb_e_good 164
-set nb_w_good 142
-set nb_f_good 80
-set nb_sh_good 3
-set nb_sol_good 3
+set square 142845
+
+set nb_v_good 108
+set nb_e_good 168
+set nb_w_good 152
+set nb_f_good 86
+set nb_sh_good 7
+set nb_sol_good 7
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 499
+set nb_shape_good 529
set 2dviewer 1
set nb_e_good 8
set nb_w_good 2
set nb_f_good 2
-set nb_sh_good 2
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 21
+set nb_shape_good 19
set 2dviewer 1
set nb_e_good 4
set nb_w_good 1
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 12
+set nb_shape_good 11
set 2dviewer 1
set nb_v_good 2
set nb_e_good 1
-set nb_w_good 1
+set nb_w_good 0
set nb_f_good 0
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 5
+set nb_shape_good 4
set nb_e_good 4
set nb_w_good 1
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 11
+set nb_shape_good 10
set 2dviewer 1
set nb_e_good 6
set nb_w_good 3
set nb_f_good 3
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 18
+set nb_shape_good 17
set 2dviewer 1
set nb_e_good 3
set nb_w_good 1
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 10
+set nb_shape_good 9
set 2dviewer 1
set nb_e_good 12
set nb_w_good 4
set nb_f_good 4
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 30
+set nb_shape_good 29
set 3dviewer 1
set nb_e_good 4
set nb_w_good 1
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 12
+set nb_shape_good 11
set 3dviewer 1
bapibop result 0
set nb_v_good 1720
-set nb_e_good 3800
-set nb_w_good 1920
-set nb_f_good 1920
-set nb_sh_good 1
-set nb_sol_good 1
+set nb_e_good 4260
+set nb_w_good 3220
+set nb_f_good 3220
+set nb_sh_good 760
+set nb_sol_good 760
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 9363
+set nb_shape_good 13941
set 3dviewer 1
set nb_v_good 888
set nb_e_good 1412
-set nb_w_good 686
-set nb_f_good 686
-set nb_sh_good 82
-set nb_sol_good 82
+set nb_w_good 726
+set nb_f_good 726
+set nb_sh_good 121
+set nb_sol_good 121
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 3837
+set nb_shape_good 3995
set 3dviewer 1
bapibop result 3
set nb_v_good 2640
-set nb_e_good 5780
-set nb_w_good 2820
-set nb_f_good 2820
-set nb_sh_good 2
-set nb_sol_good 2
+set nb_e_good 5960
+set nb_w_good 3720
+set nb_f_good 3720
+set nb_sh_good 560
+set nb_sol_good 560
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 14065
+set nb_shape_good 17161
set 3dviewer 1
set nb_e_good 11
set nb_w_good 2
set nb_f_good 2
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 27
+set nb_shape_good 26
set 2dviewer 1
set nb_e_good 3
set nb_w_good 3
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 11
+set nb_shape_good 10
set 2dviewer 1
EDGE : 4
WIRE : 1
FACE : 1
- SHELL : 1
+ SHELL : 0
SOLID : 0
COMPSOLID : 0
COMPOUND : 1
- SHAPE : 12
+ SHAPE : 11
"
checknbshapes result -ref ${nbshapes_expected} -t -m "Result obtained by Cut a wire by halfspace"
EDGE : 9
WIRE : 1
FACE : 1
- SHELL : 1
+ SHELL : 0
SOLID : 0
COMPSOLID : 0
COMPOUND : 1
- SHAPE : 22
+ SHAPE : 21
"
checknbshapes result -ref ${nbshapes_expected} -t -m "result obtained by Common operator"
--- /dev/null
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+box b2 10 0 0 10 5 5
+box b3 10 5 0 10 5 5
+box b4 10 0 5 10 10 5
+
+bclearobjects
+bcleartools
+baddobjects b1 b2 b3 b4
+
+bfillds
+bbuild r
+
+explode r so
+
+shape b1 CS
+add r_1 b1
+add r_2 b1
+add r_3 b1
+add r_4 b1
+
+box b2 5 0 2 10 10 10
+bclearobjects
+bcleartools
+baddobjects b1
+baddtools b2
+
+bfillds
+bbop r 2
+
+explode r
+
+# should be compsolid
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_1]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
--- /dev/null
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+box b2 10 0 0 10 5 5
+box b3 10 5 0 10 5 5
+box b4 10 0 5 10 10 5
+
+bclearobjects
+bcleartools
+baddobjects b1 b2 b3 b4
+bfillds
+
+bbuild r
+
+explode r so
+shape b1 CS
+add r_1 b1
+add r_2 b1
+add r_3 b1
+add r_4 b1
+
+box b2 5 0 2 10 10 5
+box b3 5 0 7 10 10 5
+bclearobjects
+bcleartools
+baddobjects b2 b3
+
+bfillds
+bbuild r
+
+explode r so
+shape b2 CS
+add r_1 b2
+add r_2 b2
+
+box b3 -5 2 3 30 6 4
+
+bclearobjects
+bcleartools
+baddobjects b1 b2
+baddtools b3
+
+bfillds
+bbop r 2
+
+explode r
+
+# should be two compsolids
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_1]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_2]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
--- /dev/null
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+box b2 10 0 0 10 5 5
+box b3 10 5 0 10 5 5
+box b4 10 0 5 10 10 5
+
+bclearobjects
+bcleartools
+baddobjects b1 b2 b3 b4
+
+bfillds
+bbuild r
+
+explode r so
+shape b1 CS
+add r_1 b1
+add r_2 b1
+add r_3 b1
+add r_4 b1
+
+box b2 5 0 2 10 10 5
+box b3 5 0 7 10 10 5
+bclearobjects
+bcleartools
+baddobjects b2 b3
+
+bfillds
+bbuild r
+
+explode r so
+shape b2 CS
+add r_1 b2
+add r_2 b2
+
+box b3 5 -2 -2 10 14 20
+bclearobjects
+bcleartools
+baddobjects b1 b2
+baddtools b3
+
+bfillds
+bbop r 2
+
+explode r
+
+# should be two compsolids
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_1]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_2]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
--- /dev/null
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+box b2 10 0 0 10 5 5
+box b3 10 5 0 10 5 5
+box b4 10 0 5 10 10 5
+
+bclearobjects
+bcleartools
+baddobjects b1 b2 b3 b4
+
+bfillds
+bbuild r
+
+explode r so
+shape b1 CS
+add r_1 b1
+add r_2 b1
+add r_3 b1
+add r_4 b1
+
+box b2 5 0 2 10 10 10
+box b3 -5 2 3 30 6 4
+bclearobjects
+bcleartools
+baddobjects b1 b2
+baddtools b3
+
+bfillds
+bbop r 2
+
+explode r
+
+# should be compsolid and solid
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_1]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "SOLID"
+if { [regexp $ShapeType [whatis r_2]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
--- /dev/null
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b 10 10 10
+explode b f
+mkshe profile b_1 b_3
+
+polyline spine 0 0 0 10 10 0
+
+pipe sh spine profile
+
+whatis sh
+plane pl 10 10 0 -1 -1 0 1 0 0
+mkface f pl
+mksol sl f
+
+bcut res sh sl
+
+explode res
+
+# should be compsolid
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis res_1]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
EDGE : 7
WIRE : 3
FACE : 3
- SHELL : 1
+ SHELL : 0
SOLID : 0
COMPSOLID : 0
COMPOUND : 1
- SHAPE : 20
+ SHAPE : 19
"
checknbshapes result -ref ${nbshapes_expected} -t -m "result obtained by Common operator"
--- /dev/null
+puts "========"
+puts "OCC28189"
+puts "========"
+puts ""
+#################################################
+# Result of Boolean operation is non-manifold wire
+#################################################
+
+restore [locate_data_file bug28189_contour.brep] s
+restore [locate_data_file bug28189_solid.brep] c
+
+bcommon result s c
+
+checknbshapes result -vertex 3 -edge 2 -wire 1
+set length 173.267
+
+# check orientation of edges in the resulting wire
+
+explode result e
+explode result_1 v
+explode result_2 v
+
+set cmp1 [compare result_1_1 result_2_1]
+set cmp2 [compare result_1_1 result_2_2]
+
+if {[regexp "same shapes" $cmp1]} {
+ if {[regexp "equal shapes" $cmp1]} {
+ puts "Error: Incorrect orientation of edges in wire"
+ }
+} elseif {[regexp "same shapes" $cmp2]} {
+ if {[regexp "equal shapes" $cmp2]} {
+ puts "Error: Incorrect orientation of edges in wire"
+ }
+} else {
+ puts "Error: No shared vertex"
+}
--- /dev/null
+puts "========"
+puts "OCC28189"
+puts "========"
+puts ""
+#################################################
+# Result of Boolean operation is non-manifold wire
+#################################################
+
+box b1 10 10 10
+box b2 10 10 10
+eval compound [explode b1 w] b1
+eval compound [explode b1 w] b2
+bcommon result b1 b2
+
+checknbshapes result -wire 6
--- /dev/null
+puts "========"
+puts "OCC28189"
+puts "========"
+puts ""
+#################################################
+# Result of Boolean operation is non-manifold wire
+#################################################
+
+box b1 10 10 10
+box b2 10 10 10
+eval compound [explode b1 w] b1
+eval compound [explode b1 w] b2
+bfuse result b1 b2
+
+checknbshapes result -wire 6
--- /dev/null
+puts "========"
+puts "OCC28189"
+puts "========"
+puts ""
+#################################################
+# Result of Boolean operation is non-manifold wire
+#################################################
+
+box b1 10 10 10
+box b2 10 10 10
+eval compound [explode b1 w] b1
+eval compound [explode b1 w] b2
+ttranslate b2 5 0 0
+bcommon result b1 b2
+
+checknbshapes result -wire 4
--- /dev/null
+puts "========"
+puts "OCC28189"
+puts "========"
+puts ""
+#################################################
+# Result of Boolean operation is non-manifold wire
+#################################################
+
+box b1 10 10 10
+box b2 10 10 10
+eval compound [explode b1 w] b1
+eval compound [explode b1 w] b2
+ttranslate b2 5 0 0
+bfuse result b1 b2
+
+checknbshapes result -wire 12
--- /dev/null
+puts "========"
+puts "OCC28189"
+puts "========"
+puts ""
+#################################################
+# Result of Boolean operation is non-manifold wire
+#################################################
+
+polyline p1 0 0 0 1 0 0
+polyline p2 0 0 0 1 0 0
+
+orientation p1 R
+orientation p2 F
+
+bfuse result1 p1 p2
+explode result1
+
+if {![regexp "REVERSED" [whatis result1_1]]} {
+ puts "Error: Incorrect orientation of wire"
+}
+
+bcommon result2 p2 p1
+explode result2
+
+if {![regexp "FORWARD" [whatis result2_1]]} {
+ puts "Error: Incorrect orientation of wire"
+}
set nb_e_good 10
set nb_w_good 8
set nb_f_good 6
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 32
+set nb_shape_good 31
set 3dviewer 1
set nb_e_good 39
set nb_w_good 4
set nb_f_good 3
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 85
+set nb_shape_good 84
set 3dviewer 1
set nb_e_good 39
set nb_w_good 4
set nb_f_good 3
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 85
+set nb_shape_good 84
set 3dviewer 1