From 1f84ed1e6ecaf6bb0784aafc4fd24f0d395a6eb5 Mon Sep 17 00:00:00 2001 From: David Osterberg Date: Mon, 3 Jan 2022 23:51:25 +0100 Subject: [PATCH] PD: Fix bug in FeatureTransformed It is important to not include the original in the pattern because the original might not be at the tip of the feature tree. Including the original will interfere with changes that occur further down in the feature tree This fixes the bug identified in https://forum.freecadweb.org/viewtopic.php?f=3&t=64900 --- src/Mod/PartDesign/App/FeatureTransformed.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Mod/PartDesign/App/FeatureTransformed.cpp b/src/Mod/PartDesign/App/FeatureTransformed.cpp index bcde049a73..7de5640a13 100644 --- a/src/Mod/PartDesign/App/FeatureTransformed.cpp +++ b/src/Mod/PartDesign/App/FeatureTransformed.cpp @@ -20,7 +20,6 @@ * * ******************************************************************************/ - #include "PreCompiled.h" #ifndef _PreComp_ # include @@ -267,7 +266,10 @@ App::DocumentObjectExecReturn *Transformed::execute(void) bool overlapping = false; std::vector::const_iterator t = transformations.begin(); - bool first = true; + + // First transformation is skipped since it should not be part of the toolShape. + t++; + for (; t != transformations.end(); ++t) { // Make an explicit copy of the shape because the "true" parameter to BRepBuilderAPI_Transform // seems to be pretty broken @@ -283,15 +285,14 @@ App::DocumentObjectExecReturn *Transformed::execute(void) shapes.emplace_back(shape); builder.Add(compShape, shape); - if (overlapDetectionMode && !first) + if (overlapDetectionMode) overlapping = overlapping || (countSolids(TopoShape(origShape).fuse(shape))==1); - if (first) - first = false; } TopoDS_Shape toolShape; + #ifndef FC_DEBUG if (overlapping || overlapMode == "Overlap mode") Base::Console().Message("Transformed: Overlapping feature mode (fusing tool shapes)\n"); @@ -300,7 +301,7 @@ App::DocumentObjectExecReturn *Transformed::execute(void) #endif if (overlapping || overlapMode == "Overlap mode") - toolShape = TopoShape(origShape).fuse(shapes, Precision::Confusion()); + toolShape = TopoShape(shape).fuse(shapes, Precision::Confusion()); else toolShape = compShape;