]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom.git into Dev_1.1.0
authorsbh <sergey.belash@opencascade.com>
Thu, 26 Mar 2015 09:55:57 +0000 (12:55 +0300)
committersbh <sergey.belash@opencascade.com>
Thu, 26 Mar 2015 09:55:57 +0000 (12:55 +0300)
Conflicts:
src/SketchPlugin/SketchPlugin_Plugin.cpp

15 files changed:
src/Model/Model_AttributeSelection.cpp
src/ModelAPI/ModelAPI_Attribute.cpp
src/ModelAPI/ModelAPI_Attribute.h
src/ModuleBase/ModuleBase_WidgetValidated.cpp
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_icons.qrc
src/PartSet/icons/coincedence.png [new file with mode: 0644]
src/SketchPlugin/CMakeLists.txt
src/SketchPlugin/SketchPlugin_ExternalValidator.cpp [new file with mode: 0644]
src/SketchPlugin/SketchPlugin_ExternalValidator.h [new file with mode: 0644]
src/SketchPlugin/SketchPlugin_Plugin.cpp
src/SketchPlugin/SketchPlugin_ShapeValidator.cpp [deleted file]
src/SketchPlugin/SketchPlugin_ShapeValidator.h [deleted file]
src/SketchPlugin/plugin-Sketch.xml
src/SketcherPrs/SketcherPrs_Tools.cpp

index 003fb28e9912227a90e23a41680f331e8ab7b333..f31bba3f33005d37a9486aca9a6f79a4e179a96c 100644 (file)
@@ -118,7 +118,8 @@ void Model_AttributeSelection::setValue(const ResultPtr& theContext,
       selectConstruction(theContext, theSubShape);
     }
   }
-  myIsInitialized = true;
+  //the attribute initialized state should be changed by sendAttributeUpdated only
+  //myIsInitialized = true;
 
   std::string aSelName = namingName();
   if(!aSelName.empty())
index 249353c542248d346501ff94ba5b969318307846..e7553a05da282865ec233007a0e627e3a8b4e446 100644 (file)
@@ -30,7 +30,17 @@ bool ModelAPI_Attribute::isInitialized()
 
 void ModelAPI_Attribute::setInitialized()
 {
-  myIsInitialized = true;
+  if (!mySetInitializedBlocked)
+    myIsInitialized = true;
+}
+
+bool ModelAPI_Attribute::blockSetInitialized(const bool theBlock)
+{
+  bool aBlocked = mySetInitializedBlocked;
+  
+  mySetInitializedBlocked = theBlock;
+
+  return aBlocked;
 }
 
 void ModelAPI_Attribute::setIsArgument(const bool theFlag)
@@ -62,6 +72,7 @@ const std::string& ModelAPI_Attribute::id() const
 
 ModelAPI_Attribute::ModelAPI_Attribute()
 {
+  mySetInitializedBlocked = false;
   myIsInitialized = false;
   myIsArgument = true;
   myIsImmutable = false;
index 179fbae2ff8f9636c80e2ce7289cacd847e3e4a9..1892b77bc8c5687367d091a559fc67a7451450b5 100644 (file)
@@ -25,6 +25,7 @@ class ModelAPI_Attribute
  protected:
   // accessible from the attributes
   bool myIsInitialized; ///< is some value assigned to this attribute
+  bool mySetInitializedBlocked; ///< is initialized blocked
   bool myIsArgument;    ///< is this attribute used as an argument for execution
   bool myIsImmutable;   ///< is this attribute can be changed programmatically (e.g. by constraint)
 
@@ -48,6 +49,11 @@ class ModelAPI_Attribute
   /// Makes attribute initialized
   MODELAPI_EXPORT void setInitialized();
 
+  /// Blocks sending "attribute updated" if theBlock is true
+  /// \param theBlock a block value
+  /// \return the previous block value
+  MODELAPI_EXPORT bool blockSetInitialized(const bool theBlock);
+
   /// Set this attribute is argument for result (change of this attribute requires update of result).
   /// By default it is true.
   MODELAPI_EXPORT void setIsArgument(const bool theFlag);
index 2dd78afc614a4ce83c47426a911bb9c589579986..e7285ab159157d243e0aa4447e99250fd1bc43b6 100644 (file)
@@ -41,7 +41,12 @@ bool ModuleBase_WidgetValidated::setSelection(ModuleBase_ViewerPrs theValue)
 //********************************************************************
 bool ModuleBase_WidgetValidated::isValid(const Handle_SelectMgr_EntityOwner& theOwner)
 {
+  DataPtr aData = myFeature->data();
+  AttributePtr anAttribute = myFeature->attribute(attributeID());
+
   // stores the current values of the widget attribute
+  aData->blockSendAttributeUpdated(true);
+  bool isAttributeBlocked = anAttribute->blockSetInitialized(true);
   storeAttributeValue();
 
   // saves the owner value to the widget attribute
@@ -52,6 +57,8 @@ bool ModuleBase_WidgetValidated::isValid(const Handle_SelectMgr_EntityOwner& the
 
   // restores the current values of the widget attribute
   restoreAttributeValue(aValid);
+  aData->blockSendAttributeUpdated(false);
+  anAttribute->blockSetInitialized(isAttributeBlocked);
 
   return aValid;
 }
@@ -68,9 +75,6 @@ bool ModuleBase_WidgetValidated::isValidAttribute() const
   DataPtr aData = myFeature->data();
   AttributePtr anAttribute = myFeature->attribute(attributeID());
 
-  aData->blockSendAttributeUpdated(true);
-
-    // 3. check the acceptability of the current values
   std::list<ModelAPI_Validator*>::iterator aValidator = aValidators.begin();
   std::list<std::list<std::string> >::iterator aArgs = anArguments.begin();
   bool aValid = true;
@@ -81,8 +85,6 @@ bool ModuleBase_WidgetValidated::isValidAttribute() const
       aValid = aAttrValidator->isValid(anAttribute, *aArgs);
     }
   }
-  aData->blockSendAttributeUpdated(false);
-
   return aValid;
 }
 
index a6ae7a8a5bcb4f656210a239a4d08275dbb4878f..2747c40040ff28e34ea3fe1b693fc19cef2f02fb 100644 (file)
@@ -52,6 +52,7 @@
 #include <SketchPlugin_ConstraintVertical.h>
 #include <SketchPlugin_ConstraintEqual.h>
 #include <SketchPlugin_ConstraintTangent.h>
+#include <SketchPlugin_ConstraintCoincidence.h>
 
 #include <SelectMgr_IndexedMapOfOwner.hxx>
 #include <StdSelect_BRepOwner.hxx>
@@ -586,6 +587,7 @@ QStringList PartSet_SketcherMgr::sketchOperationIdList()
     aIds << SketchPlugin_ConstraintVertical::ID().c_str();
     aIds << SketchPlugin_ConstraintEqual::ID().c_str();
     aIds << SketchPlugin_ConstraintTangent::ID().c_str();
+    aIds << SketchPlugin_ConstraintCoincidence::ID().c_str();
   }
   return aIds;
 }
index 8c546fdb80073fbc7d9929ca6392fa02240db55d..62cefad4869b312719b4c8aa186014b9af079174 100644 (file)
@@ -35,5 +35,6 @@
      <file>icons/equal.png</file>
      <file>icons/tangent.png</file>
      <file>icons/fillet.png</file>
+     <file>icons/coincedence.png</file>
  </qresource>
  </RCC>
diff --git a/src/PartSet/icons/coincedence.png b/src/PartSet/icons/coincedence.png
new file mode 100644 (file)
index 0000000..9e0670d
Binary files /dev/null and b/src/PartSet/icons/coincedence.png differ
index d6a7d77ac49a5281895e779b9bdd02dc6aa26e6f..f7e3f9aca2bf11eea7cc0bb7d90bb41b198da79b 100644 (file)
@@ -28,7 +28,7 @@ SET(PROJECT_HEADERS
     SketchPlugin_ConstraintTangent.h
     SketchPlugin_ConstraintMirror.h
     SketchPlugin_ConstraintFillet.h
-    SketchPlugin_ShapeValidator.h
+    SketchPlugin_ExternalValidator.h
     SketchPlugin_Validators.h
 )
 
@@ -55,7 +55,7 @@ SET(PROJECT_SOURCES
     SketchPlugin_ConstraintTangent.cpp
     SketchPlugin_ConstraintMirror.cpp
     SketchPlugin_ConstraintFillet.cpp
-    SketchPlugin_ShapeValidator.cpp
+    SketchPlugin_ExternalValidator.cpp
     SketchPlugin_Validators.cpp
 )
 
diff --git a/src/SketchPlugin/SketchPlugin_ExternalValidator.cpp b/src/SketchPlugin/SketchPlugin_ExternalValidator.cpp
new file mode 100644 (file)
index 0000000..7b85871
--- /dev/null
@@ -0,0 +1,51 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        Model_ResultValidators.cpp
+// Created:     27 Feb 2015
+// Author:      Natalia ERMOLAEVA
+
+#include "SketchPlugin_ExternalValidator.h"
+#include "SketchPlugin_Feature.h"
+
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Result.h>
+#include <ModelAPI_Tools.h>
+#include <ModelAPI_AttributeRefAttr.h>
+
+bool SketchPlugin_ExternalValidator::isValid(const AttributePtr& theAttribute,
+                                          const std::list<std::string>& theArguments) const
+{
+  if (theArguments.size() != 1)
+    return true;
+
+  // ask whether the feature of the attribute is external
+  bool isAttributeExternal = isExternalAttribute(theAttribute);
+
+  // ask whether the feature of the attribute by parameter identifier is external
+  std::string aFrontArgument = theArguments.front();
+  FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
+  bool isParameterExternal = isExternalAttribute(aFeature->attribute(aFrontArgument));
+
+  // it is not possible that both features, attribute and attribute in parameter, are external
+  if (isAttributeExternal && isParameterExternal)
+    return false;
+  return true;
+}
+
+bool SketchPlugin_ExternalValidator::isExternalAttribute(const AttributePtr& theAttribute) const
+{
+  bool isExternal = false;
+  AttributeRefAttrPtr anAttribute = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
+
+  if (anAttribute.get() != NULL) {
+    FeaturePtr anArgumentFeature = ModelAPI_Feature::feature(anAttribute->object());
+    if (anArgumentFeature.get() != NULL) {
+      std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
+                                    std::dynamic_pointer_cast<SketchPlugin_Feature>(anArgumentFeature);
+      if (aSketchFeature.get() != NULL) {
+        isExternal = aSketchFeature->isExternal();
+      }
+    }
+  }
+  return isExternal;
+}
diff --git a/src/SketchPlugin/SketchPlugin_ExternalValidator.h b/src/SketchPlugin/SketchPlugin_ExternalValidator.h
new file mode 100644 (file)
index 0000000..62d95bf
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        Model_ResultValidators.h
+// Created:     27 Feb 2015
+// Author:      Natalia ERMOLAEVA
+
+#ifndef SketchPlugin_ExternalValidator_H
+#define SketchPlugin_ExternalValidator_H
+
+#include <SketchPlugin.h>
+#include <ModelAPI_AttributeValidator.h>
+
+/**\class SketchPlugin_ResultPointValidator
+ * \ingroup Validators
+ * \brief Validator for the points selection
+ *
+ * Allows to select points only.
+ */
+class SketchPlugin_ExternalValidator : public ModelAPI_AttributeValidator
+{
+public:
+  /// returns true if the feature of attribute do not contain external features in the given attribute and
+  /// among attributes listed in the arguments
+  /// \param theAttribute an attribute to check
+  /// \param theArguments a filter parameters
+  SKETCHPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
+                                           const std::list<std::string>& theArguments) const;
+
+protected:
+  /// returns true if the feature of the attribute is external
+  /// \param theAttribute an attribute to check
+  bool isExternalAttribute(const AttributePtr& theAttribute) const;
+};
+
+#endif
index 35ff48c6ab8101d120185aa8db6e6ec22343d364..68302fee1541fe700c648e15a9875c25297a213c 100644 (file)
@@ -20,7 +20,7 @@
 #include <SketchPlugin_ConstraintTangent.h>
 #include <SketchPlugin_ConstraintVertical.h>
 #include <SketchPlugin_Validators.h>
-#include <SketchPlugin_ShapeValidator.h>
+#include <SketchPlugin_ExternalValidator.h>
 
 #include <Events_Loop.h>
 #include <GeomDataAPI_Dir.h>
@@ -51,13 +51,12 @@ SketchPlugin_Plugin::SketchPlugin_Plugin()
   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
   aFactory->registerValidator("SketchPlugin_DistanceAttr",
                               new SketchPlugin_DistanceAttrValidator);  
-  //aFactory->registerValidator("SketchPlugin_DifferentObjects",
-  //                            new SketchPlugin_DifferentObjectsValidator);
-  aFactory->registerValidator("SketchPlugin_ShapeValidator", new SketchPlugin_ShapeValidator);
+  aFactory->registerValidator("SketchPlugin_ExternalValidator",
+                              new SketchPlugin_ExternalValidator);
 
   // register this plugin
   ModelAPI_Session::get()->registerPlugin(this);
-
+  
   Config_PropManager::registerProp("Visualization", "sketch_entity_color", "Sketch enity color",
                                    Config_Prop::Color, SKETCH_ENTITY_COLOR);
 
diff --git a/src/SketchPlugin/SketchPlugin_ShapeValidator.cpp b/src/SketchPlugin/SketchPlugin_ShapeValidator.cpp
deleted file mode 100644 (file)
index 0722ce1..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-// File:        Model_ResultValidators.cpp
-// Created:     27 Feb 2015
-// Author:      Natalia ERMOLAEVA
-
-#include "SketchPlugin_ShapeValidator.h"
-#include "SketchPlugin_Feature.h"
-
-#include <ModelAPI_Session.h>
-#include <ModelAPI_Result.h>
-#include <ModelAPI_Tools.h>
-#include <ModelAPI_AttributeRefAttr.h>
-
-bool SketchPlugin_ShapeValidator::isValid(const AttributePtr& theAttribute,
-                                          const std::list<std::string>& theArguments) const
-{
-  if (theArguments.size() != 1)
-    return true;
-
-  // ask whether the feature of the attribute is external
-  bool isAttributeExternal = isExternalAttribute(theAttribute);
-
-  // ask whether the feature of the attribute by parameter identifier is external
-  std::string aFrontArgument = theArguments.front();
-  FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
-  bool isParameterExternal = isExternalAttribute(aFeature->attribute(aFrontArgument));
-
-  // it is not possible that both features, attribute and attribute in parameter, are external
-  if (isAttributeExternal && isParameterExternal)
-    return false;
-  return true;
-}
-
-bool SketchPlugin_ShapeValidator::isExternalAttribute(const AttributePtr& theAttribute) const
-{
-  bool isExternal = false;
-  AttributeRefAttrPtr anAttribute = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
-
-  if (anAttribute.get() != NULL) {
-    FeaturePtr anArgumentFeature = ModelAPI_Feature::feature(anAttribute->object());
-    if (anArgumentFeature.get() != NULL) {
-      std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
-                                    std::dynamic_pointer_cast<SketchPlugin_Feature>(anArgumentFeature);
-      if (aSketchFeature.get() != NULL) {
-        isExternal = aSketchFeature->isExternal();
-      }
-    }
-  }
-  return isExternal;
-}
diff --git a/src/SketchPlugin/SketchPlugin_ShapeValidator.h b/src/SketchPlugin/SketchPlugin_ShapeValidator.h
deleted file mode 100644 (file)
index d07581e..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-// File:        Model_ResultValidators.h
-// Created:     27 Feb 2015
-// Author:      Natalia ERMOLAEVA
-
-#ifndef SketchPlugin_ShapeValidator_H
-#define SketchPlugin_ShapeValidator_H
-
-#include <SketchPlugin.h>
-#include <ModelAPI_AttributeValidator.h>
-
-/**\class SketchPlugin_ResultPointValidator
- * \ingroup Validators
- * \brief Validator for the points selection
- *
- * Allows to select points only.
- */
-class SketchPlugin_ShapeValidator : public ModelAPI_AttributeValidator
-{
-public:
-  /// returns true if the feature of attribute do not contain external features in the given attribute and
-  /// among attributes listed in the arguments
-  /// \param theAttribute an attribute to check
-  /// \param theArguments a filter parameters
-  SKETCHPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
-                                           const std::list<std::string>& theArguments) const;
-
-protected:
-  /// returns true if the feature of the attribute is external
-  /// \param theAttribute an attribute to check
-  bool isExternalAttribute(const AttributePtr& theAttribute) const;
-};
-
-#endif
index af51a5dd6164706a677181ba402fd625d2910d1c..2691caeba4374ef605c898c9b71490321f2926d8 100644 (file)
@@ -5,7 +5,7 @@
     <group id="Basic">
       <feature
         id="Sketch"
-        nested="SketchPoint SketchLine SketchCircle SketchArc SketchConstraintLength SketchConstraintRadius SketchConstraintDistance SketchConstraintParallel SketchConstraintPerpendicular SketchConstraintRigid SketchConstraintHorizontal SketchConstraintVertical SketchConstraintEqual SketchConstraintTangent SketchConstraintFillet"
+        nested="SketchPoint SketchLine SketchCircle SketchArc SketchConstraintLength SketchConstraintRadius SketchConstraintDistance SketchConstraintParallel SketchConstraintPerpendicular SketchConstraintRigid SketchConstraintHorizontal SketchConstraintVertical SketchConstraintEqual SketchConstraintTangent SketchConstraintFillet SketchConstraintCoincidence"
         when_nested="accept abort"
         title="Sketch"
         tooltip="Create a new sketch"
     </group>
       
     <group id="Constraints">
-      <feature
-        id="SketchConstraintCoincidence"
-        title="Coincident"
-        tooltip="Create constraint for the coincidence of two points"
-        internal="1" />
     <!--  SketchConstraintDistance  -->
       <feature
         id="SketchConstraintDistance"
@@ -57,7 +52,7 @@
               label="First object"
               tooltip="Select point, line end point, line, center of circle or arc."
               shape_types="edge vertex">
-          <validator id="SketchPlugin_ShapeValidator" parameters="ConstraintEntityB"/>
+          <validator id="SketchPlugin_ExternalValidator" parameters="ConstraintEntityB"/>
           <validator id="GeomValidators_EdgeOrVertex"/>
         </sketch_shape_selector>/>
         <sketch_shape_selector 
@@ -67,7 +62,7 @@
           shape_types="edge vertex">
           <validator id="PartSet_DifferentObjects"/>
           <validator id="SketchPlugin_DistanceAttr" parameters="ConstraintEntityA"/>
-          <validator id="SketchPlugin_ShapeValidator" parameters="ConstraintEntityA"/>
+          <validator id="SketchPlugin_ExternalValidator" parameters="ConstraintEntityA"/>
           <validator id="GeomValidators_EdgeOrVertex"/>
         </sketch_shape_selector>
  <!--
@@ -89,6 +84,7 @@
         
         <validator id="PartSet_DistanceValidator"/>
       </feature>
+      
     <!--  SketchConstraintLength  -->      
       <feature id="SketchConstraintLength" title="Length" tooltip="Set fixed length of a line segment" icon=":icons/length.png">
         <label title="Select a line on which to calculate length" tooltip="Select a line on which to calculate length"/>
         </doublevalue_editor>
         <validator id="PartSet_LengthValidator"/>
       </feature>
+      
     <!--  SketchConstraintRadius  -->
       <feature id="SketchConstraintRadius" title="Radius" tooltip="Set fixed radius of a circle or an arc" icon=":icons/radius_constr.png">
         <label title="Select a circle or an arc on which to calculate radius" tooltip="Select a circle or an arc on which to calculate radius"/>
         <doublevalue_editor label="Value" tooltip="Radius" id="ConstraintValue" default="computed"/>
         <validator id="PartSet_RadiusValidator"/>
       </feature>
+      
     <!--  SketchConstraintParallel  -->
       <feature id="SketchConstraintParallel" title="Parallel" tooltip="Create constraint defining two parallel lines" icon=":icons/parallel.png">
         <sketch_constraint_shape_selector id="ConstraintEntityA" 
             label="First line" tooltip="Select a line" shape_types="edge">
             <validator id="GeomValidators_Edge" parameters="line"/>
-            <validator id="SketchPlugin_ShapeValidator" parameters="ConstraintEntityB"/>
+            <validator id="SketchPlugin_ExternalValidator" parameters="ConstraintEntityB"/>
         </sketch_constraint_shape_selector>
         
         <sketch_constraint_shape_selector id="ConstraintEntityB" label="Last line" tooltip="Select a line" 
             shape_types="edge">
             <validator id="GeomValidators_Edge" parameters="line"/>
             <validator id="PartSet_DifferentObjects"/>
-            <validator id="SketchPlugin_ShapeValidator" parameters="ConstraintEntityA"/>
+            <validator id="SketchPlugin_ExternalValidator" parameters="ConstraintEntityA"/>
         </sketch_constraint_shape_selector>
         
 <!--  
 -->
         <validator id="PartSet_ParallelValidator"/>
       </feature>
+      
     <!--  SketchConstraintPerpendicular  -->
       <feature id="SketchConstraintPerpendicular" title="Perpendicular" 
         tooltip="Create constraint defining two perpendicular lines" 
         <sketch_constraint_shape_selector id="ConstraintEntityA" 
             label="First line" tooltip="Select an line" 
             shape_types="edge">
-          <validator id="SketchPlugin_ShapeValidator" parameters="ConstraintEntityB"/>
+          <validator id="SketchPlugin_ExternalValidator" parameters="ConstraintEntityB"/>
             <validator id="GeomValidators_Edge" parameters="line"/>
         </sketch_constraint_shape_selector>
         
             label="Last line" tooltip="Select an line" 
             shape_types="edge">
             <validator id="PartSet_DifferentObjects"/>
-          <validator id="SketchPlugin_ShapeValidator" parameters="ConstraintEntityA"/>
+          <validator id="SketchPlugin_ExternalValidator" parameters="ConstraintEntityA"/>
             <validator id="GeomValidators_Edge" parameters="line"/>
         </sketch_constraint_shape_selector>
 <!--  
 -->
         <validator id="PartSet_PerpendicularValidator"/>
       </feature>
-    <!--  SketchConstraintRigid  -->
+
+      <!--  SketchConstraintCoincedence  -->
+      <feature id="SketchConstraintCoincidence" title="Coincident" tooltip="Create constraint for the coincidence of two points" icon=":icons/coincedence.png">
+        <sketch_shape_selector id="ConstraintEntityA" label="First point" tooltip="Select a first point" shape_types="vertex"/>
+        <sketch_shape_selector id="ConstraintEntityB" label="Second point" tooltip="Select a second point" shape_types="vertex">
+          <validator id="PartSet_DifferentObjects"/>
+        </sketch_shape_selector>
+      </feature>
+
+      <!--  SketchConstraintRigid  -->
       <feature id="SketchConstraintRigid" title="Fixed" tooltip="Fix an object" icon=":icons/fixed.png">
         <shape_selector id="ConstraintEntityA" label="Object" tooltip="Select an object" 
             shape_types="edge vertex">
         </shape_selector>
         <validator id="PartSet_RigidValidator"/>
       </feature>
+      
     <!--  SketchConstraintHorizontal  -->
       <feature id="SketchConstraintHorizontal" title="Horizontal" tooltip="Create constraint defining horizontal line" icon=":icons/horisontal.png">
         <sketch_constraint_shape_selector id="ConstraintEntityA" 
             <validator id="GeomValidators_Edge" parameters="line"/>
         </sketch_constraint_shape_selector>
       </feature>
+      
     <!--  SketchConstraintVertical  -->
       <feature id="SketchConstraintVertical" title="Vertical" tooltip="Create constraint defining vertical line" icon=":icons/vertical.png">
         <sketch_constraint_shape_selector id="ConstraintEntityA" 
             <validator id="GeomValidators_Edge" parameters="line"/>
         </sketch_constraint_shape_selector>
       </feature>
+      
     <!--  SketchConstraintEqual  -->
       <feature id="SketchConstraintEqual" title="Equal" tooltip="Create constraint defining equality of two objects" icon=":icons/equal.png">
         <sketch_constraint_shape_selector id="ConstraintEntityA" 
             label="Last object" tooltip="Select line, circle or arc" shape_types="edge">
         </sketch_constraint_shape_selector>
       </feature>
+      
     <!--  SketchConstraintTangent  -->
       <feature id="SketchConstraintTangent" title="Tangent" tooltip="Create constraint defining tangency of two objects" icon=":icons/tangent.png">
         <sketch_constraint_shape_selector id="ConstraintEntityA" 
             label="Last object" tooltip="Select line or arc" shape_types="edge">
         </sketch_constraint_shape_selector>
       </feature>
+      
     <!--  SketchConstraintMirror  -->
       <feature
         id="SketchConstraintMirror"
         tooltip="Create constraint mirroring group of objects"
         internal="1" />
     </group>
+    
     <group id="Edit">
       <!--  SketchConstraintFillet  -->
       <feature id="SketchConstraintFillet" title="Fillet" tooltip="Create constraint defining fillet between two objects" icon=":icons/fillet.png">
index 9f845f57fc0d2ff8b160fb1174206ca0bf5662c0..2c575e1a3261fbd5a26c1b8415b896e70ea40731 100644 (file)
@@ -62,7 +62,9 @@ std::shared_ptr<GeomAPI_Pnt2d> getPoint(SketchPlugin_Constraint* theFeature,
   else if (anAttr->attr()) {
     aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttr->attr());
   }
-  return aPointAttr->pnt();
+  if (aPointAttr.get() != NULL)
+    return aPointAttr->pnt();
+  return std::shared_ptr<GeomAPI_Pnt2d>();
 }