PartDesign: Fix hole centered on point edge case (#21257)

* Light refactor of getTopoShape function

* Fix hole edge case

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update src/Mod/Part/App/PartFeature.cpp

Co-authored-by: Kacper Donat <kadet1090@gmail.com>

* Update src/Mod/Part/App/PartFeature.cpp

Co-authored-by: Kacper Donat <kadet1090@gmail.com>

* Update src/Mod/Part/App/PartFeature.cpp

Co-authored-by: Kacper Donat <kadet1090@gmail.com>

* Update src/Mod/Part/App/PartFeature.cpp

Co-authored-by: Kacper Donat <kadet1090@gmail.com>

* Refactor simplifyCompound()

* Use Base::Flags<GetShapeOption>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Shorten enum name and move it from class scope to namespace scope

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kacper Donat <kadet1090@gmail.com>
This commit is contained in:
theo-vt
2025-05-29 16:37:54 -04:00
committed by GitHub
parent 17e56f6570
commit 13e7952ccc
52 changed files with 449 additions and 223 deletions

View File

@@ -80,7 +80,7 @@ public:
if (Base::Tools::isNullOrEmpty(sSubName)) {
// If selecting again the same edge the passed sub-element is empty. If the whole
// shape is an edge or wire we can use it completely.
Part::TopoShape topoShape = Part::Feature::getTopoShape(pObj);
Part::TopoShape topoShape = Part::Feature::getTopoShape(pObj, Part::ShapeOption::ResolveLink | Part::ShapeOption::Transform);
if (topoShape.isNull()) {
return false;
}
@@ -162,7 +162,7 @@ void SweepWidget::findShapes()
std::vector<App::DocumentObject*> objs = activeDoc->getObjectsOfType<App::DocumentObject>();
for (auto obj : objs) {
Part::TopoShape topoShape = Part::Feature::getTopoShape(obj);
Part::TopoShape topoShape = Part::Feature::getTopoShape(obj, Part::ShapeOption::ResolveLink | Part::ShapeOption::Transform);
if (topoShape.isNull()) {
continue;
}
@@ -225,7 +225,7 @@ bool SweepWidget::isPathValid(const Gui::SelectionObject& sel) const
const std::vector<std::string>& sub = sel.getSubNames();
TopoDS_Shape pathShape;
const Part::TopoShape& shape = Part::Feature::getTopoShape(path);
const Part::TopoShape& shape = Part::Feature::getTopoShape(path, Part::ShapeOption::ResolveLink | Part::ShapeOption::Transform);
if (shape.isNull()){
return false;
}
@@ -295,10 +295,14 @@ bool SweepWidget::accept()
docobj = selobjs[0].getObject();
spineObject = selobjs[0].getFeatName();
spineLabel = docobj->Label.getValue();
topoShape = Part::Feature::getTopoShape(docobj);
topoShape = Part::Feature::getTopoShape(docobj, Part::ShapeOption::ResolveLink | Part::ShapeOption::Transform);
if (!topoShape.isNull()) {
for (std::vector<std::string>::const_iterator it = subnames.begin(); it != subnames.end(); ++it) {
subShapes.push_back(Part::Feature::getTopoShape(docobj, subnames[0].c_str(), true /*need element*/));
subShapes.push_back(Part::Feature::getTopoShape(docobj,
Part::ShapeOption::NeedSubElement
| Part::ShapeOption::ResolveLink
| Part::ShapeOption::Transform,
subnames[0].c_str()));
}
for (const auto & it : subShapes) {
TopoDS_Shape dsShape = it.getShape();