]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'Dev_0.7.1' of newgeom:newgeom.git into Dev_0.7.1
authorsbh <sergey.belash@opencascade.com>
Wed, 28 Jan 2015 13:24:54 +0000 (16:24 +0300)
committersbh <sergey.belash@opencascade.com>
Wed, 28 Jan 2015 13:24:54 +0000 (16:24 +0300)
src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py
src/SketchPlugin/SketchPlugin_Validators.cpp

index ea030b363731b7b9e352f72eede91f01d0f45496..c6f9d8c0f48751e3dee7ebc7aeaa7ffee2535f20 100644 (file)
@@ -24,22 +24,16 @@ class ExportFeature(ModelAPI.ModelAPI_Feature):
         return ExportFeature.ID()
 
     # This feature is action: has no property pannel and executes immideately
-    def isAction(self):
-    #    return True
+    def isAction(self):
+        return True
 
-    def isInHistory(self):
-        return False
+    # The action is not placed into the histiry anyway
+    #def isInHistory(self):
+    #    return False
 
     def initAttributes(self):
-        # This feature has no attributes, but should perform some actions on initialization
-        aSession = ModelAPI.ModelAPI_Session.get()
-        self.Part = aSession.activeDocument()
-        self.geomObjects = []
-        self.geompy = geomBuilder.New(salome.myStudy)
-       
-        # Export bodies and groups
-        self.exportBodies()
-        self.exportGroups()
+      # This feature has no attributes, it is action
+      pass
         
     def exportBodies(self):
         # Get all bodies
@@ -102,5 +96,12 @@ class ExportFeature(ModelAPI.ModelAPI_Feature):
                 self.geompy.addToStudyInFather(obj[1], aGroup, theGroupName)
           
     def execute(self):
-        # Nothing to execute: all logic would be in the initAttributes
+        aSession = ModelAPI.ModelAPI_Session.get()
+        self.Part = aSession.activeDocument()
+        self.geomObjects = []
+        self.geompy = geomBuilder.New(salome.myStudy)
+       
+        # Export bodies and groups
+        self.exportBodies()
+        self.exportGroups()
         pass
index b53102af2a268799729f716ecf5ffde12850d3c6..29bdf3c27310df0ba7abadc7ca882ea353ef4f85 100644 (file)
@@ -22,16 +22,18 @@ bool SketchPlugin_DistanceAttrValidator::isValid(const FeaturePtr& theFeature,
   SessionPtr aMgr = ModelAPI_Session::get();
   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
 
-  // If the object is not a line then it is accepted
-  const ModelAPI_ResultValidator* aLineValidator =
-      dynamic_cast<const ModelAPI_ResultValidator*>(aFactory->validator("SketchPlugin_ResultLine"));
-  bool aLineValid = aLineValidator->isValid(theObject);
-
   const ModelAPI_ResultValidator* anArcValidator =
       dynamic_cast<const ModelAPI_ResultValidator*>(aFactory->validator("SketchPlugin_ResultArc"));
   bool anArcValid = anArcValidator->isValid(theObject);
+  if (anArcValid)
+    return false;
 
-  if (!aLineValid && !anArcValid)
+
+  // If the object is not a line then it is accepted
+  const ModelAPI_ResultValidator* aLineValidator =
+      dynamic_cast<const ModelAPI_ResultValidator*>(aFactory->validator("SketchPlugin_ResultLine"));
+  bool aLineValid = aLineValidator->isValid(theObject);
+  if (!aLineValid)
     return true;
 
   // If it is a line then we have to check that first attribute id not a line