From 6406e2fbe0c924cfe6458de66ac79448838cf069 Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 8 Jul 2015 16:22:02 +0300 Subject: [PATCH] Make sketch is under the extrusion-cut feature only in the tree, not in the main history --- src/Model/Model_Document.cpp | 4 +++- src/Model/Model_Objects.cpp | 28 ++++++++++++++++------------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 1cdd0bcf1..51e0782e4 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -660,7 +661,8 @@ std::shared_ptr Model_Document::currentFeature(const bool theV TDF_Label aLab = aRef->Get(); FeaturePtr aResult = myObjs->feature(aLab); if (theVisible) { // get nearest visible (in history) going up - while(aResult.get() && !aResult->isInHistory()) { + while(aResult.get() && // sub-composites are never in history + (!aResult->isInHistory() || ModelAPI_Tools::compositeOwner(aResult).get())) { aResult = myObjs->nextFeature(aResult, true); } } diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 0eab9cf32..1f15f72c2 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -326,18 +327,21 @@ void Model_Objects::createHistory(const std::string& theGroupID) for(int a = aRefs->Lower(); a <= aRefs->Upper(); a++) { FeaturePtr aFeature = feature(aRefs->Value(a)); if (aFeature.get()) { - if (isFeature) { // here may be also disabled features - if (aFeature->isInHistory()) { - aResult.push_back(aFeature); - } - } else if (!aFeature->isDisabled()) { // iterate all results of not-disabled feature - const std::list >& aResults = aFeature->results(); - std::list >::const_iterator aRIter = aResults.begin(); - for (; aRIter != aResults.cend(); aRIter++) { - ResultPtr aRes = *aRIter; - if (aRes->groupName() != theGroupID) break; // feature have only same group results - if (!aRes->isDisabled() && aRes->isInHistory() && !aRes->isConcealed()) { - aResult.push_back(*aRIter); + // if feature is in sub-component, remove it from history: it is in sub-tree of sub-component + if (!ModelAPI_Tools::compositeOwner(aFeature).get()) { + if (isFeature) { // here may be also disabled features + if (aFeature->isInHistory()) { + aResult.push_back(aFeature); + } + } else if (!aFeature->isDisabled()) { // iterate all results of not-disabled feature + const std::list >& aResults = aFeature->results(); + std::list >::const_iterator aRIter = aResults.begin(); + for (; aRIter != aResults.cend(); aRIter++) { + ResultPtr aRes = *aRIter; + if (aRes->groupName() != theGroupID) break; // feature have only same group results + if (!aRes->isDisabled() && aRes->isInHistory() && !aRes->isConcealed()) { + aResult.push_back(*aRIter); + } } } } -- 2.39.2