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

@@ -217,7 +217,10 @@ void Tessellation::onEstimateMaximumEdgeLengthClicked()
double edgeLen = 0;
for (auto& sel : Gui::Selection().getSelection("*", Gui::ResolveMode::NoResolve)) {
auto shape = Part::Feature::getTopoShape(sel.pObject, sel.SubName);
auto shape = Part::Feature::getTopoShape(sel.pObject,
Part::ShapeOption::ResolveLink
| Part::ShapeOption::Transform,
sel.SubName);
if (shape.hasSubShape(TopAbs_FACE)) {
Base::BoundBox3d bbox = shape.getBoundBox();
edgeLen = std::max<double>(edgeLen, bbox.LengthX());
@@ -249,7 +252,10 @@ bool Tessellation::accept()
bool bodyWithNoTip = false;
bool partWithNoFace = false;
for (auto& sel : Gui::Selection().getSelection("*", Gui::ResolveMode::NoResolve)) {
auto shape = Part::Feature::getTopoShape(sel.pObject, sel.SubName);
auto shape = Part::Feature::getTopoShape(sel.pObject,
Part::ShapeOption::ResolveLink
| Part::ShapeOption::Transform,
sel.SubName);
if (shape.hasSubShape(TopAbs_FACE)) {
shapeObjects.emplace_back(sel.pObject, sel.SubName);
}
@@ -568,7 +574,10 @@ bool Mesh2ShapeGmsh::writeProject(QString& inpFile, QString& outFile)
App::DocumentObject* part = sub.getObject();
if (part) {
Part::TopoShape shape = Part::Feature::getTopoShape(part, sub.getSubName().c_str());
Part::TopoShape shape = Part::Feature::getTopoShape(part,
Part::ShapeOption::ResolveLink
| Part::ShapeOption::Transform,
sub.getSubName().c_str());
shape.exportBrep(d->cadFile.c_str());
d->label = part->Label.getStrValue() + " (Meshed)";