From b7e4365efc6e60b721d4eb86ce0705a8810a2001 Mon Sep 17 00:00:00 2001 From: mpv Date: Fri, 10 Jul 2015 07:54:21 +0300 Subject: [PATCH] Make parameters recomputed earlier than other features --- src/Model/Model_Update.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index 3262812a5..e7d369e89 100644 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -176,10 +176,17 @@ void Model_Update::processOperation(const bool theTotalUpdate, const bool theFin DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument(); Model_Objects* anObjs = std::dynamic_pointer_cast(aRootDoc)->objects(); if (!anObjs) return; + // two cycles: parameters are first to process FeaturePtr aFeatureIter = anObjs->firstFeature(); std::set aProcessedFeatures; // to avoid processing twice for (; aFeatureIter.get(); aFeatureIter = anObjs->nextFeature(aFeatureIter)) { - updateFeature(aFeatureIter, aProcessedFeatures); + if (aFeatureIter->groupName() == "Parameter") + updateFeature(aFeatureIter, aProcessedFeatures); + } + aFeatureIter = anObjs->firstFeature(); + for (; aFeatureIter.get(); aFeatureIter = anObjs->nextFeature(aFeatureIter)) { + if (aFeatureIter->groupName() != "Parameter") + updateFeature(aFeatureIter, aProcessedFeatures); } if (isAutomaticChanged) myIsAutomatic = false; @@ -219,10 +226,17 @@ void Model_Update::updateFeature(FeaturePtr theFeature, std::set& th // composite feature must be executed after sub-features execution if (aCompos) { + // two cycles: parameters must be processed first + for(int a = 0; a < aCompos->numberOfSubs(); a++) { + FeaturePtr aSub = aCompos->subFeature(a); + if (aSub->groupName() == "Parameter") + updateFeature(aSub, theProcessed); + } // number of subs can be changed in execution: like fillet for(int a = 0; a < aCompos->numberOfSubs(); a++) { FeaturePtr aSub = aCompos->subFeature(a); - updateFeature(aSub, theProcessed); + if (aSub->groupName() != "Parameter") + updateFeature(aSub, theProcessed); } } // this checking must be after the composite feature sub-elements processing: -- 2.39.2