Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PD: issue #6641: polar pattern fails
- Loading branch information
Showing
1 changed file
with
16 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,7 +170,6 @@ short Transformed::mustExecute() const | |
App::DocumentObjectExecReturn *Transformed::execute(void) | ||
{ | ||
std::string overlapMode = Overlap.getValueAsString(); | ||
bool overlapDetectionMode = overlapMode == "Detect"; | ||
|
||
std::vector<App::DocumentObject*> originals = Originals.getValues(); | ||
if (originals.empty()) // typically InsideMultiTransform | ||
|
@@ -226,7 +225,6 @@ App::DocumentObjectExecReturn *Transformed::execute(void) | |
for (std::vector<App::DocumentObject*>::const_iterator o = originals.begin(); o != originals.end(); ++o) | ||
{ | ||
// Extract the original shape and determine whether to cut or to fuse | ||
TopoDS_Shape shape; | ||
Part::TopoShape fuseShape; | ||
Part::TopoShape cutShape; | ||
|
||
|
@@ -248,62 +246,57 @@ App::DocumentObjectExecReturn *Transformed::execute(void) | |
|
||
TopoDS_Shape current = support; | ||
|
||
BRep_Builder builder; | ||
TopoDS_Compound compShape; | ||
builder.MakeCompound(compShape); | ||
std::vector<TopoDS_Shape> shapes; | ||
bool overlapping = false; | ||
|
||
std::vector<gp_Trsf>::const_iterator transformIter = transformations.begin(); | ||
|
||
// First transformation is skipped since it should not be part of the toolShape. | ||
transformIter++; | ||
++transformIter; | ||
|
||
for (; transformIter != transformations.end(); ++transformIter) { | ||
// Make an explicit copy of the shape because the "true" parameter to BRepBuilderAPI_Transform | ||
// seems to be pretty broken | ||
BRepBuilderAPI_Copy copy(origShape); | ||
|
||
shape = copy.Shape(); | ||
TopoDS_Shape shape = copy.Shape(); | ||
|
||
BRepBuilderAPI_Transform mkTrf(shape, *transformIter, false); // No need to copy, now | ||
if (!mkTrf.IsDone()) | ||
return new App::DocumentObjectExecReturn("Transformation failed", (*o)); | ||
shape = mkTrf.Shape(); | ||
|
||
shapes.emplace_back(shape); | ||
builder.Add(compShape, shape); | ||
|
||
if (overlapDetectionMode) | ||
overlapping = overlapping || (countSolids(TopoShape(origShape).fuse(shape))==1); | ||
|
||
} | ||
|
||
TopoDS_Shape toolShape; | ||
|
||
|
||
#ifdef FC_DEBUG | ||
if (overlapping || overlapMode == "Overlap mode") | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
wwmayer
Author
Contributor
|
||
if (overlapMode == "Overlap mode") | ||
Base::Console().Message("Transformed: Overlapping feature mode (fusing tool shapes)\n"); | ||
else | ||
Base::Console().Message("Transformed: Non-Overlapping feature mode (compound of tool shapes)\n"); | ||
#endif | ||
|
||
if (overlapping || overlapMode == "Overlap mode") | ||
toolShape = TopoShape(shape).fuse(shapes, Precision::Confusion()); | ||
else | ||
toolShape = compShape; | ||
TopTools_ListOfShape shapeArguments; | ||
shapeArguments.Append(current); | ||
TopTools_ListOfShape shapeTools; | ||
for (auto shape : shapes) | ||
shapeTools.Append(shape); | ||
|
||
if (!fuseShape.isNull()) { | ||
std::unique_ptr<BRepAlgoAPI_BooleanOperation> mkBool(new BRepAlgoAPI_Fuse(current, toolShape)); | ||
std::unique_ptr<BRepAlgoAPI_BooleanOperation> mkBool(new BRepAlgoAPI_Fuse()); | ||
mkBool->SetArguments(shapeArguments); | ||
mkBool->SetTools(shapeTools); | ||
mkBool->Build(); | ||
if (!mkBool->IsDone()) { | ||
std::stringstream error; | ||
error << "Boolean operation failed"; | ||
return new App::DocumentObjectExecReturn(error.str()); | ||
} | ||
current = mkBool->Shape(); | ||
} else { | ||
std::unique_ptr<BRepAlgoAPI_BooleanOperation> mkBool(new BRepAlgoAPI_Cut(current, toolShape)); | ||
std::unique_ptr<BRepAlgoAPI_BooleanOperation> mkBool(new BRepAlgoAPI_Cut()); | ||
mkBool->SetArguments(shapeArguments); | ||
mkBool->SetTools(shapeTools); | ||
mkBool->Build(); | ||
if (!mkBool->IsDone()) { | ||
std::stringstream error; | ||
error << "Boolean operation failed"; | ||
|
I expect overlap mode itself becomes irrelevant now.