From 876df3f1e552699e9bea75c48245e92e1bedd81e Mon Sep 17 00:00:00 2001 From: azv Date: Tue, 1 Nov 2016 08:10:47 +0300 Subject: [PATCH] Fix incorrect DoF after dump-import loop (issue #1767) There is changed processing of external entities, no need to calculate DoF for them. --- src/SketchSolver/SketchSolver_Manager.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/SketchSolver/SketchSolver_Manager.cpp b/src/SketchSolver/SketchSolver_Manager.cpp index 847607325..2449d61c0 100644 --- a/src/SketchSolver/SketchSolver_Manager.cpp +++ b/src/SketchSolver/SketchSolver_Manager.cpp @@ -579,6 +579,14 @@ static void collectPointsAndCopies(FeaturePtr theConstraint, std::listselection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + return anAttr && anAttr->context() && !anAttr->isInvalid(); +} + // ============================================================================ // Function: degreesOfFreedom // Purpose: calculate DoFs for each sketch @@ -641,6 +649,9 @@ void SketchSolver_Manager::degreesOfFreedom() int aNbSubs = aSketch->numberOfSubs(); for (int i = 0; i < aNbSubs; ++i) { FeaturePtr aFeature = aSketch->subFeature(i); + // do not change DoF for external feature + if (isExternal(aFeature)) + continue; // check DoF delta for invariant types std::map::const_iterator aFound = aDoFDelta.find(aFeature->getKind()); if (aFound != aDoFDelta.end()) { @@ -751,6 +762,8 @@ void SketchSolver_Manager::degreesOfFreedom() } else { FeaturePtr anAttr = ModelAPI_Feature::feature(aRefAttr->object()); if (anAttr) { + if (isExternal(anAttr)) + continue; // feature is already fixed since it is external aDoF -= aDoFDelta[anAttr->getKind()]; std::list aPtAttrs = anAttr->data()->attributes(GeomDataAPI_Point2D::typeId()); aPoints.insert(aPtAttrs.begin(), aPtAttrs.end()); -- 2.39.2