]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Make sketch is under the extrusion-cut feature only in the tree, not in the main...
authormpv <mpv@opencascade.com>
Wed, 8 Jul 2015 13:22:02 +0000 (16:22 +0300)
committermpv <mpv@opencascade.com>
Wed, 8 Jul 2015 13:22:02 +0000 (16:22 +0300)
src/Model/Model_Document.cpp
src/Model/Model_Objects.cpp

index 1cdd0bcf190a588d4d80b35d49c42ead042b2adf..51e0782e42c19f64cecdf4a246c9acf035001421 100644 (file)
@@ -14,6 +14,7 @@
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_CompositeFeature.h>
 #include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_Tools.h>
 
 #include <Events_Loop.h>
 #include <Events_Error.h>
@@ -660,7 +661,8 @@ std::shared_ptr<ModelAPI_Feature> 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);
       }
     }
index 0eab9cf32f8d988b05dc0c321e01f80cbfa253bb..1f15f72c2b36d057c0096f6d941242ee4c5751c6 100644 (file)
@@ -16,6 +16,7 @@
 #include <Model_ResultParameter.h>
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_CompositeFeature.h>
+#include <ModelAPI_Tools.h>
 
 #include <Events_Loop.h>
 #include <Events_Error.h>
@@ -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<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
-            std::list<std::shared_ptr<ModelAPI_Result> >::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<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
+              std::list<std::shared_ptr<ModelAPI_Result> >::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);
+                }
               }
             }
           }