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

@@ -381,7 +381,12 @@ TDF_Label ExportOCAF2::exportObject(App::DocumentObject* parentObj,
const char* name)
{
App::DocumentObject* obj;
auto shape = Part::Feature::getTopoShape(parentObj, sub, false, nullptr, &obj, false, !sub);
auto shape = Part::Feature::getTopoShape(
parentObj,
(sub ? Part::ShapeOption::NoFlag : Part::ShapeOption::Transform),
sub,
nullptr,
&obj);
if (!obj || shape.isNull()) {
if (obj) {
FC_WARN(obj->getFullName() << " has null shape");
@@ -415,7 +420,9 @@ TDF_Label ExportOCAF2::exportObject(App::DocumentObject* parentObj,
auto linked = obj;
auto linkedShape = shape;
while (true) {
auto s = Part::Feature::getTopoShape(linked);
auto s = Part::Feature::getTopoShape(linked,
Part::ShapeOption::ResolveLink
| Part::ShapeOption::Transform);
if (s.isNull() || !s.getShape().IsPartner(shape.getShape())) {
break;
}

View File

@@ -557,7 +557,9 @@ App::DocumentObject* ImportOCAF2::loadShapes()
ret->recomputeFeature(true);
}
if (options.merge && ret && !ret->isDerivedFrom<Part::Feature>()) {
auto shape = Part::Feature::getTopoShape(ret);
auto shape = Part::Feature::getTopoShape(ret,
Part::ShapeOption::ResolveLink
| Part::ShapeOption::Transform);
auto feature = pDocument->addObject<Part::Feature>("Feature");
auto name = Tools::labelName(pDoc->Main());
feature->Label.setValue(name.empty() ? default_name.c_str() : name.c_str());