From 145c4502b392f091b6074d97760800877a3a6371 Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 10 Oct 2019 16:13:53 +0300 Subject: [PATCH] Task 2.5 Show where the remaining degrees of freedom are (issue #2997) Show non-fixes shapes if no one constraint is assigned yet. --- src/PartSet/PartSet_WidgetSketchLabel.cpp | 2 +- src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp | 5 ++++- src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 1b65412e8..1cdd66a5c 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -778,7 +778,7 @@ bool PartSet_WidgetSketchLabel::restoreValueCustom() void PartSet_WidgetSketchLabel::onShowDOF() { CompositeFeaturePtr aCompFeature = std::dynamic_pointer_cast(myFeature); - if (aCompFeature.get() && aCompFeature->numberOfSubs() > 1) { + if (aCompFeature.get()) { static const Events_ID anEvent = Events_Loop::eventByName(EVENT_GET_DOF_OBJECTS); ModelAPI_EventCreator::get()->sendUpdated(aCompFeature->subFeature(0), anEvent); Events_Loop::loop()->flush(anEvent); diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp index 9716ae68c..cfa6ccccb 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp @@ -245,7 +245,10 @@ void PlaneGCSSolver_Solver::diagnose(const GCS::Algorithm& theAlgo) void PlaneGCSSolver_Solver::getFreeParameters(GCS::VEC_pD& theFreeParams) const { - myEquationSystem->getDependentParams(theFreeParams); + if (myConstraints.empty()) + theFreeParams = myParameters; + else + myEquationSystem->getDependentParams(theFreeParams); } void PlaneGCSSolver_Solver::addFictiveConstraintIfNecessary() diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp index eb3542bdd..833e15352 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp @@ -666,6 +666,8 @@ void PlaneGCSSolver_Storage::getUnderconstrainedGeometry(std::set& th std::map aParamOfFeatures; for (std::map::const_iterator aFIt = myFeatureMap.begin(); aFIt != myFeatureMap.end(); ++aFIt) { + if (!aFIt->second) + continue; GCS::SET_pD aParams = PlaneGCSSolver_Tools::parameters(aFIt->second); for (GCS::SET_pD::iterator aPIt = aParams.begin(); aPIt != aParams.end(); ++aPIt) aParamOfFeatures[*aPIt] = aFIt->first; -- 2.39.2