MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0029871Community[OCCT] OCCT:Modeling Algorithmspublic2018-06-14 19:282018-06-18 14:58
Reporterdanwoodman84 
Assigned Todanwoodman84 
PrioritynormalSeverityminor 
StatusfeedbackResolutionopen 
Platform64-bitOSWindowsOS Version10
Product Version[OCCT] 7.2.0 
Target VersionFixed in Version 
Summary0029871: BOPAlgo_CellsBuilder with a cluster of intersecting faces operand returns incorrect results
DescriptionThere seems to be a bug with BOPAlgo_CellsBuilder. When I perform a Boolean operation using this class involving a box solid and a cluster of 2 intersecting rectangular faces, I expect to see the original box sliced into 4 solids. However only two solids were created. The resulting shape is attached.
Steps To Reproduce// Create a solid
BRepPrimAPI_MakeBox makeBox(gp_Pnt(0,0,0), 10, 10, 10);
TopoDS_Solid box = makeBox.Solid();

// Create plane 1
BRepBuilderAPI_MakeEdge makeEdge1_12(gp_Pnt(-2, -2, 5), gp_Pnt(12, -2, 5));
BRepBuilderAPI_MakeEdge makeEdge1_23(gp_Pnt(12, -2, 5), gp_Pnt(12, 12, 5));
BRepBuilderAPI_MakeEdge makeEdge1_34(gp_Pnt(12, 12, 5), gp_Pnt(-2, 12, 5));
BRepBuilderAPI_MakeEdge makeEdge1_41(gp_Pnt(-2, 12, 5), gp_Pnt(-2, -2, 5));

TopTools_ListOfShape edges1;
edges1.Append(makeEdge1_12);
edges1.Append(makeEdge1_23);
edges1.Append(makeEdge1_34);
edges1.Append(makeEdge1_41);

BRepBuilderAPI_MakeWire makeWire1;
makeWire1.Add(edges1);
BRepBuilderAPI_MakeFace makeFace1(makeWire1.Wire());

// Create plane 2
BRepBuilderAPI_MakeEdge makeEdge2_12(gp_Pnt(-2, 5, -2), gp_Pnt(12, 5, -2));
BRepBuilderAPI_MakeEdge makeEdge2_23(gp_Pnt(12, 5, -2), gp_Pnt(12, 5, 12));
BRepBuilderAPI_MakeEdge makeEdge2_34(gp_Pnt(12, 5, 12), gp_Pnt(-2, 5, 12));
BRepBuilderAPI_MakeEdge makeEdge2_41(gp_Pnt(-2, 5, 12), gp_Pnt(-2, 5, -2));

TopTools_ListOfShape edges2;
edges2.Append(makeEdge2_12);
edges2.Append(makeEdge2_23);
edges2.Append(makeEdge2_34);
edges2.Append(makeEdge2_41);

BRepBuilderAPI_MakeWire makeWire2;
makeWire2.Add(edges2);
BRepBuilderAPI_MakeFace makeFace2(makeWire2.Wire());

// Make compound
TopoDS_Compound compound;
TopoDS_Builder builder;
builder.MakeCompound(compound);
builder.Add(compound, makeFace1);
builder.Add(compound, makeFace2);

// Boolean
BOPCol_ListOfShape occtCellsBuildersArguments;
occtCellsBuildersArguments.Append(box);
occtCellsBuildersArguments.Append(compound);
BOPAlgo_CellsBuilder cellsBuilder;
cellsBuilder.SetArguments(occtCellsBuildersArguments);
cellsBuilder.Perform();
cellsBuilder.AddAllToResult();

BRepTools::Write(cellsBuilder.Shape(), "SliceCluster.brep");
TagsNo tags attached.
Test case number
Attached Files? file icon SliceCluster.brep (8,612 bytes) 2018-06-14 19:28

- Relationships

-  Notes
(0076795)
emv (developer)
2018-06-15 07:49
edited on: 2018-06-15 07:49

This is not a bug, but an incorrect usage of the algorithm. You expect four solids in the result, and at the same time put the intersecting faces into a single compound (making self-interfering argument), telling the algorithm not to intersect the intersecting faces. For what reason you're making this compound of faces?

Using the algorithm correctly, i.e. passing each of the faces as a separate argument, you will get the expected result.

Here is the draw script:
box b 10 10 10

polyline p1 -2 -2 5 12 -2 5 12 -2 5 12 12 5 12 12 5 -2 12 5 -2 12 5 -2 -2 5 
mkplane f1 p1

polyline p2 -2 5 -2 12 5 -2 12 5 -2 12 5 12 12 5 12 -2 5 12 -2 5 12 -2 5 -2
mkplane f2 p2

compound f1 f2 faces
bopcheck faces
# E/E: x6 x16
# E/E: x10 x20
# F/F: x1 x11
# compound is self-interfered and must not be used as an argument for BOP

bclearobjects
bcleartools
baddobjects b
baddtools f1 f2
bfillds
bcbuild r

bcremoveall
bcadd result b 1 
nbshapes result
# SOLID: 4


Moreover, if you need only to split the solid by the faces you can use the splitter algorithm (BOPAlgo_Splitter):
bclearobjects
bcleartools
baddobjects b
baddtools f1 f2
bfillds
bsplit result
nbshapes result
# SOLID: 4


(0076805)
danwoodman84 (reporter)
2018-06-18 02:33
edited on: 2018-06-18 02:55

Many thanks emv for your reply.

I am using the Cells Builder since it is a powerful feature that provides a unified framework for various Boolean operations to the end-user of our application, i.e. s/he will perform the operation through a GUI. The user may give us unexpected inputs, so we thought if we were given a box and a compound of planes (which we understand to be a list of planes grouped into a single topological entity; please correct me if I am wrong), we would get the same result as if the planes were input individually. Indeed we can iterate through the immediate subshapes of the compound using TopoDS_Iterator, which give us four solids when passed to Cells Builder. However we are struggling to explain to the user why the compound of planes did not give us the intended result. It may be the case that I missed information on self-interfering arguments, so is it possible to know where I can get further information on this restriction?

(0076814)
emv (developer)
2018-06-18 14:58

It is actually easy to explain when to use compound of shapes and when to use the components of the compound as a separate arguments for the Boolean Operations algorithm. If the user is sure that two arguments of Boolean operation do not have intersections (the shapes do not touch or all touching places are shared among arguments), they can be placed into a single compound and given to the algorithm as a single argument. This way, the algorithm will not try to intersect these two shapes and the performance of the operation will be higher. But even if the interfering shapes are placed into compound and given as a single argument to BOP algorithm, the algorithm will rely on the user and still will not intersect these shapes. It may lead to unexpected results such as the one you've got.

- Issue History
Date Modified Username Field Change
2018-06-14 19:28 danwoodman84 New Issue
2018-06-14 19:28 danwoodman84 Assigned To => msv
2018-06-14 19:28 danwoodman84 File Added: SliceCluster.brep
2018-06-15 07:49 emv Note Added: 0076795
2018-06-15 07:49 emv Assigned To msv => danwoodman84
2018-06-15 07:49 emv Status new => feedback
2018-06-15 07:49 emv Note Edited: 0076795 View Revisions
2018-06-18 02:33 danwoodman84 Note Added: 0076805
2018-06-18 02:55 danwoodman84 Note Edited: 0076805 View Revisions
2018-06-18 14:58 emv Note Added: 0076814


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker