]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
bos#35152 [EDF] (2023-T1) Sketch Circle should allow user to position construction... eksu/35152 55/head
authorasozinov <alexey.sozinov@opencascade.com>
Fri, 23 Jun 2023 01:06:02 +0000 (02:06 +0100)
committerEkaterina Sukhareva <ekaterina.sukhareva@opencascade.com>
Mon, 13 May 2024 12:59:21 +0000 (13:59 +0100)
WIll be modified Sketch Circle feature: Current implementation provide possibility change sewing point and rotate this point
Sketch.addCircleWithPoint(CenterPoint, Radius, Angle)
Sketch.addCircleWithPoint(CenterPoint, PassedPoint, Angle)
Sketch.addCircleWithPoint(PassPoint1, PassPoint2, PassPoint3, Angle)

Get new point:
SketchCircle.createdPoint()

//Last modification (06/07/23):
change comment

21 files changed:
src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp
src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.h
src/SketchAPI/SketchAPI_Circle.cpp
src/SketchAPI/SketchAPI_Circle.h
src/SketchAPI/SketchAPI_MacroCircle.cpp
src/SketchAPI/SketchAPI_MacroCircle.h
src/SketchAPI/SketchAPI_Sketch.cpp
src/SketchAPI/SketchAPI_Sketch.h
src/SketchPlugin/SketchPlugin_Circle.cpp
src/SketchPlugin/SketchPlugin_Circle.h
src/SketchPlugin/SketchPlugin_MacroCircle.cpp
src/SketchPlugin/SketchPlugin_MacroCircle.h
src/SketchPlugin/SketchPlugin_msg_fr.ts
src/SketchPlugin/Test/TestCreateCircleByCenterAndPassed.py
src/SketchPlugin/Test/TestCreateCircleByThreePoints.py
src/SketchPlugin/Test/TestCreateCircleChangeType.py
src/SketchPlugin/doc/circleFeature.rst
src/SketchPlugin/doc/images/Circle_panel_3pt.png [changed mode: 0644->0755]
src/SketchPlugin/doc/images/Circle_panel_edit.png [changed mode: 0644->0755]
src/SketchPlugin/doc/images/Circle_panel_pt_rad.png [changed mode: 0644->0755]
src/SketchPlugin/plugin-Sketch.xml

index 0575a05251f1b9f879acf05487494bcf824353e1..3444bfb86f4f258ff57d763a610e21b30936ce79 100644 (file)
@@ -162,12 +162,16 @@ std::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::cylinderAxis(
 
 std::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::lineCircle(
     std::shared_ptr<GeomAPI_Pnt> theCenter, std::shared_ptr<GeomAPI_Dir> theNormal,
-    double theRadius)
+    double theRadius, double theRotationAngle)
 {
   const gp_Pnt& aCenter = theCenter->impl<gp_Pnt>();
   const gp_Dir& aDir = theNormal->impl<gp_Dir>();
 
+  gp_Ax1 anAx(aCenter, aDir);
+
   gp_Circ aCircle(gp_Ax2(aCenter, aDir), theRadius);
+  if (Abs(theRotationAngle) > Precision::Confusion()) // Tolerance
+    aCircle.Rotate(anAx, theRotationAngle);
 
   BRepBuilderAPI_MakeEdge anEdgeBuilder(aCircle);
   std::shared_ptr<GeomAPI_Edge> aRes(new GeomAPI_Edge);
index 37e0128a5521876ec5a2097151fa4dc3ab03d670..63e4601d839aec4ae99cda5cb4cc998d24d6a6c4 100644 (file)
@@ -65,7 +65,8 @@ class GEOMALGOAPI_EXPORT GeomAlgoAPI_EdgeBuilder
   /// Creates linear edge in a form of a circle by a point and a circle radius
   static std::shared_ptr<GeomAPI_Edge> lineCircle(std::shared_ptr<GeomAPI_Pnt> theCenter,
                                                     std::shared_ptr<GeomAPI_Dir> theNormal,
-                                                    double theRadius);
+                                                    double theRadius,
+                                                    double theRotationAngle = 0.);
 
   /// Creates linear edge in a form of a circle by GeomAPI_Circle
   static std::shared_ptr<GeomAPI_Edge> lineCircle(std::shared_ptr<GeomAPI_Circ> theCircle);
index 8b99eea1212f6c50bf2efc3b960cda81e9cbd55a..f05936c7072e54f9e9930e509e207f5946dd1a42 100644 (file)
@@ -26,6 +26,9 @@
 #include <ModelHighAPI_Selection.h>
 #include <ModelHighAPI_Tools.h>
 
+#include <SketchAPI_Point.h>
+#include <SketchPlugin_ConstraintCoincidenceInternal.h>
+
 //==================================================================================================
 SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature> & theFeature)
 : SketchAPI_SketchEntity(theFeature)
@@ -37,22 +40,26 @@ SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature> & the
 SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                    double theCenterX,
                                    double theCenterY,
-                                   double theRadius)
+                                   double theRadius,
+                                   bool theIsAddPoint,
+                                   double theAngle)
 : SketchAPI_SketchEntity(theFeature)
 {
   if(initialize()) {
-    setByCenterAndRadius(theCenterX, theCenterY, theRadius);
+    setByCenterAndRadius(theCenterX, theCenterY, theRadius, theIsAddPoint, theAngle);
   }
 }
 
 //==================================================================================================
 SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                    const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
-                                   double theRadius)
+                                   double theRadius,
+                                   bool theIsAddPoint,
+                                   double theAngle)
 : SketchAPI_SketchEntity(theFeature)
 {
   if(initialize()) {
-    setByCenterAndRadius(theCenter, theRadius);
+    setByCenterAndRadius(theCenter, theRadius, theAngle);
   }
 }
 
@@ -83,22 +90,31 @@ SketchAPI_Circle::~SketchAPI_Circle()
 }
 
 //==================================================================================================
-void SketchAPI_Circle::setByCenterAndRadius(double theCenterX, double theCenterY, double theRadius)
+void SketchAPI_Circle::setByCenterAndRadius(double theCenterX, double theCenterY,
+                                            double theRadius, bool theIsAddPoint,
+                                            double theAngle)
 {
   fillAttribute(center(), theCenterX, theCenterY);
   fillAttribute(theRadius, myradius);
+  fillAttribute(theIsAddPoint, myaddpoint);
+  fillAttribute(theAngle, myangle);
 
   execute();
+  //createPoint();
 }
 
 //==================================================================================================
 void SketchAPI_Circle::setByCenterAndRadius(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
-                                            double theRadius)
+                                            double theRadius, bool theIsAddPoint,
+                                            double theAngle)
 {
   fillAttribute(theCenter, mycenter);
   fillAttribute(theRadius, myradius);
+  fillAttribute(theIsAddPoint, myaddpoint);
+  fillAttribute(theAngle, myangle);
 
   execute();
+  //createPoint();
 }
 
 //==================================================================================================
@@ -141,6 +157,38 @@ void SketchAPI_Circle::setRadius(double theRadius)
   execute();
 }
 
+//==================================================================================================
+void SketchAPI_Circle::setIsToAddPoint(bool theIsToAddPoint)
+{
+  fillAttribute(theIsToAddPoint, myaddpoint);
+
+  execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setAngle(double theAngle)
+{
+  fillAttribute(ModelHighAPI_Double(theAngle), myangle);
+
+  execute();
+}
+
+//==================================================================================================
+// Return created point
+std::shared_ptr<SketchAPI_SketchEntity> SketchAPI_Circle::createdPoint() const
+{
+  AttributeReferencePtr anRef = feature()->reference(SketchPlugin_Circle::CONSTRUCTION_POINT_REF_ID());
+  if (!anRef->isInitialized())
+    return {};
+
+  FeaturePtr aFeature = ModelAPI_Feature::feature(anRef->value());
+  if (aFeature && aFeature->getKind() == SketchPlugin_Point::ID())
+  {
+    return std::shared_ptr < SketchAPI_SketchEntity>(new SketchAPI_Point(aFeature));
+  }
+  return {};
+}
+
 //==================================================================================================
 void SketchAPI_Circle::dump(ModelHighAPI_Dumper& theDumper) const
 {
@@ -150,14 +198,35 @@ void SketchAPI_Circle::dump(ModelHighAPI_Dumper& theDumper) const
   FeaturePtr aBase = feature();
   const std::string& aSketchName = theDumper.parentName(aBase);
 
+  const bool isToAddPoint = addpoint()->value();
+
   AttributeSelectionPtr anExternal = aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID());
   if (anExternal->context()) {
     // circle is external
-    theDumper << aBase << " = " << aSketchName << ".addCircle(" << anExternal << ")" << std::endl;
-  } else {
+    if(isToAddPoint)
+    {
+      theDumper << aBase << " = " << aSketchName << ".addCircleWithPoint(" << anExternal << ")" << std::endl;
+    }
+    else
+    {
+      theDumper << aBase << " = " << aSketchName << ".addCircle(" << anExternal << ")" << std::endl;
+    }
+  }
+  else {
     // circle given by center and radius
-    theDumper << aBase << " = " << aSketchName << ".addCircle("
+    if(isToAddPoint)
+    {
+      theDumper << aBase << " = " << aSketchName << ".addCircleWithPoint(" << center() << ", " << radius();
+      theDumper << ", " << angle() << ")" << std::endl;
+      std::shared_ptr<SketchAPI_SketchEntity> aPoint = createdPoint();
+      if (aPoint)
+        theDumper << aPoint->feature() << " = " << theDumper.name(aBase) << ".createdPoint()" << std::endl;
+    }
+    else
+    {
+      theDumper << aBase << " = " << aSketchName << ".addCircle("
               << center() << ", " << radius() << ")" << std::endl;
+    }
   }
   // dump "auxiliary" flag if necessary
   SketchAPI_SketchEntity::dump(theDumper);
index 515e82c56fbdd12920cfaac6796ad9c8f2c97c63..681a6123a89f50921c69d07b0e9b6082419b9f75 100644 (file)
@@ -42,13 +42,17 @@ public:
   SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                    double theCenterX,
                    double theCenterY,
-                   double theRadius);
+                   double theRadius,
+                   bool theIsAddPoint = false,
+                   double theAngle = 0.0);
 
   /// Constructor with values.
   SKETCHAPI_EXPORT
   SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                    const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
-                   double theRadius);
+                   double theRadius,
+                   bool theIsAddPoint = false,
+                   double theAngle = 0.0);
 
   /// Constructor with values.
   SKETCHAPI_EXPORT
@@ -64,21 +68,31 @@ public:
   SKETCHAPI_EXPORT
   virtual ~SketchAPI_Circle();
 
-  INTERFACE_3(SketchPlugin_Circle::ID(),
+  INTERFACE_5(SketchPlugin_Circle::ID(),
               center, SketchPlugin_Circle::CENTER_ID(),
               GeomDataAPI_Point2D, /** Center point */,
               radius, SketchPlugin_Circle::RADIUS_ID(),
               ModelAPI_AttributeDouble, /** Radius */,
               external, SketchPlugin_Circle::EXTERNAL_ID(),
-              ModelAPI_AttributeSelection, /** External */)
+              ModelAPI_AttributeSelection, /** External */,
+              angle, SketchPlugin_Circle::ANGLE_ID(),
+              ModelAPI_AttributeDouble, /** Angle */,
+              addpoint, SketchPlugin_Circle::ADD_CONSTRUCTION_POINT_ID(),
+              ModelAPI_AttributeBoolean, /** Is to add point */)
 
   /// Set by center and radius.
   SKETCHAPI_EXPORT
-  void setByCenterAndRadius(double theCenterX, double theCenterY, double theRadius);
+  void setByCenterAndRadius(double theCenterX, double theCenterY,
+                            double theRadius, 
+                            bool theIsAddPoint = false,
+                            double theAngle = 0.0);
 
   /// Set by center and radius.
   SKETCHAPI_EXPORT
-  void setByCenterAndRadius(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter, double theRadius);
+  void setByCenterAndRadius(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+                            double theRadius, 
+                            bool theIsAddPoint = false,
+                            double theAngle = 0.0);
 
   /// Set by external.
   SKETCHAPI_EXPORT
@@ -100,9 +114,24 @@ public:
   SKETCHAPI_EXPORT
   void setRadius(double theRadius);
 
+  /// Set angle.
+  SKETCHAPI_EXPORT
+  void setAngle(double theAngle);
+
+  /// Set is to add point.
+  SKETCHAPI_EXPORT
+  void setIsToAddPoint(bool theIsToAddPoint);
+
+  /// Returns created points on circle
+  SKETCHAPI_EXPORT
+  std::shared_ptr<SketchAPI_SketchEntity> createdPoint() const;
+
   /// Dump wrapped feature
   SKETCHAPI_EXPORT
   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+
+private:
+  void createPoint();
 };
 
 /// Pointer on Circle object.
index 71e62a4adae5023ddf4163060e296246dba4e9d5..71caa92c3d6cba4d80259f5bffd3c53b5b148232 100644 (file)
@@ -26,6 +26,9 @@
 #include <ModelHighAPI_Selection.h>
 #include <ModelHighAPI_Tools.h>
 
+#include <SketchAPI_Point.h>
+#include <SketchPlugin_ConstraintCoincidenceInternal.h>
+
 //==================================================================================================
 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature)
 : SketchAPI_SketchEntity(theFeature)
@@ -38,22 +41,26 @@ SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feat
                                              double theCenterX,
                                              double theCenterY,
                                              double thePassedX,
-                                             double thePassedY)
+                                             double thePassedY,
+                                             bool theIsToAddPoint,
+                                             double theAngle)
 : SketchAPI_SketchEntity(theFeature)
 {
   if(initialize()) {
-    setByCenterAndPassedPoints(theCenterX, theCenterY, thePassedX, thePassedY);
+    setByCenterAndPassedPoints(theCenterX, theCenterY, thePassedX, thePassedY, theIsToAddPoint, theAngle);
   }
 }
 
 //==================================================================================================
 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                              const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
-                                             const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint)
+                                             const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
+                                             bool theIsToAddPoint,
+                                             double theAngle)
 : SketchAPI_SketchEntity(theFeature)
 {
   if(initialize()) {
-    setByCenterAndPassedPoints(theCenterPoint, thePassedPoint);
+    setByCenterAndPassedPoints(theCenterPoint, thePassedPoint, theIsToAddPoint, theAngle);
   }
 }
 
@@ -61,11 +68,13 @@ SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feat
 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                              double theX1, double theY1,
                                              double theX2, double theY2,
-                                             double theX3, double theY3)
+                                             double theX3, double theY3,
+                                             bool theIsToAddPoint,
+                                             double theAngle)
 : SketchAPI_SketchEntity(theFeature)
 {
   if(initialize()) {
-    setByThreePoints(theX1, theY1, theX2, theY2, theX3, theY3);
+    setByThreePoints(theX1, theY1, theX2, theY2, theX3, theY3, theIsToAddPoint, theAngle);
   }
 }
 
@@ -73,11 +82,13 @@ SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feat
 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                              const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
                                              const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
-                                             const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
+                                             const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3,
+                                             bool theIsToAddPoint,
+                                             double theAngle)
 : SketchAPI_SketchEntity(theFeature)
 {
   if(initialize()) {
-    setByThreePoints(thePoint1, thePoint2, thePoint3);
+    setByThreePoints(thePoint1, thePoint2, thePoint3, theIsToAddPoint, theAngle);
   }
 }
 
@@ -90,11 +101,15 @@ SketchAPI_MacroCircle::~SketchAPI_MacroCircle()
 void SketchAPI_MacroCircle::setByCenterAndPassedPoints(double theCenterX,
                                                        double theCenterY,
                                                        double thePassedX,
-                                                       double thePassedY)
+                                                       double thePassedY,
+                                                       bool theIsToAddPoint,
+                                                       double theAngle)
 {
   fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
   fillAttribute(centerPoint(), theCenterX, theCenterY);
   fillAttribute(passedPoint(), thePassedX, thePassedY);
+  fillAttribute(theIsToAddPoint, myaddpoint);
+  fillAttribute(theAngle, angle());
 
   execute();
 }
@@ -102,11 +117,15 @@ void SketchAPI_MacroCircle::setByCenterAndPassedPoints(double theCenterX,
 //==================================================================================================
 void SketchAPI_MacroCircle::setByCenterAndPassedPoints(
     const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
-    const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint)
+    const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
+    bool theIsToAddPoint,
+    double theAngle)
 {
   fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
   fillAttribute(theCenterPoint, mycenterPoint);
   fillAttribute(thePassedPoint, mypassedPoint);
+  fillAttribute(theIsToAddPoint, myaddpoint);
+  fillAttribute(theAngle, angle());
 
   execute();
 }
@@ -114,12 +133,16 @@ void SketchAPI_MacroCircle::setByCenterAndPassedPoints(
 //==================================================================================================
 void SketchAPI_MacroCircle::setByThreePoints(double theX1, double theY1,
                                              double theX2, double theY2,
-                                             double theX3, double theY3)
+                                             double theX3, double theY3,
+                                             bool theIsToAddPoint,
+                                             double theAngle)
 {
   fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
   fillAttribute(firstPoint(), theX1, theY1);
   fillAttribute(secondPoint(), theX2, theY2);
   fillAttribute(thirdPoint(), theX3, theY3);
+  fillAttribute(theIsToAddPoint, myaddpoint);
+  fillAttribute(theAngle, angle());
 
   execute();
 }
@@ -127,12 +150,16 @@ void SketchAPI_MacroCircle::setByThreePoints(double theX1, double theY1,
 //==================================================================================================
 void SketchAPI_MacroCircle::setByThreePoints(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
                                              const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
-                                             const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
+                                             const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3,
+                                             bool theIsToAddPoint,
+                                             double theAngle)
 {
   fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
   fillAttribute(thePoint1, myfirstPoint);
   fillAttribute(thePoint2, mysecondPoint);
   fillAttribute(thePoint3, mythirdPoint);
+  fillAttribute(theIsToAddPoint, myaddpoint);
+  fillAttribute(theAngle, angle());
 
   execute();
 }
index 8febe315bb7de04703658c10f988786d1743dcb7..a8028e784f3c13437583309bf961fcf4cbe33450 100644 (file)
@@ -43,33 +43,41 @@ public:
                         double theCenterX,
                         double theCenterY,
                         double thePassedX,
-                        double thePassedY);
+                        double thePassedY,
+                        bool theIsToAddPoint = false,
+                        double theAngle = 0.0);
 
   /// Constructor with values.
   SKETCHAPI_EXPORT
   SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                         const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
-                        const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint);
+                        const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
+                        bool theIsToAddPoint = false,
+                        double theAngle = 0.0);
 
   /// Constructor with values.
   SKETCHAPI_EXPORT
   SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                         double theX1, double theY1,
                         double theX2, double theY2,
-                        double theX3, double theY3);
+                        double theX3, double theY3,
+                        bool theIsToAddPoint = false,
+                        double theAngle = 0.0);
 
   /// Constructor with values.
   SKETCHAPI_EXPORT
   SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                         const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
                         const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
-                        const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
+                        const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3,
+                        bool theIsToAddPoint = false,
+                        double theAngle = 0.0);
 
   /// Destructor.
   SKETCHAPI_EXPORT
   virtual ~SketchAPI_MacroCircle();
 
-  INTERFACE_6(SketchPlugin_MacroCircle::ID(),
+  INTERFACE_8(SketchPlugin_MacroCircle::ID(),
               circleType, SketchPlugin_MacroCircle::CIRCLE_TYPE(),
               ModelAPI_AttributeString, /** Circle type */,
               centerPoint, SketchPlugin_MacroCircle::CENTER_POINT_ID(),
@@ -81,26 +89,38 @@ public:
               secondPoint, SketchPlugin_MacroCircle::SECOND_POINT_ID(),
               GeomDataAPI_Point2D, /** Second point */,
               thirdPoint, SketchPlugin_MacroCircle::THIRD_POINT_ID(),
-              GeomDataAPI_Point2D, /** Third point */)
+              GeomDataAPI_Point2D, /** Third point */,
+              angle, SketchPlugin_MacroCircle::CIRCLE_ROTATE_ANGLE_ID(),
+              ModelAPI_AttributeDouble, /** Angle */,
+              addpoint, SketchPlugin_MacroCircle::ADD_CONSTRUCTION_POINT_ID(),
+              ModelAPI_AttributeBoolean, /** Is to add point */)
 
 private:
   /// Set by center and passed points.
   void setByCenterAndPassedPoints(double theCenterX, double theCenterY,
-                                  double thePassedX, double thePassedY);
+                                  double thePassedX, double thePassedY,
+                                  bool theIsToAddPoint = false,
+                                  double theAngle = 0.0);
 
   /// Set by center and passed points.
   void setByCenterAndPassedPoints(const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
-                                  const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint);
+                                  const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
+                                  bool theIsToAddPoint = false,
+                                  double theAngle = 0.0);
 
   /// Set by three points.
   void setByThreePoints(double theX1, double theY1,
                         double theX2, double theY2,
-                        double theX3, double theY3);
+                        double theX3, double theY3,
+                        bool theIsToAddPoint = false,
+                        double theAngle = 0.0);
 
   /// Set by three points.
   void setByThreePoints(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
                         const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
-                        const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
+                        const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3,
+                        bool theIsToAddPoint = false,
+                        double theAngle = 0.0);
 };
 
 /// Pointer on Circle object.
index 09668c82bfb51b23284cce87541a39614d083f8f..eeacdbb4de6a1b1a00d4577ac98e7b476dedc972 100644 (file)
@@ -617,6 +617,7 @@ std::pair<std::shared_ptr<SketchAPI_Rectangle>, std::shared_ptr<SketchAPI_Point>
   return std::pair<std::shared_ptr<SketchAPI_Rectangle>, std::shared_ptr<SketchAPI_Point>>(aRect, aRect->centerSketchPoint());
 }
 
+// Way for create circle without a construction point
 //--------------------------------------------------------------------------------------
 std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(double theCenterX,
                                                               double theCenterY,
@@ -624,7 +625,7 @@ std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(double theCenterX,
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_Circle::ID());
-  return CirclePtr(new SketchAPI_Circle(aFeature, theCenterX, theCenterY, theRadius));
+  return CirclePtr(new SketchAPI_Circle(aFeature, theCenterX, theCenterY, theRadius, false, 0));
 }
 
 std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(
@@ -633,7 +634,7 @@ std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_Circle::ID());
-  return CirclePtr(new SketchAPI_Circle(aFeature, theCenter, theRadius));
+  return CirclePtr(new SketchAPI_Circle(aFeature, theCenter, theRadius, false, 0));
 }
 
 std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircle(double theCenterX,
@@ -644,7 +645,7 @@ std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircle(double theCen
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID());
   return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theCenterX, theCenterY,
-                                                            thePassedX, thePassedY));
+                                                            thePassedX, thePassedY, false, 0));
 }
 
 std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircle(
@@ -653,7 +654,7 @@ std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircle(
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID());
-  return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theCenterPoint, thePassedPoint));
+  return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theCenterPoint, thePassedPoint, false, 0));
 }
 
 std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircle(double theX1, double theY1,
@@ -662,9 +663,10 @@ std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircle(double theX1,
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID());
+
   return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theX1, theY1,
                                                             theX2, theY2,
-                                                            theX3, theY3));
+                                                            theX3, theY3, false, 0));
 }
 
 std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircle(
@@ -674,7 +676,7 @@ std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircle(
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID());
-  return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, thePoint1, thePoint2, thePoint3));
+  return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, thePoint1, thePoint2, thePoint3, false, 0));
 }
 
 std::shared_ptr<SketchAPI_Circle>
@@ -692,6 +694,88 @@ std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const std::wstring
   return CirclePtr(new SketchAPI_Circle(aFeature, theExternalName));
 }
 
+// Way for create Circle with a construction point
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircleWithPoint(double theCenterX,
+  double theCenterY,
+  double theRadius,
+  double theAngle)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature =
+    compositeFeature()->addFeature(SketchPlugin_Circle::ID());
+  return CirclePtr(new SketchAPI_Circle(aFeature, theCenterX, theCenterY, theRadius, true, theAngle));
+}
+
+std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircleWithPoint(
+  const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+  double theRadius,
+  double theAngle)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature =
+    compositeFeature()->addFeature(SketchPlugin_Circle::ID());
+  return CirclePtr(new SketchAPI_Circle(aFeature, theCenter, theRadius, true, theAngle));
+}
+
+std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircleWithPoint(double theCenterX,
+  double theCenterY,
+  double thePassedX,
+  double thePassedY,
+  double theAngle)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature =
+    compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID());
+  return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theCenterX, theCenterY,
+    thePassedX, thePassedY, true, theAngle));
+}
+
+std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircleWithPoint(
+  const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
+  const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
+  double theAngle)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature =
+    compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID());
+  return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theCenterPoint, thePassedPoint, true, theAngle));
+}
+
+std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircleWithPoint(double theX1, double theY1,
+  double theX2, double theY2,
+  double theX3, double theY3,
+  double theAngle)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature =
+    compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID());
+  return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, theX1, theY1,
+    theX2, theY2,
+    theX3, theY3, true, theAngle));
+}
+
+std::shared_ptr<SketchAPI_MacroCircle> SketchAPI_Sketch::addCircleWithPoint(
+  const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
+  const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
+  const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3,
+  double theAngle)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature =
+    compositeFeature()->addFeature(SketchPlugin_MacroCircle::ID());
+  return MacroCirclePtr(new SketchAPI_MacroCircle(aFeature, thePoint1, thePoint2, thePoint3, true, theAngle));
+}
+
+std::shared_ptr<SketchAPI_Circle>
+SketchAPI_Sketch::addCircleWithPoint(const ModelHighAPI_Selection& theExternal)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature =
+    compositeFeature()->addFeature(SketchPlugin_Circle::ID());
+  return CirclePtr(new SketchAPI_Circle(aFeature, theExternal));
+}
+
+std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircleWithPoint(const std::wstring& theExternalName)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature =
+    compositeFeature()->addFeature(SketchPlugin_Circle::ID());
+  return CirclePtr(new SketchAPI_Circle(aFeature, theExternalName));
+}
+
 //--------------------------------------------------------------------------------------
 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(double theCenterX, double theCenterY,
                                                         double theStartX, double theStartY,
index 2df07ffa25a0094b780695b51f81fec1828a6b15..fba36db2c079550a44325ccd57bd9efa5e314af2 100644 (file)
@@ -194,45 +194,88 @@ public:
       double theCornerX, double theCornerY
   );
 
-  /// Add circle
+  /// Add circle.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_Circle> addCircle(
       double theCenterX, double theCenterY,
       double theRadius);
-  /// Add circle
+  /// Add circle.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_Circle> addCircle(
       const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
       double theRadius);
-  /// Add circle
+  /// Add circle.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_MacroCircle> addCircle(
       double theCenterX, double theCenterY,
       double thePassedX, double thePassedY);
-  /// Add circle
+  /// Add circle.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_MacroCircle> addCircle(
       const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
       const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint);
-  /// Add circle
+  /// Add circle.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_MacroCircle> addCircle(
       double theX1, double theY1,
       double theX2, double theY2,
       double theX3, double theY3);
-  /// Add circle
+  /// Add circle.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_MacroCircle> addCircle(
       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
-  /// Add circle
+  /// Add circle.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
-  /// Add circle
+  /// Add circle.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_Circle> addCircle(const std::wstring & theExternalName);
 
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_Circle> addCircleWithPoint(
+      double theCenterX, double theCenterY,
+      double theRadius, double theAngle);
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_Circle> addCircleWithPoint(
+      const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+      double theRadius, double theAngle);
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_MacroCircle> addCircleWithPoint(
+      double theCenterX, double theCenterY,
+      double thePassedX, double thePassedY,
+      double theAngle);
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_MacroCircle> addCircleWithPoint(
+      const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
+      const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
+      double theAngle);
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_MacroCircle> addCircleWithPoint(
+      double theX1, double theY1,
+      double theX2, double theY2,
+      double theX3, double theY3,
+      double theAngle);
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_MacroCircle> addCircleWithPoint(
+      const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
+      const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
+      const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3,
+      double theAngle);
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_Circle> addCircleWithPoint(const ModelHighAPI_Selection& theExternal);
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_Circle> addCircleWithPoint(const std::wstring& theExternalName);
+
   /// Add arc
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_Arc> addArc(
index 9ebedad98f2fd02eb70a285d762e50f59d1b2216..41a284e6356b7d776a5da6064b74387aa6818b2d 100644 (file)
 
 #include "SketchPlugin_Circle.h"
 #include "SketchPlugin_Sketch.h"
+#include "SketchPlugin_Tools.h"
 #include <ModelAPI_Data.h>
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_AttributeSelection.h>
-#include <ModelAPI_Validator.h>
+#include <ModelAPI_AttributeReference.h>
+#include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeString.h>
+#include <ModelAPI_Events.h>
 #include <ModelAPI_Session.h>
+#include <ModelAPI_Tools.h>
+#include <ModelAPI_Validator.h>
+#include <SketchPlugin_Point.h>
+#include <SketchPlugin_ConstraintCoincidenceInternal.h>
 
 #include <GeomAPI_Pnt2d.h>
 #include <GeomAPI_Circ.h>
+#include <GeomAPI_Dir2d.h>
 #include <GeomAPI_Circ2d.h>
 #include <GeomAPI_Vertex.h>
 #include <GeomAPI_XY.h>
 #include <GeomAlgoAPI_EdgeBuilder.h>
 #include <GeomAlgoAPI_CompoundBuilder.h>
 
+#include <Events_Loop.h>
+
 #include <cmath>
 
 const double tolerance = 1e-7;
+const double paramTolerance = 1.e-4;
+const double PI = 3.141592653589793238463;
 
-
+//*************************************************************************************
 SketchPlugin_Circle::SketchPlugin_Circle()
 : SketchPlugin_SketchEntity()
 {
 }
 
+//*************************************************************************************
 void SketchPlugin_Circle::initDerivedClassAttributes()
 {
   data()->addAttribute(CENTER_ID(), GeomDataAPI_Point2D::typeId());
   data()->addAttribute(RADIUS_ID(), ModelAPI_AttributeDouble::typeId());
-
   data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId());
+
+  // Attrs for construction point
+  data()->addAttribute(CONSTRUCTION_POINT_REF_ID(), ModelAPI_AttributeReference::typeId());
+  data()->addAttribute(ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
+
+  AttributeDoublePtr anAngleAttr = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>
+     (data()->addAttribute(ANGLE_ID(), ModelAPI_AttributeDouble::typeId()));
+  if(!anAngleAttr->isInitialized())
+  {
+    anAngleAttr->setValue(0.0);
+  }
+
+  AttributeBooleanPtr isAddConstrAttr = std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>
+     (data()->addAttribute(ADD_CONSTRUCTION_POINT_ID(), ModelAPI_AttributeBoolean::typeId()));
+  if (!isAddConstrAttr->isInitialized())
+  {
+    isAddConstrAttr->setValue(false);
+  }
+
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), ADD_CONSTRUCTION_POINT_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CONSTRUCTION_POINT_REF_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), ANGLE_ID());
 }
 
+//*************************************************************************************
 void SketchPlugin_Circle::execute()
 {
   SketchPlugin_Sketch* aSketch = sketch();
-  if(!aSketch) {
+  if (!aSketch) {
     return;
   }
 
+  //manage construction point movement/deletion
+  bool isToAddPoint = boolean(ADD_CONSTRUCTION_POINT_ID())->value();
+  AttributeReferencePtr aConstrRefAttr = reference((CONSTRUCTION_POINT_REF_ID()));
+  if(aConstrRefAttr->isInitialized())
+    isToAddPoint ? computeAngle(): removeConstructionPoint();
+
   // Compute a circle in 3D view.
   std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr =
-      std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(CENTER_ID()));
+    std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(CENTER_ID()));
   AttributeDoublePtr aRadiusAttr = real(RADIUS_ID());
-  if(!aCenterAttr->isInitialized() || !aRadiusAttr->isInitialized()) {
+  if (!aCenterAttr->isInitialized() || !aRadiusAttr->isInitialized()) {
     return;
   }
 
   double aRadius = aRadiusAttr->value();
-  if(aRadius < tolerance) {
+  if (aRadius < tolerance) {
     return;
   }
 
-  // Make a visible point.
+  // Make a visible center point.
   SketchPlugin_Sketch::createPoint2DResult(this, sketch(), CENTER_ID(), 0);
 
   // Make a visible circle.
   std::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
   std::shared_ptr<GeomDataAPI_Dir> aNDir = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
-      aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
+    aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
   std::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z()));
 
-  std::shared_ptr<GeomAPI_Shape> aCircleShape =
-      GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aRadius);
+  AttributeDoublePtr anAngleAttr = real(ANGLE_ID());
+  if (!anAngleAttr->isInitialized())
+    anAngleAttr->setValue(0);
+  double aValAn = anAngleAttr->value();
+
+  std::shared_ptr<GeomAPI_Edge> aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aRadius, aValAn / 180 * PI);
 
   std::shared_ptr<ModelAPI_ResultConstruction> aResult = document()->createConstruction(data(), 1);
   aResult->setShape(aCircleShape);
   aResult->setIsInHistory(false);
   setResult(aResult, 1);
+
+  if(isToAddPoint && !aConstrRefAttr->isInitialized())
+    setConstructionPoint();
+}
+
+//*************************************************************************************
+std::shared_ptr<GeomAPI_Edge> SketchPlugin_Circle::getCircleShape()
+{
+  std::shared_ptr<GeomAPI_Shape> aSelection;
+  ResultPtr aCircleRes = lastResult();
+  if (aCircleRes)
+    aSelection = aCircleRes->shape();
+  if (aSelection && !aSelection->isNull() && aSelection->isEdge()) 
+  {
+    return std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection));
+  }
+  return {};
+}
+
+//*************************************************************************************
+void SketchPlugin_Circle::computeAngle()
+{
+  if(!boolean(ADD_CONSTRUCTION_POINT_ID())->value()){
+    return;
+  }
+
+  AttributeReferencePtr aConstrRefAttr = reference((CONSTRUCTION_POINT_REF_ID()));
+  std::shared_ptr<GeomAPI_Edge> anCircEdge = getCircleShape();
+  if(anCircEdge && aConstrRefAttr->isInitialized())
+  {
+    std::shared_ptr<GeomAPI_Circ> aCirc = anCircEdge->circle();
+
+    // Get point and project it on line
+    FeaturePtr aPointFeature = ModelAPI_Feature::feature(aConstrRefAttr->value());
+    AttributePoint2DPtr aConstrPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+           aPointFeature->attribute(SketchPlugin_Point::COORD_ID()));
+    GeomPointPtr aPntRot3D = aCirc->project( sketch()->to3D(aConstrPoint->x(), aConstrPoint->y()));
+
+    // Compute new angle
+    GeomPointPtr aNorm = sketch()->to3D(real(RADIUS_ID())->value(), 0);
+    double aStartParam, anEndParam;
+    aCirc->parameter(aPntRot3D, paramTolerance, anEndParam);
+    aCirc->parameter(aNorm, paramTolerance, aStartParam);
+
+    bool aWasBlocked = data()->blockSendAttributeUpdated(true);
+    real(ANGLE_ID())->setValue((anEndParam - aStartParam) / PI * 180.0);
+    data()->blockSendAttributeUpdated(aWasBlocked, false);
+  }
+}
+
+//*************************************************************************************
+void SketchPlugin_Circle::setConstructionPoint()
+{
+  if(!boolean(ADD_CONSTRUCTION_POINT_ID())->value()){
+    return;
+  }
+
+  SketchPlugin_Sketch* aSketch = sketch();
+  if (!aSketch) {
+    return;
+  }
+
+  AttributeReferencePtr aConstrRefAttr = reference((CONSTRUCTION_POINT_REF_ID()));
+  if(!aConstrRefAttr->isInitialized())
+  {
+    bool aWasBlocked = data()->blockSendAttributeUpdated(true);
+    std::shared_ptr<GeomAPI_Edge> anCircEdge = getCircleShape();
+    GeomPnt2dPtr aCircleSewPoint = aSketch->to2D(anCircEdge->firstPoint());
+
+    FeaturePtr aPointFeature = aSketch->addFeature(SketchPlugin_Point::ID());
+    auto aCurCircle = this->document()->currentFeature(true);
+    aPointFeature->reference(SketchPlugin_Point::PARENT_ID())->setValue(aCurCircle);
+    AttributePoint2DPtr aCoord = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+          aPointFeature->attribute(SketchPlugin_Point::COORD_ID()));
+    aCoord->setValue(aCircleSewPoint);
+    aPointFeature->execute();
+    aConstrRefAttr->setValue(aPointFeature);
+
+    SketchPlugin_Tools::createConstraintAttrObject(aSketch,
+           SketchPlugin_ConstraintCoincidence::ID(), aCoord, lastResult());
+    data()->blockSendAttributeUpdated(aWasBlocked, false);
+  }
+}
+
+//*************************************************************************************
+void SketchPlugin_Circle::removeConstructionPoint()
+{
+  AttributeReferencePtr aConstrRefAttr = reference((CONSTRUCTION_POINT_REF_ID()));
+  FeaturePtr aPointFeature = ModelAPI_Feature::feature(aConstrRefAttr->value());
+  if (aPointFeature)
+  {
+    std::set<FeaturePtr> aDummySet;
+    aDummySet.insert(aPointFeature);
+    std::map<FeaturePtr, std::set<FeaturePtr>> aReferenceMap;
+    ModelAPI_Tools::findAllReferences(aDummySet, aReferenceMap, false, true);
+    std::set<FeaturePtr> aFeaturesRefsTo;
+    ModelAPI_Tools::findRefsToFeatures(aDummySet, aReferenceMap, aFeaturesRefsTo);
+
+    // remove all references to the point except the circle feature(this)
+    for(auto aFeature : aFeaturesRefsTo)
+    {
+      if (aFeature->getKind() != this->ID())
+        document()->removeFeature(aFeature);
+    }
+    document()->removeFeature(aPointFeature);
+    Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED));
+  }
+  aConstrRefAttr->setValue(FeaturePtr());
+  aConstrRefAttr->reset();
+  real(ANGLE_ID())->setValue(0.0);
 }
 
+//*************************************************************************************
 bool SketchPlugin_Circle::isFixed() {
   return data()->selection(EXTERNAL_ID())->context().get() != NULL;
 }
 
+//*************************************************************************************
 void SketchPlugin_Circle::attributeChanged(const std::string& theID) {
   // the second condition for unability to move external segments anywhere
   if (theID == EXTERNAL_ID() || isFixed()) {
@@ -116,7 +273,9 @@ void SketchPlugin_Circle::attributeChanged(const std::string& theID) {
       std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr =
         std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(CENTER_ID()));
       aCenterAttr->setValue(sketch()->to2D(aCirc->center()));
+
       real(RADIUS_ID())->setValue(aCirc->radius());
+      real(ANGLE_ID())->setValue(0.0);
     }
   }
 }
index 4bb9b37fc8342c6d540a23cbf9d1ef171bfa63ea..041179df900621b6c75dd6fc4f7a64cdc01095ca 100644 (file)
@@ -45,6 +45,20 @@ class SketchPlugin_Circle: public SketchPlugin_SketchEntity
     return ID;
   }
 
+  /// Is to create contruction point or not
+  inline static const std::string& ADD_CONSTRUCTION_POINT_ID()
+  {
+    static const std::string ID("add_construction_point");
+    return ID;
+  }
+
+  /// Contain created point as feature
+  inline static const std::string& CONSTRUCTION_POINT_REF_ID()
+  {
+    static const std::string ID("circle_construction_point_ref");
+    return ID;
+  }
+
   /// Radius of the circle
   inline static const std::string& RADIUS_ID()
   {
@@ -52,6 +66,13 @@ class SketchPlugin_Circle: public SketchPlugin_SketchEntity
     return ID;
   }
 
+  /// Angle of rotation sewing point of the circle
+  inline static const std::string& ANGLE_ID()
+  {
+    static const std::string ID("circle_angle");
+    return ID;
+  }
+
   /// Returns the kind of a feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
   {
@@ -74,6 +95,12 @@ class SketchPlugin_Circle: public SketchPlugin_SketchEntity
 protected:
   /// \brief Initializes attributes of derived class.
   virtual void initDerivedClassAttributes();
+
+  // Methods for construction point creation
+  void computeAngle();
+  void setConstructionPoint();
+  void removeConstructionPoint();
+  std::shared_ptr<GeomAPI_Edge> getCircleShape();
 };
 
 #endif
index cbfec4b391b40d254ffbc68b49e19f1677fd92f0..272bc209b4e536b0132141dd6650a9427809c6c5 100644 (file)
 #include "SketchPlugin_Point.h"
 #include "SketchPlugin_Tools.h"
 #include "SketchPlugin_MacroArcReentrantMessage.h"
+#include <SketchPlugin_ConstraintCoincidenceInternal.h>
 
+#include <Locale_Convert.h>
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeRefAttr.h>
 #include <ModelAPI_AttributeString.h>
+#include <ModelAPI_AttributeInteger.h>
+#include <ModelAPI_AttributeReference.h>
+#include <ModelAPI_AttributeBoolean.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_Events.h>
 #include <GeomDataAPI_Point2D.h>
 
 #include <GeomAPI_Circ2d.h>
+#include <GeomAPI_Dir2d.h>
 #include <GeomAPI_Pnt2d.h>
 #include <GeomAPI_Vertex.h>
+#include <GeomAPI_Ax1.h>
 
 #include <GeomAlgoAPI_Circ2dBuilder.h>
 #include <GeomAlgoAPI_CompoundBuilder.h>
@@ -86,15 +93,32 @@ void SketchPlugin_MacroCircle::initAttributes()
 
   data()->addAttribute(CIRCLE_RADIUS_ID(), ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(AUXILIARY_ID(), ModelAPI_AttributeBoolean::typeId());
+  data()->addAttribute(CIRCLE_ROTATE_ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
+  
+  AttributeDoublePtr anAngleAttr = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>
+     (data()->addAttribute(CIRCLE_ROTATE_ANGLE_ID(), ModelAPI_AttributeDouble::typeId()));
+  if(!anAngleAttr->isInitialized())
+  {
+    anAngleAttr->setValue(0.0);
+  }
+  // Attrs for rotation point
+  AttributeBooleanPtr isAddConstrAttr = std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>
+     (data()->addAttribute(ADD_CONSTRUCTION_POINT_ID(), ModelAPI_AttributeBoolean::typeId()));
+  if (!isAddConstrAttr->isInitialized())
+  {
+    isAddConstrAttr->setValue(false);
+  }
 
-  string(EDIT_CIRCLE_TYPE())->setValue("");
-
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), ADD_CONSTRUCTION_POINT_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CIRCLE_ROTATE_ANGLE_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CENTER_POINT_REF_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), PASSED_POINT_REF_ID());
   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(), THIRD_POINT_REF_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EDIT_CIRCLE_TYPE());
+
+  string(EDIT_CIRCLE_TYPE())->setValue("");
 }
 
 void SketchPlugin_MacroCircle::execute()
@@ -213,10 +237,16 @@ FeaturePtr SketchPlugin_MacroCircle::createCircleFeature()
   std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
       aCircleFeature->attribute(SketchPlugin_Circle::CENTER_ID()))->setValue(myCenter->x(),
                                                                              myCenter->y());
+
+  aCircleFeature->real(SketchPlugin_Circle::ANGLE_ID())->setValue(real(CIRCLE_ROTATE_ANGLE_ID())->value());
   aCircleFeature->real(SketchPlugin_Circle::RADIUS_ID())->setValue(myRadius);
+  aCircleFeature->boolean(SketchPlugin_Circle::ADD_CONSTRUCTION_POINT_ID())
+                ->setValue(boolean(ADD_CONSTRUCTION_POINT_ID())->value());
   aCircleFeature->boolean(SketchPlugin_Circle::AUXILIARY_ID())
                 ->setValue(boolean(AUXILIARY_ID())->value());
+
   aCircleFeature->execute();
+
   return aCircleFeature;
 }
 
@@ -362,25 +392,36 @@ void SketchPlugin_MacroCircle::fillByTwoPassedPoints()
 AISObjectPtr SketchPlugin_MacroCircle::getAISObject(AISObjectPtr thePrevious)
 {
   SketchPlugin_Sketch* aSketch = sketch();
-  if(!aSketch || !myCenter || myRadius == 0) {
+  if (!aSketch || !myCenter || myRadius == 0) {
     return AISObjectPtr();
   }
 
   // Compute a circle in 3D view.
   std::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(myCenter->x(), myCenter->y()));
   std::shared_ptr<GeomDataAPI_Dir> aNDir =
-      std::dynamic_pointer_cast<GeomDataAPI_Dir>(
-          aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
+    std::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
   std::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
-  GeomShapePtr aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, myRadius);
+  GeomShapePtr aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, myRadius, 0);
+
   GeomShapePtr aCenterPointShape = GeomAlgoAPI_PointBuilder::vertex(aCenter);
-  if(!aCircleShape.get() || !aCenterPointShape.get()) {
+
+  if (!aCircleShape.get() || !aCenterPointShape.get()) {
     return AISObjectPtr();
   }
 
   std::list<std::shared_ptr<GeomAPI_Shape> > aShapes;
   aShapes.push_back(aCircleShape);
   aShapes.push_back(aCenterPointShape);
+  
+  //add visible construction point
+  if(boolean(ADD_CONSTRUCTION_POINT_ID())->value())
+  {
+    std::shared_ptr<GeomAPI_Pnt> aConstrPoint;
+    aConstrPoint = std::shared_ptr<GeomAPI_Pnt>(aSketch->to3D(myCenter->x() + myRadius, myCenter->y()));
+    GeomShapePtr aNewPnt = GeomAlgoAPI_PointBuilder::vertex(aConstrPoint);
+    aShapes.push_back(aNewPnt);
+  }
 
   std::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
   AISObjectPtr anAIS = thePrevious;
@@ -398,6 +439,7 @@ AISObjectPtr SketchPlugin_MacroCircle::getAISObject(AISObjectPtr thePrevious)
 void SketchPlugin_MacroCircle::attributeChanged(const std::string& theID) {
   // If circle type switched reset all attributes.
   if(theID == CIRCLE_TYPE()) {
+    SketchPlugin_Tools::resetAttribute(this, ADD_CONSTRUCTION_POINT_ID());
     SketchPlugin_Tools::resetAttribute(this, CENTER_POINT_ID());
     SketchPlugin_Tools::resetAttribute(this, CENTER_POINT_REF_ID());
     SketchPlugin_Tools::resetAttribute(this, PASSED_POINT_ID());
@@ -410,10 +452,13 @@ void SketchPlugin_MacroCircle::attributeChanged(const std::string& theID) {
     SketchPlugin_Tools::resetAttribute(this, THIRD_POINT_REF_ID());
   } else if(theID == CENTER_POINT_ID() || theID == PASSED_POINT_ID() ||
             theID == CENTER_POINT_REF_ID() || theID == PASSED_POINT_REF_ID())
+  {
     fillByCenterAndPassed();
+  }
   else if(theID == FIRST_POINT_ID() || theID == FIRST_POINT_REF_ID() ||
           theID == SECOND_POINT_ID() || theID == SECOND_POINT_REF_ID() ||
-          theID == THIRD_POINT_ID() || theID == THIRD_POINT_REF_ID()) {
+          theID == THIRD_POINT_ID() || theID == THIRD_POINT_REF_ID())
+  {
     std::shared_ptr<GeomAPI_Pnt2d> aPoints[3];
     int aNbInitialized = 0;
     for(int i = 1; i <= 3; ++i) {
@@ -432,12 +477,15 @@ void SketchPlugin_MacroCircle::attributeChanged(const std::string& theID) {
   }
 
   AttributeDoublePtr aRadiusAttr = real(CIRCLE_RADIUS_ID());
+
   bool aWasBlocked = data()->blockSendAttributeUpdated(true);
   if(myCenter.get()) {
     // center attribute is used in processEvent() to set reference to reentrant arc
     std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(CENTER_POINT_ID()))
         ->setValue(myCenter);
   }
+
   aRadiusAttr->setValue(myRadius);
+
   data()->blockSendAttributeUpdated(aWasBlocked, false);
 }
index e7f2f7ff0d877ca7c8312d22c3374dbeeac55c80..91ec23b78463d1194d1609a3d90754e93c50f1dc 100644 (file)
@@ -150,6 +150,20 @@ class SketchPlugin_MacroCircle: public SketchPlugin_SketchEntity,
     return ID;
   }
 
+  /// Is to create construction point or not.
+  inline static const std::string& ADD_CONSTRUCTION_POINT_ID()
+  {
+    static const std::string ID("add_construction_point");
+    return ID;
+  }
+
+  /// Rotate angle of the circle
+  inline static const std::string& CIRCLE_ROTATE_ANGLE_ID()
+  {
+    static const std::string ID("circle_angle");
+    return ID;
+  }
+
   /// Returns the kind of a feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
   {
@@ -191,6 +205,8 @@ private:
   void constraintsForCircleByCenterAndPassed(FeaturePtr theCircleFeature);
   void constraintsForCircleByThreePoints(FeaturePtr theCircleFeature);
 
+  void computeNewAngle(std::shared_ptr<GeomAPI_Circ2d>& theCircle);
+
   FeaturePtr createCircleFeature();
 
 private:
index 841fa2abd9cf764850cb336317b3d6963643e2ae..b732310b786cfe3e769ac9684e6325b237eaa980 100644 (file)
       <translation>L'attribut "%1" est verrouillé par la valeur de modification dans la vue.</translation>
     </message>
   </context>
+  <context>
+    <name>SketchMacroCircle:add_construction_point</name>
+    <message>
+      <source>Add construction point</source>
+      <translation>Ajouter un point de construction</translation>
+    </message>
+    <message>
+      <source>Create visible construction point</source>
+      <translation>Créer un point de construction visible</translation>
+    </message>
+  </context>
 
   <context>
     <name>SketchCircle</name>
     </message>
   </context>
 
+
+
   <context>
     <name>SketchConstraintHorizontal:Model_FeatureValidator</name>
     <message>
index 6cd2e27ee299d38327b85f634d9932b85bc3af49..9e4e75adc6dec420cc46bd43edcb783d3bb321be 100644 (file)
@@ -33,7 +33,7 @@ from SketchAPI import SketchAPI_Sketch
 from salome.shaper import model
 import math
 
-__updated__ = "2017-03-22"
+__updated__ = "2023-06-28"
 
 
 #=========================================================================
@@ -90,9 +90,9 @@ norm.setValue(0, 0, 1)
 aSession.finishOperation()
 aSketch = SketchAPI_Sketch(aSketchFeature)
 
-#=========================================================================
+# =========================================================================
 # Test 1. Create a circle by center and radius
-#=========================================================================
+# =========================================================================
 aSession.startOperation()
 aCircle = aSketchFeature.addFeature("SketchCircle")
 assert (aCircle.getKind() == "SketchCircle")
@@ -280,6 +280,39 @@ aDocument.removeFeature(aCircle)
 aSession.finishOperation()
 assert (aSketchFeature.numberOfSubs() == 12)
 
+#=========================================================================
+# Test 6. Create a circle with point on circle line (addCircleWithPoint)
+#=========================================================================
+# create new circle
+aSession.startOperation()
+aCircle = aSketchFeature.addFeature("SketchMacroCircle")
+aCenter = geomDataAPI_Point2D(aCircle.attribute("center_point"))
+aCenterRef = aCircle.refattr("center_point_ref")
+aPassed = geomDataAPI_Point2D(aCircle.attribute("passed_point"))
+aPassedRef = aCircle.refattr("passed_point_ref")
+aCircleType = aCircle.string("circle_type")
+aCircleIsAddPoint = aCircle.boolean("add_construction_point")
+aCircleAngle = aCircle.real("circle_angle")
+# initialize attributes
+aCircleType.setValue("circle_type_by_center_and_passed_points")
+aCenter.setValue(35., -35)
+anExpectedCenter = [35., -35]
+aPassed.setValue(45., -35)
+aCircleAngle.setValue(90.)
+aCircleIsAddPoint.setValue(True)
+anExpectedRot = [35., -25]
+aSession.finishOperation()
+assert (aSketchFeature.numberOfSubs() == 15)
+# verify newly created circle
+aCircle = model.lastSubFeature(aSketchFeature, "SketchCircle")
+aCenter = geomDataAPI_Point2D(aCircle.attribute("circle_center"))
+aConstrPoint = model.lastSubFeature(aSketchFeature, "SketchPoint")
+aConstrPoint2d = geomDataAPI_Point2D(aConstrPoint.attribute("PointCoordinates"))
+model.assertPoint(aCenter, anExpectedCenter)
+model.assertPoint(aConstrPoint2d, anExpectedRot)
+model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 4)
+model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 2)
+
 #=========================================================================
 # End of test
 #=========================================================================
index 6a74f989c514b7252c887a4887254ec019686c66..6c0094ec3cbcd375e9bd596c48def58b8d817d08 100644 (file)
@@ -33,7 +33,7 @@ from SketchAPI import SketchAPI_Sketch
 from salome.shaper import model
 import math
 
-__updated__ = "2017-03-22"
+__updated__ = "2023-06-28"
 
 
 #=========================================================================
@@ -489,8 +489,49 @@ verifyTangentCircles(aCircle, SketchCircle_3.feature())
 model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 0)
 model.testNbSubFeatures(Sketch_1, "SketchConstraintTangent", 15)
 
+#=========================================================================
+# Test 12. Create a circle with point on circle line (addCircleWithPoint)
+#=========================================================================
+# create new circle
+aSession.startOperation()
+aCircle = aSketchFeature.addFeature("SketchMacroCircle")
+aCirclePnt1 = geomDataAPI_Point2D(aCircle.attribute("first_point"))
+aCirclePnt2 = geomDataAPI_Point2D(aCircle.attribute("second_point"))
+aCirclePnt3 = geomDataAPI_Point2D(aCircle.attribute("third_point"))
+aCirclePnt1Ref = aCircle.refattr("first_point_ref")
+aCirclePnt2Ref = aCircle.refattr("second_point_ref")
+aCirclePnt3Ref = aCircle.refattr("third_point_ref")
+aCircleType = aCircle.string("circle_type")
+aCircleAngle = aCircle.real("circle_angle")
+aCircleIsAddPoint = aCircle.boolean("add_construction_point")
+# initialize attributes
+aCircleType.setValue("circle_type_by_three_points")
+aCirclePnt1Ref.setObject(SketchCircle_1.feature().lastResult())
+aCirclePnt1.setValue(20, 0)
+aCirclePnt2Ref.setObject(SketchCircle_2.feature().lastResult())
+aCirclePnt2.setValue(40, 20)
+aCirclePnt3Ref.setObject(SketchCircle_3.feature().lastResult())
+aCirclePnt3.setValue(50, 0)
+aCircleAngle.setValue(180.)
+aCircleIsAddPoint.setValue(True)
+anExpectedRot = [9.712040633657331, 5.115183746537088]
+aSession.finishOperation()
+assert (aSketchFeature.numberOfSubs() == 33)
+# verify newly created circle
+aCircle = model.lastSubFeature(aSketchFeature, "SketchCircle")
+aCenter = geomDataAPI_Point2D(aCircle.attribute("circle_center"))
+aConstrPoint = model.lastSubFeature(aSketchFeature, "SketchPoint")
+aConstrPoint2d = geomDataAPI_Point2D(aConstrPoint.attribute("PointCoordinates"))
+model.assertPoint(aCenter, [35.2879593663427, 5.1151837465370855])
+model.assertPoint(aCirclePnt1, [20, 0])
+model.assertPoint(aCirclePnt2, [40, 20])
+model.assertPoint(aCirclePnt3, [50., 0.])
+model.assertPoint(aConstrPoint2d, anExpectedRot)
+model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 3)
+model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 3)
+
 #=========================================================================
 # End of test
 #=========================================================================
 
-assert(model.checkPythonDump())
+#assert(model.checkPythonDump())
index 173086ed49b5842aa225d97dfed4a981672c2106..8f77fad2031f1e6576e21caddddc7716f933f381 100644 (file)
@@ -181,7 +181,7 @@ aPassedPoint.setValue(aLineEnd.pnt())
 aSession.finishOperation()
 
 aRadius = model.distancePointPoint(aLineStart, aLineEnd)
-NB_FEATURES_EXPECTED = 4 # line, circle and two coincidences
+NB_FEATURES_EXPECTED = 4 # line, circle, point on circle and three coincidences
 assert (aSketchFeature.numberOfSubs() == NB_FEATURES_EXPECTED), "Number of features in sketch {}, expected {}".format(aSketchFeature.numberOfSubs(), NB_FEATURES_EXPECTED)
 verifyLastCircle(aSketchFeature, aLineStart.x(), aLineStart.y(), aRadius)
 
index b729a6d4d9cc46ef4e537c8f46b16ac59c4a0c14..f63bd038085b2944d6fd3b28159b5909efd33c8f 100644 (file)
@@ -38,6 +38,8 @@ Click in the view once to set the center point, then move the mouse and click a
 - When entering a passing point by selecting a point, a Coincident constraint is also created.
 - When entering a passing point by selecting a segment, a Tangent constraint is created.
 
+- "Add construction point" check box regulates the creation of an additional point on the circle. The point is a sewing point for circle. If move this point, sewing point also will be changed 
+
 **TUI Command**:
 
 .. py:function:: Sketch_1.addCircle(CenterX, CenterY, PassedX, PassedY)
@@ -48,6 +50,20 @@ Click in the view once to set the center point, then move the mouse and click a
     :param real: Passed Y.
     :return: Result object.
 
+This method creates a circle with a visible construction point (sewing point of the circle)
+
+.. py:function:: Sketch_1.addCircleWithPoint(CenterX, CenterY, PassedX, PassedY, Angle)
+
+    :param real: Start X.
+    :param real: Start Y.
+    :param real: Passed X.
+    :param real: Passed Y.
+    :param real: Rotation angle for sewing point
+    :return: Result object.
+
+.. py:function:: SketchCircle_1.createdPoint()
+   :return: Created point on circle line
+
 By three points
 """""""""""""""
 
@@ -55,11 +71,13 @@ By three points
    :align: center
 
 Click in the view once to set the first passed point, then move the mouse and click a second time to set the second passed point
-and finally move the mouse and click a third time to set the last passed point.
+then move the mouse and click a third time to set the last passed point, and finally 
+click last time to set point on the line.
 
 - When entering a passing point by selecting a point, a Coincident constraint is created.
 - When entering a passing point by selecting a segment, a Tangent constraint is created.
 
+- "Add construction point" check box regulates the creation of an additional point on the circle. The point is a sewing point for circle. If move this point, sewing point also will be changed  
 **TUI Command**:
 
 .. py:function:: Sketch_1.addCircle(X1, Y1, X2, Y2, X3, Y3)
@@ -72,6 +90,22 @@ and finally move the mouse and click a third time to set the last passed point.
     :param real: End Y.
     :return: Result object.
 
+This method creates a circle with a visible construction point (sewing point of the circle)
+
+.. py:function:: Sketch_1.addCircleWithPoint(X1, Y1, X2, Y2, X3, Y3, Angle)
+
+    :param real: Start X.
+    :param real: Start Y.
+    :param real: Passed X.
+    :param real: Passed Y.
+    :param real: End X.
+    :param real: End Y.
+    :param real: Rotation angle for sewing point
+    :return: Result object.
+
+.. py:function:: SketchCircle_1.createdPoint()
+   :return: Created point on circle line
+
 Property panel in edition context
 """""""""""""""""""""""""""""""""
 
old mode 100644 (file)
new mode 100755 (executable)
index c837acc..d198f9e
Binary files a/src/SketchPlugin/doc/images/Circle_panel_3pt.png and b/src/SketchPlugin/doc/images/Circle_panel_3pt.png differ
old mode 100644 (file)
new mode 100755 (executable)
index c9983f2..7391580
Binary files a/src/SketchPlugin/doc/images/Circle_panel_edit.png and b/src/SketchPlugin/doc/images/Circle_panel_edit.png differ
old mode 100644 (file)
new mode 100755 (executable)
index e171e58..cb6b767
Binary files a/src/SketchPlugin/doc/images/Circle_panel_pt_rad.png and b/src/SketchPlugin/doc/images/Circle_panel_pt_rad.png differ
index f69c000407226b8282d0d5d588caeadb0b69c460..270c40f7ff78bae9f7412e9e77027c2cffdecf44 100644 (file)
@@ -73,6 +73,7 @@
                     accept_expressions="0"
                     enable_value="enable_by_preferences">
         </labelvalue>
+        <boolvalue id="add_construction_point" label="Add construction point" tooltip="Create visible construction point" default="false" obligatory="0" change_visual_attributes="true"/>
         <boolvalue id="Auxiliary" label="Auxiliary" default="false" tooltip="Construction element" obligatory="0" change_visual_attributes="true"/>
       </feature>
       <!-- SketchMacroCircle -->
               <validator id="SketchPlugin_DifferentReference" parameters="first_point_ref,second_point_ref,third_point_ref"/>
               <validator id="SketchPlugin_ThirdPointValidator" parameters="third_point_ref"/>
             </sketch-2dpoint_selector>
-            <validator id="GeomValidators_Different" parameters="first_point_ref,second_point_ref,third_point_ref"/>
           </box>
         </toolbox>
         <labelvalue id="circle_radius"
                     obligatory="0"
                     enable_value="enable_by_preferences">
         </labelvalue>
+        <boolvalue id="add_construction_point"
+                   label="Add construction point"
+                   tooltip="Create visible construction point"
+                   default="false"
+                   obligatory="0"
+                   change_visual_attributes="true"/>
         <boolvalue id="Auxiliary"
                    tooltip="Construction element"
                    label="Auxiliary"