diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.cpp b/src/Mod/PartDesign/App/FeatureSketchBased.cpp index ec46989d6f..6296806e5d 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.cpp +++ b/src/Mod/PartDesign/App/FeatureSketchBased.cpp @@ -527,17 +527,19 @@ const bool SketchBased::checkWireInsideFace(const TopoDS_Wire& wire, const TopoD void SketchBased::remapSupportShape(const TopoDS_Shape& newShape) { + TopTools_IndexedMapOfShape faceMap; + TopExp::MapShapes(newShape, TopAbs_FACE, faceMap); + + // here we must reset the placement otherwise the geometric matching doesn't work + Part::TopoShape shape = this->Shape.getValue(); + shape._Shape.Location(TopLoc_Location()); + std::vector refs = this->getInList(); for (std::vector::iterator it = refs.begin(); it != refs.end(); ++it) { if ((*it)->isDerivedFrom(Part::Part2DObject::getClassTypeId())) { Part::Part2DObject* part = static_cast(*it); - Part::TopoShape shape = this->Shape.getValue(); - // here we must reset the placement otherwise the geometric matching doesn't work - shape._Shape.Location(TopLoc_Location()); std::vector subValues = part->Support.getSubValues(); std::vector newSubValues; - TopTools_IndexedMapOfShape faceMap; - TopExp::MapShapes(newShape, TopAbs_FACE, faceMap); for (std::vector::iterator it = subValues.begin(); it != subValues.end(); ++it) { std::string shapetype; @@ -551,19 +553,32 @@ void SketchBased::remapSupportShape(const TopoDS_Shape& newShape) shapetype = "Vertex"; } else { + newSubValues.push_back(*it); continue; } - TopoDS_Shape element = shape.getSubShape(it->c_str()); bool success = false; - // first try an exact matching - for (int i=1; ic_str()); + try { + // as very first test check if old face and new face are parallel planes + TopoDS_Shape newElement = Part::TopoShape(newShape).getSubShape(it->c_str()); + if (isParallelPlane(element, newElement)) { + newSubValues.push_back(*it); success = true; - break; + } + } + catch (Standard_Failure) { + } + // try an exact matching + if (!success) { + for (int i=1; i&) const; TopoDS_Shape makeFace(std::list&) const; // for internal use only bool isInside(const TopoDS_Wire&, const TopoDS_Wire&) const; - bool isEqualGeometry(const TopoDS_Shape&, const TopoDS_Shape&); + bool isParallelPlane(const TopoDS_Shape&, const TopoDS_Shape&) const; + bool isEqualGeometry(const TopoDS_Shape&, const TopoDS_Shape&) const; bool isQuasiEqual(const TopoDS_Shape&, const TopoDS_Shape&) const; void remapSupportShape(const TopoDS_Shape&);