Skip to content

Commit

Permalink
Sketcher: SketchObject partially redundant status
Browse files Browse the repository at this point in the history
  • Loading branch information
abdullahtahiriyo committed Jan 23, 2021
1 parent a3c1010 commit b01313c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Mod/Sketcher/App/SketchObject.cpp
Expand Up @@ -245,9 +245,11 @@ void SketchObject::retrieveSolverDiagnostics()
{
lastHasConflict = solvedSketch.hasConflicts();
lastHasRedundancies = solvedSketch.hasRedundancies();
lastHasPartialRedundancies = solvedSketch.hasPartialRedundancies();
lastHasMalformedConstraints = solvedSketch.hasMalformedConstraints();
lastConflicting=solvedSketch.getConflicting();
lastRedundant=solvedSketch.getRedundant();
lastPartiallyRedundant=solvedSketch.getPartiallyRedundant();
lastMalformedConstraints=solvedSketch.getMalformedConstraints();
}

Expand Down Expand Up @@ -314,6 +316,10 @@ int SketchObject::solve(bool updateGeoAfterSolving/*=true*/)
Base::Console().Error("Sketch %s has malformed constraints!\n",this->getNameInDocument());
}

if(lastHasPartialRedundancies) {
Base::Console().Warning("Sketch %s has partially redundant constraints!\n",this->getNameInDocument());
}

lastSolveTime=solvedSketch.getSolveTime();

if (err == 0 && updateGeoAfterSolving) {
Expand Down Expand Up @@ -656,7 +662,7 @@ int SketchObject::setUpSketch()

retrieveSolverDiagnostics();

if(lastHasRedundancies || lastDoF < 0 || lastHasConflict || lastHasMalformedConstraints)
if(lastHasRedundancies || lastDoF < 0 || lastHasConflict || lastHasMalformedConstraints || lastHasPartialRedundancies)
Constraints.touch();

return lastDoF;
Expand Down
6 changes: 6 additions & 0 deletions src/Mod/Sketcher/App/SketchObject.h
Expand Up @@ -350,6 +350,8 @@ class SketcherExport SketchObject : public Part::Part2DObject
inline bool getLastHasConflicts() const {return lastHasConflict;}
/// gets HasRedundancies status of last solver execution
inline bool getLastHasRedundancies() const {return lastHasRedundancies;}
/// gets HasRedundancies status of last solver execution
inline bool getLastHasPartialRedundancies() const {return lastHasPartialRedundancies;}
/// gets HasMalformedConstraints status of last solver execution
inline bool getLastHasMalformedConstraints() const {return lastHasMalformedConstraints;}
/// gets solver status of last solver execution
Expand All @@ -361,6 +363,8 @@ class SketcherExport SketchObject : public Part::Part2DObject
/// gets the redundant constraints of last solver execution
inline const std::vector<int> &getLastRedundant(void) const { return lastRedundant; }
/// gets the redundant constraints of last solver execution
inline const std::vector<int> &getLastPartiallyRedundant(void) const { return lastPartiallyRedundant; }
/// gets the redundant constraints of last solver execution
inline const std::vector<int> &getLastMalformedConstraints(void) const { return lastMalformedConstraints; }

public: /* Solver exposed interface */
Expand Down Expand Up @@ -514,12 +518,14 @@ class SketcherExport SketchObject : public Part::Part2DObject
int lastDoF;
bool lastHasConflict;
bool lastHasRedundancies;
bool lastHasPartialRedundancies;
bool lastHasMalformedConstraints;
int lastSolverStatus;
float lastSolveTime;

std::vector<int> lastConflicting;
std::vector<int> lastRedundant;
std::vector<int> lastPartiallyRedundant;
std::vector<int> lastMalformedConstraints;

boost::signals2::scoped_connection constraintsRenamedConn;
Expand Down

0 comments on commit b01313c

Please sign in to comment.