From e56979e76e4e10cdaa9133ef153c06b824a225a8 Mon Sep 17 00:00:00 2001 From: theo-vt Date: Thu, 8 May 2025 12:47:26 -0400 Subject: [PATCH] PartDesign: Fix no longer possible to make a hole from one selected circle in a sketch (#21030) * Search for profile shape subelements without simplifying compounds for hole center detection * Simpler solution --- src/Mod/PartDesign/App/FeatureHole.cpp | 4 ++-- src/Mod/PartDesign/App/FeatureSketchBased.cpp | 8 ++++---- src/Mod/PartDesign/App/FeatureSketchBased.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Mod/PartDesign/App/FeatureHole.cpp b/src/Mod/PartDesign/App/FeatureHole.cpp index 8d80404c0f..50dc45d5ea 100644 --- a/src/Mod/PartDesign/App/FeatureHole.cpp +++ b/src/Mod/PartDesign/App/FeatureHole.cpp @@ -1827,8 +1827,8 @@ static gp_Pnt toPnt(gp_Vec dir) } App::DocumentObjectExecReturn* Hole::execute() -{ - TopoShape profileshape = getProfileShape(/*needSubElement*/ false); +{ + TopoShape profileshape = getProfileShape(); // Find the base shape TopoShape base; diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.cpp b/src/Mod/PartDesign/App/FeatureSketchBased.cpp index 8c285edf29..96b8681074 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.cpp +++ b/src/Mod/PartDesign/App/FeatureSketchBased.cpp @@ -337,7 +337,7 @@ TopoDS_Shape ProfileBased::getVerifiedFace(bool silent) const { } else if (AllowMultiFace.getValue()) { try { - auto shape = getProfileShape(/*needSubElement*/ false); + auto shape = getProfileShape(); if (shape.isNull()) err = "Linked shape object is empty"; else { @@ -404,7 +404,7 @@ TopoDS_Shape ProfileBased::getVerifiedFace(bool silent) const { return TopoDS_Face(); } -TopoShape ProfileBased::getProfileShape(bool needSubElement) const +TopoShape ProfileBased::getProfileShape() const { TopoShape shape; const auto& subs = Profile.getSubValues(); @@ -416,7 +416,7 @@ TopoShape ProfileBased::getProfileShape(bool needSubElement) const std::vector shapes; for (auto& sub : subs) { shapes.push_back( - Part::Feature::getTopoShape(profile, sub.c_str(), needSubElement)); + Part::Feature::getTopoShape(profile, sub.c_str(), /* needSubElement */ true)); } shape = TopoShape(shape.Tag).makeElementCompound(shapes); } @@ -472,7 +472,7 @@ std::vector ProfileBased::getTopoShapeProfileWires() const // tessellations for some faces. Making an explicit copy of the linked // shape seems to fix it. The error mostly happens when re-computing the // shape but sometimes also for the first time - auto shape = getProfileShape(/*needSubElement*/ false).makeElementCopy(); + auto shape = getProfileShape().makeElementCopy(); if (shape.hasSubShape(TopAbs_WIRE)) { return shape.getSubTopoShapes(TopAbs_WIRE); diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.h b/src/Mod/PartDesign/App/FeatureSketchBased.h index dc6cc81eed..08be8a10ef 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.h +++ b/src/Mod/PartDesign/App/FeatureSketchBased.h @@ -131,7 +131,7 @@ public: virtual Base::Vector3d getProfileNormal() const; - TopoShape getProfileShape(bool needSubElement = false) const; + TopoShape getProfileShape() const; /// retrieves the number of axes in the linked sketch (defined as construction lines) int getSketchAxisCount() const;