]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix problem with sequential drawing of ellipses.
authorazv <azv@opencascade.com>
Mon, 7 Oct 2019 10:10:59 +0000 (13:10 +0300)
committerazv <azv@opencascade.com>
Mon, 7 Oct 2019 10:10:59 +0000 (13:10 +0300)
src/SketchAPI/SketchAPI_MacroEllipse.cpp
src/SketchAPI/SketchAPI_MacroEllipse.h
src/SketchPlugin/SketchPlugin_MacroEllipse.cpp
src/SketchPlugin/SketchPlugin_MacroEllipse.h
src/SketchPlugin/plugin-Sketch.xml

index 97138d4135647401599f5892e60bbf1de1713db3..9700e1e375644bb565a644febe4c07b82739339b 100644 (file)
 
 #include <SketchPlugin_Sketch.h>
 
-#define MAJOR_AXIS_NEGATIVE (std::dynamic_pointer_cast<GeomDataAPI_Point2D>( \
-                             feature()->attribute(SketchPlugin_MacroEllipse::FIRST_POINT_ID())))
-#define MAJOR_AXIS_POSITIVE (std::dynamic_pointer_cast<GeomDataAPI_Point2D>( \
-                             feature()->attribute(SketchPlugin_MacroEllipse::SECOND_POINT_ID())))
-#define PASSED_POINT (std::dynamic_pointer_cast<GeomDataAPI_Point2D>( \
-                      feature()->attribute(SketchPlugin_MacroEllipse::PASSED_POINT_ID())))
-
-#define MAJOR_AXIS_NEGATIVE_REF (feature()->refattr( \
-                                 SketchPlugin_MacroEllipse::FIRST_POINT_REF_ID()))
-#define MAJOR_AXIS_POSITIVE_REF (feature()->refattr( \
-                                 SketchPlugin_MacroEllipse::SECOND_POINT_REF_ID()))
-#define PASSED_POINT_REF (feature()->refattr(SketchPlugin_MacroEllipse::PASSED_POINT_REF_ID()))
+#define POINT_ATTR(x) (std::dynamic_pointer_cast<GeomDataAPI_Point2D>(feature()->attribute((x))))
+#define POINT_REF(x)  (feature()->refattr((x)))
 
 
 SketchAPI_MacroEllipse::SketchAPI_MacroEllipse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
@@ -58,12 +48,16 @@ SketchAPI_MacroEllipse::SketchAPI_MacroEllipse(const std::shared_ptr<ModelAPI_Fe
   : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
+    static const ModelHighAPI_RefAttr DUMMY_REF;
+
+    GeomPnt2dPtr aPnt1(new GeomAPI_Pnt2d(theX1, theY1));
+    GeomPnt2dPtr aPnt2(new GeomAPI_Pnt2d(theX2, theY2));
+    GeomPnt2dPtr aPnt3(new GeomAPI_Pnt2d(theX3, theY3));
+
     if (byCenter)
-      setByCenterAndPassedPoints();
+      setByCenterAndPassedPoints(aPnt1, DUMMY_REF, aPnt2, DUMMY_REF, aPnt3, DUMMY_REF);
     else
-      setByMajorAxisAndPassedPoint();
-
-    initializePoints(theX1, theY1, theX2, theY2, theX3, theY3);
+      setByMajorAxisAndPassedPoint(aPnt1, DUMMY_REF, aPnt2, DUMMY_REF, aPnt3, DUMMY_REF);
   }
 }
 
@@ -75,12 +69,14 @@ SketchAPI_MacroEllipse::SketchAPI_MacroEllipse(const std::shared_ptr<ModelAPI_Fe
   : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
+    static const ModelHighAPI_RefAttr DUMMY_REF;
     if (byCenter)
-      setByCenterAndPassedPoints();
-    else
-      setByMajorAxisAndPassedPoint();
-
-    initializePoints(thePoint1, thePoint2, thePoint3);
+      setByCenterAndPassedPoints(thePoint1, DUMMY_REF, thePoint2, DUMMY_REF, thePoint3, DUMMY_REF);
+    else {
+      setByMajorAxisAndPassedPoint(thePoint1, DUMMY_REF,
+                                   thePoint2, DUMMY_REF,
+                                   thePoint3, DUMMY_REF);
+    }
   }
 }
 
@@ -95,12 +91,16 @@ SketchAPI_MacroEllipse::SketchAPI_MacroEllipse(const std::shared_ptr<ModelAPI_Fe
   : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
-    if (byCenter)
-      setByCenterAndPassedPoints();
-    else
-      setByMajorAxisAndPassedPoint();
-
-    initializePoints(thePoint1, thePoint1Ref, thePoint2, thePoint2Ref, thePoint3, thePoint3Ref);
+    if (byCenter) {
+      setByCenterAndPassedPoints(thePoint1, thePoint1Ref,
+                                 thePoint2, thePoint2Ref,
+                                 thePoint3, thePoint3Ref);
+    }
+    else {
+      setByMajorAxisAndPassedPoint(thePoint1, thePoint1Ref,
+                                   thePoint2, thePoint2Ref,
+                                   thePoint3, thePoint3Ref);
+    }
   }
 }
 
@@ -108,40 +108,6 @@ SketchAPI_MacroEllipse::~SketchAPI_MacroEllipse()
 {
 }
 
-void SketchAPI_MacroEllipse::setByCenterAndPassedPoints()
-{
-  fillAttribute(SketchPlugin_MacroEllipse::ELLIPSE_TYPE_BY_CENTER_AXIS_POINT(), myellipseType);
-}
-
-void SketchAPI_MacroEllipse::setByMajorAxisAndPassedPoint()
-{
-  fillAttribute(SketchPlugin_MacroEllipse::ELLIPSE_TYPE_BY_AXIS_AND_POINT(), myellipseType);
-}
-
-void SketchAPI_MacroEllipse::initializePoints(double theX1, double theY1,
-                                              double theX2, double theY2,
-                                              double theX3, double theY3)
-{
-  fillAttribute(MAJOR_AXIS_NEGATIVE, theX1, theY1);
-  fillAttribute(MAJOR_AXIS_POSITIVE, theX2, theY2);
-  fillAttribute(PASSED_POINT, theX3, theY3);
-
-  storeSketch(feature());
-  execute();
-}
-
-void SketchAPI_MacroEllipse::initializePoints(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
-                                              const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
-                                              const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
-{
-  fillAttribute(thePoint1, MAJOR_AXIS_NEGATIVE);
-  fillAttribute(thePoint2, MAJOR_AXIS_POSITIVE);
-  fillAttribute(thePoint3, PASSED_POINT);
-
-  storeSketch(feature());
-  execute();
-}
-
 static void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint,
                           const ModelHighAPI_RefAttr& thePointRef,
                           std::shared_ptr<GeomDataAPI_Point2D> thePointAttr,
@@ -158,20 +124,58 @@ static void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint,
   fillAttribute(aPoint, thePointAttr);
 }
 
-void SketchAPI_MacroEllipse::initializePoints(
-    const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisPoint1,
-    const ModelHighAPI_RefAttr&           theMajorAxisPoint1Ref,
-    const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisPoint2,
-    const ModelHighAPI_RefAttr&           theMajorAxisPoint2Ref,
+void SketchAPI_MacroEllipse::setByCenterAndPassedPoints(
+    const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+    const ModelHighAPI_RefAttr&           theCenterRef,
+    const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisPoint,
+    const ModelHighAPI_RefAttr&           theMajorAxisPointRef,
     const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
     const ModelHighAPI_RefAttr&           thePassedPointRef)
 {
-  fillAttribute(theMajorAxisPoint1, theMajorAxisPoint1Ref,
-                MAJOR_AXIS_NEGATIVE, MAJOR_AXIS_NEGATIVE_REF);
-  fillAttribute(theMajorAxisPoint2, theMajorAxisPoint2Ref,
-                MAJOR_AXIS_POSITIVE, MAJOR_AXIS_POSITIVE_REF);
-  fillAttribute(thePassedPoint, thePassedPointRef,
-                PASSED_POINT, PASSED_POINT_REF);
+  fillAttribute(SketchPlugin_MacroEllipse::ELLIPSE_TYPE_BY_CENTER_AXIS_POINT(), myellipseType);
+
+  AttributePoint2DPtr aCenterAttr = POINT_ATTR(SketchPlugin_MacroEllipse::CENTER_POINT_ID());
+  AttributePoint2DPtr aMajorAxisAttr = POINT_ATTR(SketchPlugin_MacroEllipse::MAJOR_AXIS_POINT_ID());
+  AttributePoint2DPtr aPassedAttr = POINT_ATTR(SketchPlugin_MacroEllipse::PASSED_POINT_ID());
+
+  AttributeRefAttrPtr aCenterRef = POINT_REF(SketchPlugin_MacroEllipse::CENTER_POINT_REF_ID());
+  AttributeRefAttrPtr aMajorAxisRef =
+      POINT_REF(SketchPlugin_MacroEllipse::MAJOR_AXIS_POINT_REF_ID());
+  AttributeRefAttrPtr aPassedRef = POINT_REF(SketchPlugin_MacroEllipse::PASSED_POINT_REF_ID());
+
+  fillAttribute(theCenter, theCenterRef, aCenterAttr, aCenterRef);
+  fillAttribute(theMajorAxisPoint, theMajorAxisPointRef, aMajorAxisAttr, aMajorAxisRef);
+  fillAttribute(thePassedPoint, thePassedPointRef, aPassedAttr, aPassedRef);
+
+  storeSketch(feature());
+  execute();
+}
+
+void SketchAPI_MacroEllipse::setByMajorAxisAndPassedPoint(
+    const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisStart,
+    const ModelHighAPI_RefAttr&           theMajorAxisStartRef,
+    const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisEnd,
+    const ModelHighAPI_RefAttr&           theMajorAxisEndRef,
+    const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
+    const ModelHighAPI_RefAttr&           thePassedPointRef)
+{
+  fillAttribute(SketchPlugin_MacroEllipse::ELLIPSE_TYPE_BY_AXIS_AND_POINT(), myellipseType);
+
+  AttributePoint2DPtr aMajorAxisStartAttr =
+      POINT_ATTR(SketchPlugin_MacroEllipse::MAJOR_AXIS_START_ID());
+  AttributePoint2DPtr aMajorAxisEndAttr =
+      POINT_ATTR(SketchPlugin_MacroEllipse::MAJOR_AXIS_END_ID());
+  AttributePoint2DPtr aPassedAttr = POINT_ATTR(SketchPlugin_MacroEllipse::PASSED_POINT_1_ID());
+
+  AttributeRefAttrPtr aMajorAxisStartRef =
+      POINT_REF(SketchPlugin_MacroEllipse::MAJOR_AXIS_START_REF_ID());
+  AttributeRefAttrPtr aMajorAxisEndRef =
+      POINT_REF(SketchPlugin_MacroEllipse::MAJOR_AXIS_END_REF_ID());
+  AttributeRefAttrPtr aPassedRef = POINT_REF(SketchPlugin_MacroEllipse::PASSED_POINT_1_REF_ID());
+
+  fillAttribute(theMajorAxisStart, theMajorAxisStartRef, aMajorAxisStartAttr, aMajorAxisStartRef);
+  fillAttribute(theMajorAxisEnd, theMajorAxisEndRef, aMajorAxisEndAttr, aMajorAxisEndRef);
+  fillAttribute(thePassedPoint, thePassedPointRef, aPassedAttr, aPassedRef);
 
   storeSketch(feature());
   execute();
index 8f0e88d83d605c03e30172a61b1b19a163f3261b..bc2ab1333a01e8ba68ae055c331e6174179dac37 100644 (file)
@@ -100,27 +100,19 @@ protected:
 
 private:
   /// Set flag of creation by center, major semi-axis and passed point.
-  void setByCenterAndPassedPoints();
+  void setByCenterAndPassedPoints(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+                                  const ModelHighAPI_RefAttr&           theCenterRef,
+                                  const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisPoint,
+                                  const ModelHighAPI_RefAttr&           theMajorAxisPointRef,
+                                  const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
+                                  const ModelHighAPI_RefAttr&           thePassedPointRef);
   /// Set flag of creation by major axis and passed point.
-  void setByMajorAxisAndPassedPoint();
-
-  /// Set points of ellipse.
-  void initializePoints(double theMajorAxisX1, double theMajorAxisY1,
-                        double theMajorAxisX2, double theMajorAxisY2,
-                        double thePassedX, double thePassedY);
-
-  /// Set points of ellipse.
-  void initializePoints(const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisPoint1,
-                        const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisPoint2,
-                        const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint);
-
-  /// Set points of ellipse.
-  void initializePoints(const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisPoint1,
-                        const ModelHighAPI_RefAttr&           theMajorAxisPoint1Ref,
-                        const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisPoint2,
-                        const ModelHighAPI_RefAttr&           theMajorAxisPoint2Ref,
-                        const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
-                        const ModelHighAPI_RefAttr&           thePassedPointRef);
+  void setByMajorAxisAndPassedPoint(const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisStart,
+                                    const ModelHighAPI_RefAttr&           theMajorAxisStartRef,
+                                    const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisEnd,
+                                    const ModelHighAPI_RefAttr&           theMajorAxisEndRef,
+                                    const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
+                                    const ModelHighAPI_RefAttr&           thePassedPointRef);
 
   /// Collect auxiliary features
   void collectAuxiliary();
index a4abe7b7dd3a05eea839bfcd3bb2a0fb00990891..53e605717b1efb858ae8b5229691d6a6fcd915f1 100644 (file)
@@ -57,22 +57,32 @@ void SketchPlugin_MacroEllipse::initAttributes()
   data()->addAttribute(ELLIPSE_TYPE(), ModelAPI_AttributeString::typeId());
   data()->addAttribute(EDIT_ELLIPSE_TYPE(), ModelAPI_AttributeString::typeId());
 
-  data()->addAttribute(FIRST_POINT_ID(), GeomDataAPI_Point2D::typeId());
-  data()->addAttribute(FIRST_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId());
-  data()->addAttribute(SECOND_POINT_ID(), GeomDataAPI_Point2D::typeId());
-  data()->addAttribute(SECOND_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId());
+  data()->addAttribute(CENTER_POINT_ID(), GeomDataAPI_Point2D::typeId());
+  data()->addAttribute(CENTER_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId());
+  data()->addAttribute(MAJOR_AXIS_POINT_ID(), GeomDataAPI_Point2D::typeId());
+  data()->addAttribute(MAJOR_AXIS_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId());
   data()->addAttribute(PASSED_POINT_ID(), GeomDataAPI_Point2D::typeId());
   data()->addAttribute(PASSED_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId());
 
+  data()->addAttribute(MAJOR_AXIS_START_ID(), GeomDataAPI_Point2D::typeId());
+  data()->addAttribute(MAJOR_AXIS_START_REF_ID(), ModelAPI_AttributeRefAttr::typeId());
+  data()->addAttribute(MAJOR_AXIS_END_ID(), GeomDataAPI_Point2D::typeId());
+  data()->addAttribute(MAJOR_AXIS_END_REF_ID(), ModelAPI_AttributeRefAttr::typeId());
+  data()->addAttribute(PASSED_POINT_1_ID(), GeomDataAPI_Point2D::typeId());
+  data()->addAttribute(PASSED_POINT_1_REF_ID(), ModelAPI_AttributeRefAttr::typeId());
+
   data()->addAttribute(MAJOR_RADIUS_ID(), ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(MINOR_RADIUS_ID(), ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(AUXILIARY_ID(), ModelAPI_AttributeBoolean::typeId());
 
   string(EDIT_ELLIPSE_TYPE())->setValue("");
 
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FIRST_POINT_REF_ID());
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SECOND_POINT_REF_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CENTER_POINT_REF_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MAJOR_AXIS_POINT_REF_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), PASSED_POINT_REF_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MAJOR_AXIS_START_REF_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), MAJOR_AXIS_END_REF_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), PASSED_POINT_1_REF_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EDIT_ELLIPSE_TYPE());
 }
 
@@ -100,12 +110,25 @@ void SketchPlugin_MacroEllipse::execute()
 void SketchPlugin_MacroEllipse::attributeChanged(const std::string& theID)
 {
   static const int NB_POINTS = 3;
-  std::string aPointAttrName[NB_POINTS] = { FIRST_POINT_ID(),
-                                            SECOND_POINT_ID(),
-                                            PASSED_POINT_ID() };
-  std::string aPointRefName[NB_POINTS] = { FIRST_POINT_REF_ID(),
-                                           SECOND_POINT_REF_ID(),
-                                           PASSED_POINT_REF_ID() };
+  std::string aPointAttrName[NB_POINTS];
+  std::string aPointRefName[NB_POINTS];
+  if (string(ELLIPSE_TYPE())->value() == ELLIPSE_TYPE_BY_CENTER_AXIS_POINT()) {
+    aPointAttrName[0] = CENTER_POINT_ID();
+    aPointAttrName[1] = MAJOR_AXIS_POINT_ID();
+    aPointAttrName[2] = PASSED_POINT_ID();
+    aPointRefName[0] = CENTER_POINT_REF_ID();
+    aPointRefName[1] = MAJOR_AXIS_POINT_REF_ID();
+    aPointRefName[2] = PASSED_POINT_REF_ID();
+  } else if (string(ELLIPSE_TYPE())->value() == ELLIPSE_TYPE_BY_AXIS_AND_POINT()) {
+    aPointAttrName[0] = MAJOR_AXIS_START_ID();
+    aPointAttrName[1] = MAJOR_AXIS_END_ID();
+    aPointAttrName[2] = PASSED_POINT_1_ID();
+    aPointRefName[0] = MAJOR_AXIS_START_REF_ID();
+    aPointRefName[1] = MAJOR_AXIS_END_REF_ID();
+    aPointRefName[2] = PASSED_POINT_1_REF_ID();
+  }
+  else
+    return;
 
   // type of ellipse switched, thus reset all attributes
   if (theID == ELLIPSE_TYPE()) {
@@ -195,8 +218,12 @@ std::string SketchPlugin_MacroEllipse::processEvent(
     std::shared_ptr<GeomAPI_Pnt2d> aClickedPoint = aReentrantMessage->clickedPoint();
 
     if (aClickedPoint && (anObject || anAttribute)) {
-      aFilledAttributeName = FIRST_POINT_ID();
-      std::string aReferenceAttributeName = FIRST_POINT_REF_ID();
+      aFilledAttributeName = CENTER_POINT_ID();
+      std::string aReferenceAttributeName = CENTER_POINT_REF_ID();
+      if (anEllipseType == ELLIPSE_TYPE_BY_AXIS_AND_POINT()) {
+        aFilledAttributeName = MAJOR_AXIS_START_ID();
+        aReferenceAttributeName = MAJOR_AXIS_START_REF_ID();
+      }
 
       // fill 2d point attribute
       AttributePoint2DPtr aPointAttr =
@@ -208,7 +235,7 @@ std::string SketchPlugin_MacroEllipse::processEvent(
           std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(attribute(aReferenceAttributeName));
       if (anAttribute) {
         if (!anAttribute->owner() || !anAttribute->owner()->data()->isValid()) {
-          if (aCreatedFeature && anAttribute->id() == FIRST_POINT_ID())
+          if (aCreatedFeature && anAttribute->id() == CENTER_POINT_ID())
             anAttribute = aCreatedFeature->attribute(
                 anEllipseType == ELLIPSE_TYPE_BY_CENTER_AXIS_POINT() ?
                 SketchPlugin_Ellipse::CENTER_ID() :
@@ -237,11 +264,11 @@ void SketchPlugin_MacroEllipse::constraintsForEllipseByCenterAxisAndPassed(
   static const bool isTangencyApplicable = false;
   // Create constraints.
   SketchPlugin_Tools::createCoincidenceOrTangency(
-      this, FIRST_POINT_REF_ID(),
+      this, CENTER_POINT_REF_ID(),
       theEllipseFeature->attribute(SketchPlugin_Ellipse::CENTER_ID()),
       ObjectPtr(), isTangencyApplicable);
   SketchPlugin_Tools::createCoincidenceOrTangency(
-      this, SECOND_POINT_REF_ID(),
+      this, MAJOR_AXIS_POINT_REF_ID(),
       theEllipseFeature->attribute(SketchPlugin_Ellipse::MAJOR_AXIS_END_ID()),
       ObjectPtr(), isTangencyApplicable);
   // make coincidence only if PASSED_POINT_REF_ID() refers a point but not an object
@@ -259,17 +286,17 @@ void SketchPlugin_MacroEllipse::constraintsForEllipseByMajoxAxisAndPassed(
   static const bool isTangencyApplicable = false;
   // Create constraints.
   SketchPlugin_Tools::createCoincidenceOrTangency(
-      this, FIRST_POINT_REF_ID(),
+      this, MAJOR_AXIS_START_REF_ID(),
       theEllipseFeature->attribute(SketchPlugin_Ellipse::MAJOR_AXIS_START_ID()),
       ObjectPtr(), isTangencyApplicable);
   SketchPlugin_Tools::createCoincidenceOrTangency(
-      this, SECOND_POINT_REF_ID(),
+      this, MAJOR_AXIS_END_REF_ID(),
       theEllipseFeature->attribute(SketchPlugin_Ellipse::MAJOR_AXIS_END_ID()),
       ObjectPtr(), isTangencyApplicable);
   // make coincidence only if PASSED_POINT_REF_ID() refers a point but not an object
-  if (!refattr(PASSED_POINT_REF_ID())->isObject()) {
+  if (!refattr(PASSED_POINT_1_REF_ID())->isObject()) {
     SketchPlugin_Tools::createCoincidenceOrTangency(
-        this, PASSED_POINT_REF_ID(), AttributePtr(),
+        this, PASSED_POINT_1_REF_ID(), AttributePtr(),
         theEllipseFeature->lastResult(), isTangencyApplicable);
   }
 }
index 609d96bf6b0315532f56e35e8d12b9518498452e..f1a87525757a5f4c5f973c6a88f85fc801ef56c7 100644 (file)
@@ -67,28 +67,28 @@ class SketchPlugin_MacroEllipse: public SketchPlugin_SketchEntity,
   }
 
   /// Attribute for the first point selected during ellipse creation.
-  inline static const std::string& FIRST_POINT_ID()
+  inline static const std::string& CENTER_POINT_ID()
   {
     static const std::string ID("first_point");
     return ID;
   }
 
   /// Reference to the first selected point.
-  inline static const std::string& FIRST_POINT_REF_ID()
+  inline static const std::string& CENTER_POINT_REF_ID()
   {
     static const std::string ID("first_point_ref");
     return ID;
   }
 
   /// Attribute for the second point selected during ellipse creation.
-  inline static const std::string& SECOND_POINT_ID()
+  inline static const std::string& MAJOR_AXIS_POINT_ID()
   {
     static const std::string ID("second_point");
     return ID;
   }
 
   /// Reference to the second selected point.
-  inline static const std::string& SECOND_POINT_REF_ID()
+  inline static const std::string& MAJOR_AXIS_POINT_REF_ID()
   {
     static const std::string ID("second_point_ref");
     return ID;
@@ -108,6 +108,48 @@ class SketchPlugin_MacroEllipse: public SketchPlugin_SketchEntity,
     return ID;
   }
 
+  /// Attribute for the first point selected during ellipse creation.
+  inline static const std::string& MAJOR_AXIS_START_ID()
+  {
+    static const std::string ID("first_point_1");
+    return ID;
+  }
+
+  /// Reference to the first selected point.
+  inline static const std::string& MAJOR_AXIS_START_REF_ID()
+  {
+    static const std::string ID("first_point_ref_1");
+    return ID;
+  }
+
+  /// Attribute for the second point selected during ellipse creation.
+  inline static const std::string& MAJOR_AXIS_END_ID()
+  {
+    static const std::string ID("second_point_1");
+    return ID;
+  }
+
+  /// Reference to the second selected point.
+  inline static const std::string& MAJOR_AXIS_END_REF_ID()
+  {
+    static const std::string ID("second_point_ref_1");
+    return ID;
+  }
+
+  /// Attribute for the third point selected during ellipse creation.
+  inline static const std::string& PASSED_POINT_1_ID()
+  {
+    static const std::string ID("passed_point_1");
+    return ID;
+  }
+
+  /// Reference for passed point selection.
+  inline static const std::string& PASSED_POINT_1_REF_ID()
+  {
+    static const std::string ID("passed_point_ref_1");
+    return ID;
+  }
+
   /// Major radius of the ellipse
   inline static const std::string& MAJOR_RADIUS_ID()
   {
index 6acca9a92d3c6b873d2dceff9b811acd51df5dbe..1476a14926570dc655e341a8be0bb9b4a7d2b8ad 100644 (file)
           <box id="by_major_axis_and_point"
                icon="icons/Sketch/ellipse_axes_32x32.png"
                title="Major axis and passing point">
-            <sketch-2dpoint_selector id="first_point"
-                                     reference_attribute="first_point_ref"
+            <sketch-2dpoint_selector id="first_point_1"
+                                     reference_attribute="first_point_ref_1"
                                      title="Major axis start point"
                                      tooltip="Major axis start point coordinates"
                                      accept_expressions="0"
                                      enable_value="enable_by_preferences"/>
-            <sketch-2dpoint_selector id="second_point"
-                                     reference_attribute="second_point_ref"
+            <sketch-2dpoint_selector id="second_point_1"
+                                     reference_attribute="second_point_ref_1"
                                      title="Major axis end point"
                                      tooltip="Major axis end point coordinates"
                                      accept_expressions="0"
                                      enable_value="enable_by_preferences"/>
-            <sketch-2dpoint_selector id="passed_point"
-                                     reference_attribute="passed_point_ref"
+            <sketch-2dpoint_selector id="passed_point_1"
+                                     reference_attribute="passed_point_ref_1"
                                      title="Passed point"
                                      tooltip="Passed point coordinates"
                                      accept_expressions="0"