Sketcher: SketchObject - Add ability to diagnose constraint redundancy before addition

======================================================================================

It preserves the SketchObject properties. Therefore it does not trigger any property update, redraws, ...
This commit is contained in:
Abdullah Tahiri
2022-05-08 11:27:40 +02:00
committed by abdullahtahiriyo
parent ad6576d385
commit b0492010d0
2 changed files with 21 additions and 0 deletions

View File

@@ -694,6 +694,24 @@ int SketchObject::setUpSketch()
Constraints.touch();
return lastDoF;
}
int SketchObject::diagnoseAdditionalConstraints(std::vector<Sketcher::Constraint *> additionalconstraints)
{
auto objectconstraints = Constraints.getValues();
std::vector<Sketcher::Constraint *> allconstraints;
allconstraints.reserve(objectconstraints.size()+additionalconstraints.size());
std::copy(objectconstraints.begin(), objectconstraints.end(), back_inserter(allconstraints));
std::copy(additionalconstraints.begin(), additionalconstraints.end(), back_inserter(allconstraints));
lastDoF = solvedSketch.setUpSketch(getCompleteGeometry(), allconstraints,
getExternalGeometryCount());
retrieveSolverDiagnostics();
return lastDoF;
}

View File

@@ -211,6 +211,9 @@ public:
*/
int setUpSketch();
/** Performs a full analysis of the addition of additional constraints without adding them to the sketch object */
int diagnoseAdditionalConstraints(std::vector<Sketcher::Constraint *> additionalconstraints);
/** solves the sketch and updates the geometry, but not all the dependent features (does not recompute)
When a recompute is necessary, recompute triggers execute() which solves the sketch and updates all dependent features
When a solve only is necessary (e.g. DoF changed), solve() solves the sketch and