PartDesign: decouple refine and other geometric computation (#17008)

This commit is contained in:
Florian Foinant-Willig
2024-12-02 17:57:30 +01:00
committed by GitHub
parent 32e339447a
commit 115667f73a
14 changed files with 141 additions and 5 deletions

View File

@@ -463,6 +463,12 @@ void FeatureExtrude::setupObject()
App::DocumentObjectExecReturn* FeatureExtrude::buildExtrusion(ExtrudeOptions options)
{
if (onlyHasToRefine()){
TopoShape result = refineShapeIfActive(rawShape);
Shape.setValue(result);
return App::DocumentObject::StdReturn;
}
bool makeface = options.testFlag(ExtrudeOption::MakeFace);
bool fuse = options.testFlag(ExtrudeOption::MakeFuse);
bool legacyPocket = options.testFlag(ExtrudeOption::LegacyPocket);
@@ -660,6 +666,9 @@ App::DocumentObjectExecReturn* FeatureExtrude::buildExtrusion(ExtrudeOptions opt
else {
result.makeElementCut({base, prism});
}
// store shape before refinement
this->rawShape = result;
result = refineShapeIfActive(result);
this->AddSubShape.setValue(result);
}
@@ -672,6 +681,9 @@ App::DocumentObjectExecReturn* FeatureExtrude::buildExtrusion(ExtrudeOptions opt
prism = base.makeElementFuse(this->AddSubShape.getShape());
}
else {
// store shape before refinement
this->rawShape = prism;
prism = refineShapeIfActive(prism);
}
@@ -750,8 +762,10 @@ App::DocumentObjectExecReturn* FeatureExtrude::buildExtrusion(ExtrudeOptions opt
}
}
// set the additive shape property for later usage in e.g. pattern
// store shape before refinement
this->rawShape = prism;
prism = refineShapeIfActive(prism);
// set the additive shape property for later usage in e.g. pattern
this->AddSubShape.setValue(prism);
if (base.shapeType(true) <= TopAbs_SOLID && fuse) {
@@ -781,7 +795,11 @@ App::DocumentObjectExecReturn* FeatureExtrude::buildExtrusion(ExtrudeOptions opt
return new App::DocumentObjectExecReturn(
QT_TRANSLATE_NOOP("Exception", "Resulting shape is not a solid"));
}
// store shape before refinement
this->rawShape = result;
solRes = refineShapeIfActive(solRes);
if (!isSingleSolidRuleSatisfied(solRes.getShape())) {
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Result has multiple solids: that is not currently supported."));
}
@@ -791,6 +809,9 @@ App::DocumentObjectExecReturn* FeatureExtrude::buildExtrusion(ExtrudeOptions opt
if (prism.countSubShapes(TopAbs_SOLID) > 1) {
prism.makeElementFuse(prism.getSubTopoShapes(TopAbs_SOLID));
}
// store shape before refinement
this->rawShape = prism;
prism = refineShapeIfActive(prism);
prism = getSolid(prism);
if (!isSingleSolidRuleSatisfied(prism.getShape())) {
@@ -799,6 +820,8 @@ App::DocumentObjectExecReturn* FeatureExtrude::buildExtrusion(ExtrudeOptions opt
this->Shape.setValue(prism);
}
else {
// store shape before refinement
this->rawShape = prism;
prism = refineShapeIfActive(prism);
if (!isSingleSolidRuleSatisfied(prism.getShape())) {
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Result has multiple solids: that is not currently supported."));