diff --git a/src/sketch.h b/src/sketch.h index e8d17a6..abf35fc 100644 --- a/src/sketch.h +++ b/src/sketch.h @@ -106,6 +106,7 @@ public: bool visible; bool suppress; bool relaxConstraints; + bool allowRedundant; bool allDimsReference; double scale; @@ -194,6 +195,7 @@ public: static void AddParam(ParamList *param, hParam hp, double v); void Generate(EntityList *entity, ParamList *param); + bool IsSolvedOkay(); void TransformImportedBy(Vector t, Quaternion q); // When a request generates entities from entities, and the source // entities may have come from multiple requests, it's necessary to diff --git a/src/system.cpp b/src/system.cpp index ad2ea48..74d1cfe 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -460,9 +460,12 @@ int System::Solve(Group *g, int *dof, List *bad, goto didnt_converge; } - if(!TestRank()) { - if(andFindBad) FindWhichToRemoveToFixJacobian(g, bad); - return System::REDUNDANT_OKAY; + rankOk = TestRank(); + if(!rankOk) { + if(!g->allowRedundant) { + if(andFindBad) FindWhichToRemoveToFixJacobian(g, bad); + return System::REDUNDANT_OKAY; + } } // This is not the full Jacobian, but any substitutions or single-eq @@ -506,7 +509,7 @@ int System::Solve(Group *g, int *dof, List *bad, pp->known = true; pp->free = p->free; } - return System::SOLVED_OKAY; + return rankOk ? System::SOLVED_OKAY : System::REDUNDANT_OKAY; didnt_converge: SK.constraint.ClearTags(); diff --git a/src/ui.h b/src/ui.h index 45e3c30..467592e 100644 --- a/src/ui.h +++ b/src/ui.h @@ -271,6 +271,8 @@ public: static void ScreenChangeCanvasSize(int link, uint32_t v); static void ScreenChangeShadedTriangles(int link, uint32_t v); + static void ScreenAllowRedundant(int link, uint32_t v); + static void ScreenStepDimSteps(int link, uint32_t v); static void ScreenStepDimFinish(int link, uint32_t v); static void ScreenStepDimGo(int link, uint32_t v);