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:
@@ -90,7 +90,7 @@ App::DocumentObjectExecReturn* RuledSurface::getShape(const App::PropertyLinkSub
|
||||
TopoDS_Shape& shape) const
|
||||
{
|
||||
App::DocumentObject* obj = link.getValue();
|
||||
const Part::TopoShape part = Part::Feature::getTopoShape(obj);
|
||||
const Part::TopoShape part = Part::Feature::getTopoShape(obj, ShapeOption::ResolveLink | ShapeOption::Transform);
|
||||
if (part.isNull()) {
|
||||
return new App::DocumentObjectExecReturn("No shape linked.");
|
||||
}
|
||||
@@ -127,7 +127,7 @@ App::DocumentObjectExecReturn* RuledSurface::execute()
|
||||
std::array<App::PropertyLinkSub*, 2> links = {&Curve1, &Curve2};
|
||||
for (auto link : links) {
|
||||
App::DocumentObject* obj = link->getValue();
|
||||
const Part::TopoShape part = Part::Feature::getTopoShape(obj);
|
||||
const Part::TopoShape part = Part::Feature::getTopoShape(obj, ShapeOption::ResolveLink | ShapeOption::Transform);
|
||||
if (part.isNull()) {
|
||||
return new App::DocumentObjectExecReturn("No shape linked.");
|
||||
}
|
||||
@@ -140,7 +140,11 @@ App::DocumentObjectExecReturn* RuledSurface::execute()
|
||||
return new App::DocumentObjectExecReturn("Not exactly one sub-shape linked.");
|
||||
}
|
||||
else {
|
||||
shapes.push_back(getTopoShape(link->getValue(), subs.front().c_str(), true));
|
||||
shapes.push_back(getTopoShape(link->getValue(),
|
||||
ShapeOption::NeedSubElement
|
||||
| ShapeOption::ResolveLink
|
||||
| ShapeOption::Transform,
|
||||
subs.front().c_str()));
|
||||
}
|
||||
if (shapes.back().isNull()) {
|
||||
return new App::DocumentObjectExecReturn("Invalid link.");
|
||||
@@ -216,7 +220,7 @@ App::DocumentObjectExecReturn* Loft::execute()
|
||||
try {
|
||||
std::vector<TopoShape> shapes;
|
||||
for (auto& obj : Sections.getValues()) {
|
||||
shapes.emplace_back(getTopoShape(obj));
|
||||
shapes.emplace_back(getTopoShape(obj, ShapeOption::ResolveLink | ShapeOption::Transform));
|
||||
if (shapes.back().isNull()) {
|
||||
return new App::DocumentObjectExecReturn("Invalid section link");
|
||||
}
|
||||
@@ -300,7 +304,7 @@ App::DocumentObjectExecReturn* Sweep::execute()
|
||||
if (!Spine.getValue()) {
|
||||
return new App::DocumentObjectExecReturn("No spine");
|
||||
}
|
||||
TopoShape spine = getTopoShape(Spine.getValue());
|
||||
TopoShape spine = getTopoShape(Spine.getValue(), ShapeOption::ResolveLink | ShapeOption::Transform);
|
||||
const auto& subs = Spine.getSubValues();
|
||||
if (spine.isNull()) {
|
||||
return new App::DocumentObjectExecReturn("Invalid spine");
|
||||
@@ -319,7 +323,7 @@ App::DocumentObjectExecReturn* Sweep::execute()
|
||||
std::vector<TopoShape> shapes;
|
||||
shapes.push_back(spine);
|
||||
for (auto& obj : Sections.getValues()) {
|
||||
shapes.emplace_back(getTopoShape(obj));
|
||||
shapes.emplace_back(getTopoShape(obj, ShapeOption::ResolveLink | ShapeOption::Transform));
|
||||
if (shapes.back().isNull()) {
|
||||
return new App::DocumentObjectExecReturn("Invalid section link");
|
||||
}
|
||||
@@ -415,7 +419,7 @@ void Thickness::handleChangedPropertyType(Base::XMLReader& reader,
|
||||
App::DocumentObjectExecReturn* Thickness::execute()
|
||||
{
|
||||
std::vector<TopoShape> shapes;
|
||||
auto base = getTopoShape(Faces.getValue());
|
||||
auto base = getTopoShape(Faces.getValue(), ShapeOption::ResolveLink | ShapeOption::Transform);
|
||||
if (base.isNull()) {
|
||||
return new App::DocumentObjectExecReturn("Invalid source shape");
|
||||
}
|
||||
@@ -485,7 +489,7 @@ Reverse::Reverse()
|
||||
App::DocumentObjectExecReturn* Reverse::execute()
|
||||
{
|
||||
App::DocumentObject* source = Source.getValue<App::DocumentObject*>();
|
||||
Part::TopoShape topoShape = Part::Feature::getTopoShape(source);
|
||||
Part::TopoShape topoShape = Part::Feature::getTopoShape(source, ShapeOption::ResolveLink | ShapeOption::Transform);
|
||||
if (topoShape.isNull()) {
|
||||
return new App::DocumentObjectExecReturn("No part object linked.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user