Salome HOME
Issue #2024: Redesign of circle and arc of circle
authordbv <dbv@opencascade.com>
Fri, 24 Mar 2017 12:36:48 +0000 (15:36 +0300)
committerdbv <dbv@opencascade.com>
Mon, 27 Mar 2017 06:56:55 +0000 (09:56 +0300)
Redesigned "real" arc feature.

23 files changed:
src/ModelHighAPI/ModelHighAPI_Macro.h
src/PartSet/PartSet_SketcherReentrantMgr.cpp
src/PartSet/PartSet_Tools.cpp
src/SketchAPI/CMakeLists.txt
src/SketchAPI/SketchAPI.i
src/SketchAPI/SketchAPI_Arc.cpp
src/SketchAPI/SketchAPI_Arc.h
src/SketchAPI/SketchAPI_MacroArc.cpp [new file with mode: 0644]
src/SketchAPI/SketchAPI_MacroArc.h [new file with mode: 0644]
src/SketchAPI/SketchAPI_Sketch.cpp
src/SketchAPI/SketchAPI_Sketch.h
src/SketchAPI/SketchAPI_swig.h
src/SketchPlugin/SketchPlugin_Arc.cpp
src/SketchPlugin/SketchPlugin_Arc.h
src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp
src/SketchPlugin/SketchPlugin_Fillet.cpp
src/SketchPlugin/SketchPlugin_MacroArc.cpp
src/SketchPlugin/SketchPlugin_MacroArc.h
src/SketchPlugin/SketchPlugin_MacroCircle.h
src/SketchPlugin/SketchPlugin_Trim.cpp
src/SketchPlugin/SketchPlugin_Validators.cpp
src/SketchPlugin/plugin-Sketch.xml
src/SketchSolver/SketchSolver_ConstraintMirror.cpp

index e37b2efbb5c36bed6f20fd65f9948a67a5caa9c5..b04dc2676c84d3b4c6d5a3bc1a407fc150677990 100644 (file)
     END_INIT() \
   public:
 
+//--------------------------------------------------------------------------------------
+#define INTERFACE_12(KIND, \
+                     N_0, AN_0, T_0, C_0, \
+                     N_1, AN_1, T_1, C_1, \
+                     N_2, AN_2, T_2, C_2, \
+                     N_3, AN_3, T_3, C_3, \
+                     N_4, AN_4, T_4, C_4, \
+                     N_5, AN_5, T_5, C_5, \
+                     N_6, AN_6, T_6, C_6, \
+                     N_7, AN_7, T_7, C_7, \
+                     N_8, AN_8, T_8, C_8, \
+                     N_9, AN_9, T_9, C_9, \
+                     N_10, AN_10, T_10, C_10, \
+                     N_11, AN_11, T_11, C_11) \
+  public: \
+    INTERFACE_COMMON(KIND) \
+    DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+    DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+    DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+    DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+    DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+    DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+    DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+    DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+    DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+    DEFINE_ATTRIBUTE(N_9, T_9, C_9) \
+    DEFINE_ATTRIBUTE(N_10, T_10, C_10) \
+    DEFINE_ATTRIBUTE(N_11, T_11, C_11) \
+  protected: \
+    START_INIT() \
+      SET_ATTRIBUTE(N_0, T_0, AN_0) \
+      SET_ATTRIBUTE(N_1, T_1, AN_1) \
+      SET_ATTRIBUTE(N_2, T_2, AN_2) \
+      SET_ATTRIBUTE(N_3, T_3, AN_3) \
+      SET_ATTRIBUTE(N_4, T_4, AN_4) \
+      SET_ATTRIBUTE(N_5, T_5, AN_5) \
+      SET_ATTRIBUTE(N_6, T_6, AN_6) \
+      SET_ATTRIBUTE(N_7, T_7, AN_7) \
+      SET_ATTRIBUTE(N_8, T_8, AN_8) \
+      SET_ATTRIBUTE(N_9, T_9, AN_9) \
+      SET_ATTRIBUTE(N_10, T_10, AN_10) \
+      SET_ATTRIBUTE(N_11, T_11, AN_11) \
+    END_INIT() \
+  public:
+
 //--------------------------------------------------------------------------------------
 #define INTERFACE_14(KIND, \
                      N_0, AN_0, T_0, C_0, \
index 45547cb74dce9290bb764f571bfe10940f9588b7..cab4e9945363d6912af1c7045d259d88ef00109a 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <SketchPlugin_Feature.h>
 #include <SketchPlugin_Line.h>
-#include <SketchPlugin_Arc.h>
+#include <SketchPlugin_MacroArc.h>
 #include <SketchPlugin_MacroCircle.h>
 #include <SketchPlugin_Point.h>
 
@@ -155,7 +155,7 @@ bool PartSet_SketcherReentrantMgr::processMouseMoved(ModuleBase_IViewWindow* the
         isLineFeature = anActiveWidget->attributeID() == anAttributeOnStart;
       }
       else if (isTangentArc(aFOperation, module()->sketchMgr()->activeSketch())) {
-        anAttributeOnStart = SketchPlugin_Arc::TANGENT_POINT_ID();
+        anAttributeOnStart = SketchPlugin_MacroArc::TANGENT_POINT_ID();
         isArcFeature = anActiveWidget->attributeID() == anAttributeOnStart;
       }
       bool aCanBeActivatedByMove = isLineFeature || isArcFeature;
@@ -656,32 +656,32 @@ bool PartSet_SketcherReentrantMgr::copyReetntrantAttributes(const FeaturePtr& th
     //ModuleBase_Tools::flushUpdated(theNewFeature);
     aChanged = true;
   }
-  else if (aFeatureKind == SketchPlugin_Arc::ID()) {
+  else if (aFeatureKind == SketchPlugin_MacroArc::ID()) {
     // set arc type
-    std::string aTypeAttributeId = SketchPlugin_Arc::ARC_TYPE();
+    std::string aTypeAttributeId = SketchPlugin_MacroArc::ARC_TYPE();
     AttributeStringPtr aSourceFeatureTypeAttr = theSourceFeature->data()->string(aTypeAttributeId);
     AttributeStringPtr aNewFeatureTypeAttr = theNewFeature->data()->string(aTypeAttributeId);
     aNewFeatureTypeAttr->setValue(aSourceFeatureTypeAttr->value());
 
-    // if the arc is tangent, set coincidence to end point of the previous arc
-    std::string anArcType = aSourceFeatureTypeAttr->value();
-    if (anArcType == SketchPlugin_Arc::ARC_TYPE_TANGENT()) {
-      // get the last point of the previuos arc feature(geom point 2d)
-      std::shared_ptr<ModelAPI_Data> aSData = theSourceFeature->data();
-      std::shared_ptr<GeomDataAPI_Point2D> aSPointAttr =
-                                      std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-                                      aSData->attribute(SketchPlugin_Arc::END_ID()));
-      // get point attribute on the current feature
-      AttributeRefAttrPtr aTangentPointAttr = theNewFeature->data()->refattr(
-                                                    SketchPlugin_Arc::TANGENT_POINT_ID());
-      aTangentPointAttr->setAttr(aSPointAttr);
-
-      std::shared_ptr<GeomDataAPI_Point2D> aNPointAttr =
-                                    std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-                                    theNewFeature->data()->attribute(SketchPlugin_Arc::END_ID()));
-      aNPointAttr->setValue(aSPointAttr->x(), aSPointAttr->y());
-
-    }
+    //// if the arc is tangent, set coincidence to end point of the previous arc
+    //std::string anArcType = aSourceFeatureTypeAttr->value();
+    //if (anArcType == SketchPlugin_Arc::ARC_TYPE_TANGENT()) {
+    //  // get the last point of the previuos arc feature(geom point 2d)
+    //  std::shared_ptr<ModelAPI_Data> aSData = theSourceFeature->data();
+    //  std::shared_ptr<GeomDataAPI_Point2D> aSPointAttr =
+    //                                  std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+    //                                  aSData->attribute(SketchPlugin_Arc::END_ID()));
+    //  // get point attribute on the current feature
+    //  AttributeRefAttrPtr aTangentPointAttr = theNewFeature->data()->refattr(
+    //                                                SketchPlugin_Arc::TANGENT_POINT_ID());
+    //  aTangentPointAttr->setAttr(aSPointAttr);
+
+    //  std::shared_ptr<GeomDataAPI_Point2D> aNPointAttr =
+    //                                std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+    //                                theNewFeature->data()->attribute(SketchPlugin_Arc::END_ID()));
+    //  aNPointAttr->setValue(aSPointAttr->x(), aSPointAttr->y());
+
+    //}
     //ModuleBase_Tools::flushUpdated(theNewFeature);
     aChanged = true;
   }
@@ -696,10 +696,10 @@ bool PartSet_SketcherReentrantMgr::isTangentArc(ModuleBase_Operation* theOperati
                                                                         (theOperation);
   if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
     FeaturePtr aFeature = aFOperation->feature();
-    if (aFeature.get() && aFeature->getKind() == SketchPlugin_Arc::ID()) {
-      AttributeStringPtr aTypeAttr = aFeature->data()->string(SketchPlugin_Arc::ARC_TYPE());
+    if (aFeature.get() && aFeature->getKind() == SketchPlugin_MacroArc::ID()) {
+      AttributeStringPtr aTypeAttr = aFeature->data()->string(SketchPlugin_MacroArc::ARC_TYPE());
       std::string anArcType = aTypeAttr.get() ? aTypeAttr->value() : "";
-      aTangentArc = anArcType == SketchPlugin_Arc::ARC_TYPE_TANGENT();
+      aTangentArc = anArcType == SketchPlugin_MacroArc::ARC_TYPE_BY_TANGENT_EDGE();
     }
   }
   return aTangentArc;
index 2099f347c5d36ff1a80e5874a76d79d427651c92..37cee3d6771e9b9e6eea108280de8353a0fd1a13 100755 (executable)
@@ -383,7 +383,7 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap
         // Create arc
         aMyFeature = theSketch->addFeature(SketchPlugin_Arc::ID());
         if (theShape.Orientation() == TopAbs_REVERSED)
-          aMyFeature->boolean(SketchPlugin_Arc::INVERSED_ID())->setValue(true);
+          aMyFeature->boolean(SketchPlugin_Arc::REVERSED_ID())->setValue(true);
       }
       else {
         // Create circle
index 0b8b8914a08eb9939bc1c65699557f0440b74cb2..e4347d3d4df9f9089dfe27cd45179805c538b706 100644 (file)
@@ -9,6 +9,7 @@ SET(PROJECT_HEADERS
   SketchAPI_Constraint.h
   SketchAPI_IntersectionPoint.h
   SketchAPI_Line.h
+  SketchAPI_MacroArc.h
   SketchAPI_MacroCircle.h
   SketchAPI_Mirror.h
   SketchAPI_Sketch.h
@@ -26,6 +27,7 @@ SET(PROJECT_SOURCES
   SketchAPI_Constraint.cpp
   SketchAPI_IntersectionPoint.cpp
   SketchAPI_Line.cpp
+  SketchAPI_MacroArc.cpp
   SketchAPI_MacroCircle.cpp
   SketchAPI_Mirror.cpp
   SketchAPI_Sketch.cpp
index c5ceee14d12f040edfa6c2e294960b48d19cceee..3f1be962413995f2ee7855de5f39381249806ef4 100644 (file)
@@ -26,6 +26,7 @@
 
 // shared pointers
 %shared_ptr(SketchAPI_Arc)
+%shared_ptr(SketchAPI_MacroArc)
 %shared_ptr(SketchAPI_Circle)
 %shared_ptr(SketchAPI_MacroCircle)
 %shared_ptr(SketchAPI_Constraint)
 %include "SketchAPI_Circle.h"
 %include "SketchAPI_MacroCircle.h"
 %include "SketchAPI_Arc.h"
+%include "SketchAPI_MacroArc.h"
 %include "SketchAPI_Projection.h"
 %include "SketchAPI_Mirror.h"
 %include "SketchAPI_Translation.h"
index d281c3af35ea006d9a7963af6ef644600bfc4eff..d6a84f60feb007f3c9953cea25ddb18794e28266 100644 (file)
@@ -53,54 +53,6 @@ SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature
   }
 }
 
-//================================================================================================
-SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                             double theStartX, double theStartY,
-                             double theEndX, double theEndY,
-                             double thePassedX, double thePassedY)
-: SketchAPI_SketchEntity(theFeature)
-{
-  if (initialize()) {
-    setByStartEndPassed(theStartX, theStartY, theEndX, theEndY, thePassedX, thePassedY);
-  }
-}
-
-//===============================================================================================
-SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                             const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
-                             const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
-                             const std::shared_ptr<GeomAPI_Pnt2d>& thePassed)
-: SketchAPI_SketchEntity(theFeature)
-{
-  if (initialize()) {
-    setByStartEndPassed(theStart, theEnd, thePassed);
-  }
-}
-
-//================================================================================================
-SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                             const ModelHighAPI_RefAttr& theTangentPoint,
-                             double theEndX, double theEndY,
-                             bool theInversed)
-: SketchAPI_SketchEntity(theFeature)
-{
-  if (initialize()) {
-    setByTangent(theTangentPoint, theEndX, theEndY, theInversed);
-  }
-}
-
-//================================================================================================
-SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                             const ModelHighAPI_RefAttr& theTangentPoint,
-                             const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
-                             bool theInversed)
-: SketchAPI_SketchEntity(theFeature)
-{
-  if (initialize()) {
-    setByTangent(theTangentPoint, theEnd, theInversed);
-  }
-}
-
 //================================================================================================
 SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                              const ModelHighAPI_Selection& theExternal)
@@ -133,11 +85,10 @@ void SketchAPI_Arc::setByCenterStartEnd(double theCenterX, double theCenterY,
                                         double theEndX, double theEndY,
                                         bool theInversed)
 {
-  fillAttribute(SketchPlugin_Arc::ARC_TYPE_CENTER_START_END(), myarcType);
   fillAttribute(center(), theCenterX, theCenterY);
   fillAttribute(startPoint(), theStartX, theStartY);
   fillAttribute(endPoint(), theEndX, theEndY);
-  fillAttribute(theInversed, myinversed);
+  fillAttribute(theInversed, myreversed);
 
   execute();
 }
@@ -148,63 +99,10 @@ void SketchAPI_Arc::setByCenterStartEnd(const std::shared_ptr<GeomAPI_Pnt2d>& th
                                         const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
                                         bool theInversed)
 {
-  fillAttribute(SketchPlugin_Arc::ARC_TYPE_CENTER_START_END(), myarcType);
   fillAttribute(theCenter, mycenter);
   fillAttribute(theStart, mystartPoint);
   fillAttribute(theEnd, myendPoint);
-  fillAttribute(theInversed, myinversed);
-
-  execute();
-}
-
-//================================================================================================
-void SketchAPI_Arc::setByStartEndPassed(double theStartX, double theStartY,
-                                        double theEndX, double theEndY,
-                                        double thePassedX, double thePassedY)
-{
-  fillAttribute(SketchPlugin_Arc::ARC_TYPE_THREE_POINTS(), myarcType);
-  fillAttribute(startPoint(), theStartX, theStartY);
-  fillAttribute(endPoint(), theEndX, theEndY);
-  fillAttribute(passedPoint(), thePassedX, thePassedY);
-
-  execute();
-}
-
-//================================================================================================
-void SketchAPI_Arc::setByStartEndPassed(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
-                                        const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
-                                        const std::shared_ptr<GeomAPI_Pnt2d>& thePassed)
-{
-  fillAttribute(SketchPlugin_Arc::ARC_TYPE_THREE_POINTS(), myarcType);
-  fillAttribute(theStart, mystartPoint);
-  fillAttribute(theEnd, myendPoint);
-  fillAttribute(thePassed, mypassedPoint);
-
-  execute();
-}
-
-//================================================================================================
-void SketchAPI_Arc::setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
-                                 double theEndX, double theEndY,
-                                 bool theInversed)
-{
-  fillAttribute(SketchPlugin_Arc::ARC_TYPE_TANGENT(), myarcType);
-  fillAttribute(theTangentPoint, mytangentPoint);
-  fillAttribute(endPoint(), theEndX, theEndY);
-  fillAttribute(theInversed, myinversed);
-
-  execute();
-}
-
-//================================================================================================
-void SketchAPI_Arc::setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
-                                 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
-                                 bool theInversed)
-{
-  fillAttribute(SketchPlugin_Arc::ARC_TYPE_TANGENT(), myarcType);
-  fillAttribute(theTangentPoint, mytangentPoint);
-  fillAttribute(theEnd, myendPoint);
-  fillAttribute(theInversed, myinversed);
+  fillAttribute(theInversed, myreversed);
 
   execute();
 }
@@ -225,22 +123,6 @@ void SketchAPI_Arc::setByExternalName(const std::string & theExternalName)
   execute();
 }
 
-//===============================================================================================
-void SketchAPI_Arc::setRadius(double theRadius)
-{
-  fillAttribute(ModelHighAPI_Double(theRadius), myradius);
-
-  execute();
-}
-
-//================================================================================================
-void SketchAPI_Arc::setAngle(double theAngle)
-{
-  fillAttribute(ModelHighAPI_Double(theAngle), myangle);
-
-  execute();
-}
-
 //================================================================================================
 void SketchAPI_Arc::dump(ModelHighAPI_Dumper& theDumper) const
 {
@@ -255,85 +137,10 @@ void SketchAPI_Arc::dump(ModelHighAPI_Dumper& theDumper) const
     // arc is external
     theDumper << aBase << " = " << aSketchName << ".addArc(" << anExternal << ")" << std::endl;
   } else {
-    AttributeStringPtr aType = arcType();
-    if (aType->value() == SketchPlugin_Arc::ARC_TYPE_CENTER_START_END()) {
-      // arc given by center and start, end points
-      theDumper << aBase << " = " << aSketchName << ".addArc(" << center() << ", "
-                << startPoint() << ", " << endPoint() << ", " << inversed() << ")" << std::endl;
-    } else if (aType->value() == SketchPlugin_Arc::ARC_TYPE_THREE_POINTS()) {
-      // arc given by three points
-      theDumper << aBase << " = " << aSketchName << ".addArc(" << startPoint() << ", "
-                << endPoint() << ", " << passedPoint() << ")" << std::endl;
-    } else {
-      // do not dump coincidence and tangency constraint built by tangent arc
-      std::list<FeaturePtr> aConstraintsToSkip = tangentArcConstraints(aBase);
-      std::list<FeaturePtr>::iterator anIt = aConstraintsToSkip.begin();
-      for (; anIt != aConstraintsToSkip.end(); ++anIt)
-        theDumper.doNotDumpFeature(*anIt);
-
-      // tangent arc
-      AttributeRefAttrPtr aTangentPoint = tangentPoint();
-      theDumper << aBase << " = " << aSketchName << ".addArc("
-                << aTangentPoint << ", " << endPoint() << ", " << inversed() << ")" << std::endl;
-    }
+    // arc given by center and start, end points
+    theDumper << aBase << " = " << aSketchName << ".addArc(" << center() << ", "
+              << startPoint() << ", " << endPoint() << ", " << reversed() << ")" << std::endl;
   }
   // dump "auxiliary" flag if necessary
   SketchAPI_SketchEntity::dump(theDumper);
 }
-
-
-// ====================   Auxiliary functions   ===============================
-std::list<FeaturePtr> tangentArcConstraints(const FeaturePtr& theArc)
-{
-  std::list<FeaturePtr> aConstraints;
-
-  std::set<FeaturePtr> aCoincidences;
-  std::set<FeaturePtr> aTangencies;
-
-  const std::set<AttributePtr>& aBaseRefs = theArc->data()->refsToMe();
-  std::set<AttributePtr>::const_iterator anIt = aBaseRefs.begin();
-  for (; anIt != aBaseRefs.end(); ++anIt) {
-    FeaturePtr anOwner = ModelAPI_Feature::feature((*anIt)->owner());
-    if (anOwner->getKind() == SketchPlugin_ConstraintCoincidence::ID())
-      aCoincidences.insert(anOwner);
-  }
-  const std::set<AttributePtr>& aBaseResultRefs = theArc->lastResult()->data()->refsToMe();
-  for (anIt = aBaseResultRefs.begin(); anIt != aBaseResultRefs.end(); ++anIt) {
-    FeaturePtr anOwner = ModelAPI_Feature::feature((*anIt)->owner());
-    if (anOwner->getKind() == SketchPlugin_ConstraintTangent::ID())
-      aTangencies.insert(anOwner);
-  }
-
-  AttributePtr aTangentPoint = theArc->refattr(SketchPlugin_Arc::TANGENT_POINT_ID())->attr();
-  if (aTangentPoint) {
-    FeaturePtr aTangentFeature = ModelAPI_Feature::feature(aTangentPoint->owner());
-
-    const std::set<AttributePtr>& aTgRefs = aTangentFeature->data()->refsToMe();
-    for (anIt = aTgRefs.begin(); anIt != aTgRefs.end(); ++anIt) {
-      FeaturePtr anOwner = ModelAPI_Feature::feature((*anIt)->owner());
-      if (aCoincidences.find(anOwner) != aCoincidences.end()) {
-        // check the coincidence is correct
-        AttributePtr aConstrained1 = anOwner->refattr(SketchPlugin_Constraint::ENTITY_A())->attr();
-        AttributePtr aConstrained2 = anOwner->refattr(SketchPlugin_Constraint::ENTITY_B())->attr();
-        AttributePtr anArcStartPoint = theArc->attribute(SketchPlugin_Arc::START_ID());
-        if ((aConstrained1 == anArcStartPoint && aConstrained2 == aTangentPoint) ||
-            (aConstrained1 == aTangentPoint && aConstrained2 == anArcStartPoint)) {
-          aConstraints.push_back(anOwner);
-          break; // search first applicable coincidence only
-        }
-      }
-    }
-
-    const std::set<AttributePtr>& aTgResultRefs =
-        aTangentFeature->lastResult()->data()->refsToMe();
-    for (anIt = aTgResultRefs.begin(); anIt != aTgResultRefs.end(); ++anIt) {
-      FeaturePtr anOwner = ModelAPI_Feature::feature((*anIt)->owner());
-      if (aTangencies.find(anOwner) != aTangencies.end()) {
-        aConstraints.push_back(anOwner);
-        break; // search first tangency only
-      }
-    }
-  }
-
-  return aConstraints;
-}
index c1d302377f4473e6ec4fe8948fda3fff46859566..b0123d4aea54e1d5de76d77ee6ccc1e06d0655bb 100644 (file)
@@ -43,34 +43,6 @@ public:
                 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
                 bool theInversed);
 
-  /// Constructor with values.
-  SKETCHAPI_EXPORT
-  SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                double theStartX, double theStartY,
-                double theEndX, double theEndY,
-                double thePassedX, double thePassedY);
-
-  /// Constructor with values.
-  SKETCHAPI_EXPORT
-  SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
-                const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
-                const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
-
-  /// Constructor with values.
-  SKETCHAPI_EXPORT
-  SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                const ModelHighAPI_RefAttr& theTangentPoint,
-                double theEndX, double theEndY,
-                bool theInversed);
-
-  /// Constructor with values.
-  SKETCHAPI_EXPORT
-  SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                const ModelHighAPI_RefAttr& theTangentPoint,
-                const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
-                bool theInversed);
-
   /// Constructor with values.
   SKETCHAPI_EXPORT
   SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
@@ -85,21 +57,15 @@ public:
   SKETCHAPI_EXPORT
   virtual ~SketchAPI_Arc();
 
-  INTERFACE_10(SketchPlugin_Arc::ID(),
-               arcType, SketchPlugin_Arc::ARC_TYPE(),
-               ModelAPI_AttributeString, /** Arc type */,
+  INTERFACE_7(SketchPlugin_Arc::ID(),
                center, SketchPlugin_Arc::CENTER_ID(),
                GeomDataAPI_Point2D, /** Center point */,
                startPoint, SketchPlugin_Arc::START_ID(),
                GeomDataAPI_Point2D, /** Start point */,
                endPoint, SketchPlugin_Arc::END_ID(),
                GeomDataAPI_Point2D, /** End point */,
-               inversed, SketchPlugin_Arc::INVERSED_ID(),
+               reversed, SketchPlugin_Arc::REVERSED_ID(),
                ModelAPI_AttributeBoolean, /** Inversed flag */,
-               passedPoint, SketchPlugin_Arc::PASSED_POINT_ID(),
-               GeomDataAPI_Point2D, /** Passed point */,
-               tangentPoint, SketchPlugin_Arc::TANGENT_POINT_ID(),
-               ModelAPI_AttributeRefAttr, /** Tangent point */,
                radius, SketchPlugin_Arc::RADIUS_ID(),
                ModelAPI_AttributeDouble, /** Radius */,
                angle, SketchPlugin_Arc::ANGLE_ID(),
@@ -121,30 +87,6 @@ public:
                            const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
                            bool theInversed);
 
-  /// Set by start, end and passed points.
-  SKETCHAPI_EXPORT
-  void setByStartEndPassed(double theStartX, double theStartY,
-                           double theEndX, double theEndY,
-                           double thePassedX, double thePassedY);
-
-  /// Set by start, end and passed points.
-  SKETCHAPI_EXPORT
-  void setByStartEndPassed(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
-                           const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
-                           const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
-
-  /// Set by tangent and end point.
-  SKETCHAPI_EXPORT
-  void setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
-                    double theEndX, double theEndY,
-                    bool theInversed);
-
-  /// Set by tangent and end point.
-  SKETCHAPI_EXPORT
-  void setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
-                    const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
-                    bool theInversed);
-
   /// Set by external.
   SKETCHAPI_EXPORT
   void setByExternal(const ModelHighAPI_Selection& theExternal);
@@ -153,14 +95,6 @@ public:
   SKETCHAPI_EXPORT
   void setByExternalName(const std::string& theExternalName);
 
-  /// Set radius.
-  SKETCHAPI_EXPORT
-  void setRadius(double theRadius);
-
-  /// Set angle.
-  SKETCHAPI_EXPORT
-  void setAngle(double theAngle);
-
   /// Dump wrapped feature
   SKETCHAPI_EXPORT
   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
diff --git a/src/SketchAPI/SketchAPI_MacroArc.cpp b/src/SketchAPI/SketchAPI_MacroArc.cpp
new file mode 100644 (file)
index 0000000..2fa73d5
--- /dev/null
@@ -0,0 +1,190 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        SketchAPI_MacroArc.cpp
+// Created:     09 June 2016
+// Author:      Dmitry Bobylev
+
+#include "SketchAPI_MacroArc.h"
+
+#include <GeomAPI_Pnt2d.h>
+
+#include <ModelHighAPI_Double.h>
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+#include <SketchPlugin_ConstraintCoincidence.h>
+#include <SketchPlugin_ConstraintTangent.h>
+
+/// Obtain constraints prepared by tangent arc
+static std::list<FeaturePtr> tangentArcConstraints(const FeaturePtr& theArc);
+
+//================================================================================================
+SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+  initialize();
+}
+
+//================================================================================================
+SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                             double theCenterX, double theCenterY,
+                             double theStartX, double theStartY,
+                             double theEndX, double theEndY,
+                             bool theInversed)
+: SketchAPI_SketchEntity(theFeature)
+{
+  if(initialize()) {
+    setByCenterStartEnd(theCenterX, theCenterY, theStartX,
+                        theStartY, theEndX, theEndY, theInversed);
+  }
+}
+
+//================================================================================================
+SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                             const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+                             const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+                             const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                             bool theInversed)
+: SketchAPI_SketchEntity(theFeature)
+{
+  if(initialize()) {
+    setByCenterStartEnd(theCenter, theStart, theEnd, theInversed);
+  }
+}
+
+//================================================================================================
+SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                             double theStartX, double theStartY,
+                             double theEndX, double theEndY,
+                             double thePassedX, double thePassedY)
+: SketchAPI_SketchEntity(theFeature)
+{
+  if (initialize()) {
+    setByStartEndPassed(theStartX, theStartY, theEndX, theEndY, thePassedX, thePassedY);
+  }
+}
+
+//===============================================================================================
+SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                             const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+                             const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                             const std::shared_ptr<GeomAPI_Pnt2d>& thePassed)
+: SketchAPI_SketchEntity(theFeature)
+{
+  if (initialize()) {
+    setByStartEndPassed(theStart, theEnd, thePassed);
+  }
+}
+
+//================================================================================================
+SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                             const ModelHighAPI_RefAttr& theTangentPoint,
+                             double theEndX, double theEndY,
+                             bool theInversed)
+: SketchAPI_SketchEntity(theFeature)
+{
+  if (initialize()) {
+    setByTangent(theTangentPoint, theEndX, theEndY, theInversed);
+  }
+}
+
+//================================================================================================
+SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                             const ModelHighAPI_RefAttr& theTangentPoint,
+                             const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                             bool theInversed)
+: SketchAPI_SketchEntity(theFeature)
+{
+  if (initialize()) {
+    setByTangent(theTangentPoint, theEnd, theInversed);
+  }
+}
+
+//================================================================================================
+SketchAPI_MacroArc::~SketchAPI_MacroArc()
+{
+
+}
+
+//================================================================================================
+void SketchAPI_MacroArc::setByCenterStartEnd(double theCenterX, double theCenterY,
+                                        double theStartX, double theStartY,
+                                        double theEndX, double theEndY,
+                                        bool theInversed)
+{
+  fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_CENTER_AND_POINTS(), myarcType);
+  fillAttribute(center(), theCenterX, theCenterY);
+  fillAttribute(startPoint1(), theStartX, theStartY);
+  fillAttribute(endPoint1(), theEndX, theEndY);
+  fillAttribute(theInversed, myreversed);
+
+  execute();
+}
+
+//================================================================================================
+void SketchAPI_MacroArc::setByCenterStartEnd(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+                                        const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+                                        const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                                        bool theInversed)
+{
+  fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_CENTER_AND_POINTS(), myarcType);
+  fillAttribute(theCenter, mycenter);
+  fillAttribute(theStart, mystartPoint1);
+  fillAttribute(theEnd, myendPoint1);
+  fillAttribute(theInversed, myreversed);
+
+  execute();
+}
+
+//================================================================================================
+void SketchAPI_MacroArc::setByStartEndPassed(double theStartX, double theStartY,
+                                        double theEndX, double theEndY,
+                                        double thePassedX, double thePassedY)
+{
+  fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_THREE_POINTS(), myarcType);
+  fillAttribute(startPoint2(), theStartX, theStartY);
+  fillAttribute(endPoint2(), theEndX, theEndY);
+  fillAttribute(passedPoint(), thePassedX, thePassedY);
+
+  execute();
+}
+
+//================================================================================================
+void SketchAPI_MacroArc::setByStartEndPassed(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+                                        const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                                        const std::shared_ptr<GeomAPI_Pnt2d>& thePassed)
+{
+  fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_THREE_POINTS(), myarcType);
+  fillAttribute(theStart, mystartPoint2);
+  fillAttribute(theEnd, myendPoint2);
+  fillAttribute(thePassed, mypassedPoint);
+
+  execute();
+}
+
+//================================================================================================
+void SketchAPI_MacroArc::setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
+                                 double theEndX, double theEndY,
+                                 bool theInversed)
+{
+  fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_TANGENT_EDGE(), myarcType);
+  fillAttribute(theTangentPoint, mytangentPoint);
+  fillAttribute(endPoint3(), theEndX, theEndY);
+  fillAttribute(theInversed, myreversed);
+
+  execute();
+}
+
+//================================================================================================
+void SketchAPI_MacroArc::setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
+                                 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                                 bool theInversed)
+{
+  fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_TANGENT_EDGE(), myarcType);
+  fillAttribute(theTangentPoint, mytangentPoint);
+  fillAttribute(theEnd, myendPoint3);
+  fillAttribute(theInversed, myreversed);
+
+  execute();
+}
diff --git a/src/SketchAPI/SketchAPI_MacroArc.h b/src/SketchAPI/SketchAPI_MacroArc.h
new file mode 100644 (file)
index 0000000..c24e247
--- /dev/null
@@ -0,0 +1,152 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        SketchAPI_MacroArc.h
+// Created:     09 June 2016
+// Author:      Dmitry Bobylev
+
+#ifndef SketchAPI_MacroArc_H_
+#define SketchAPI_MacroArc_H_
+
+#include "SketchAPI.h"
+#include "SketchAPI_SketchEntity.h"
+
+#include <GeomDataAPI_Point2D.h>
+
+#include <SketchPlugin_MacroArc.h>
+
+class ModelHighAPI_RefAttr;
+class ModelHighAPI_Selection;
+
+/// \class SketchAPI_MacroArc
+/// \ingroup CPPHighAPI
+/// \brief Interface for Arc feature.
+class SketchAPI_MacroArc: public SketchAPI_SketchEntity
+{
+public:
+  /// Constructor without values.
+  SKETCHAPI_EXPORT
+  explicit SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+  /// Constructor with values.
+  SKETCHAPI_EXPORT
+  SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                double theCenterX, double theCenterY,
+                double theStartX, double theStartY,
+                double theEndX, double theEndY,
+                bool theInversed);
+
+  /// Constructor with values.
+  SKETCHAPI_EXPORT
+  SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+                const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+                const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                bool theInversed);
+
+  /// Constructor with values.
+  SKETCHAPI_EXPORT
+  SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                double theStartX, double theStartY,
+                double theEndX, double theEndY,
+                double thePassedX, double thePassedY);
+
+  /// Constructor with values.
+  SKETCHAPI_EXPORT
+  SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+                const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
+
+  /// Constructor with values.
+  SKETCHAPI_EXPORT
+  SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                const ModelHighAPI_RefAttr& theTangentPoint,
+                double theEndX, double theEndY,
+                bool theInversed);
+
+  /// Constructor with values.
+  SKETCHAPI_EXPORT
+  SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                const ModelHighAPI_RefAttr& theTangentPoint,
+                const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                bool theInversed);
+
+  /// Destructor.
+  SKETCHAPI_EXPORT
+  virtual ~SketchAPI_MacroArc();
+
+  void test() {
+    SketchPlugin_MacroArc::ID();
+  }
+
+  INTERFACE_12(SketchPlugin_MacroArc::ID(),
+               arcType, SketchPlugin_MacroArc::ARC_TYPE(),
+               ModelAPI_AttributeString, /** Arc type */,
+               center, SketchPlugin_MacroArc::CENTER_POINT_ID(),
+               GeomDataAPI_Point2D, /** Center point */,
+               startPoint1, SketchPlugin_MacroArc::START_POINT_1_ID(),
+               GeomDataAPI_Point2D, /** Start point */,
+               endPoint1, SketchPlugin_MacroArc::END_POINT_1_ID(),
+               GeomDataAPI_Point2D, /** End point */,
+               startPoint2, SketchPlugin_MacroArc::START_POINT_2_ID(),
+               GeomDataAPI_Point2D, /** Start point */,
+               endPoint2, SketchPlugin_MacroArc::END_POINT_2_ID(),
+               GeomDataAPI_Point2D, /** End point */,
+               passedPoint, SketchPlugin_MacroArc::PASSED_POINT_ID(),
+               GeomDataAPI_Point2D, /** Passed point */,
+               tangentPoint, SketchPlugin_MacroArc::TANGENT_POINT_ID(),
+               ModelAPI_AttributeRefAttr, /** Tangent point */,
+               endPoint3, SketchPlugin_MacroArc::END_POINT_3_ID(),
+               GeomDataAPI_Point2D, /** End point */,
+               reversed, SketchPlugin_MacroArc::REVERSED_ID(),
+               ModelAPI_AttributeBoolean, /** Reversed flag */,
+               radius, SketchPlugin_MacroArc::RADIUS_ID(),
+               ModelAPI_AttributeDouble, /** Radius */,
+               angle, SketchPlugin_MacroArc::ANGLE_ID(),
+               ModelAPI_AttributeDouble, /** Angle */)
+
+private:
+
+  /// Set by center and start, end point.
+  SKETCHAPI_EXPORT
+  void setByCenterStartEnd(double theCenterX, double theCenterY,
+                           double theStartX, double theStartY,
+                           double theEndX, double theEndY,
+                           bool theInversed);
+
+  /// Set by center and start, end point.
+  SKETCHAPI_EXPORT
+  void setByCenterStartEnd(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+                           const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+                           const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                           bool theInversed);
+
+  /// Set by start, end and passed points.
+  SKETCHAPI_EXPORT
+  void setByStartEndPassed(double theStartX, double theStartY,
+                           double theEndX, double theEndY,
+                           double thePassedX, double thePassedY);
+
+  /// Set by start, end and passed points.
+  SKETCHAPI_EXPORT
+  void setByStartEndPassed(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+                           const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                           const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
+
+  /// Set by tangent and end point.
+  SKETCHAPI_EXPORT
+  void setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
+                    double theEndX, double theEndY,
+                    bool theInversed);
+
+  /// Set by tangent and end point.
+  SKETCHAPI_EXPORT
+  void setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
+                    const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+                    bool theInversed);
+};
+
+/// Pointer on Arc object.
+typedef std::shared_ptr<SketchAPI_MacroArc> MacroArcPtr;
+
+#endif // SketchAPI_MacroArc_H_
index e126efdfa69c7812e413f467d299b58f9ff558d1..edfef921b088ac3602d476de1dbed9eba01e42d6 100644 (file)
@@ -39,6 +39,7 @@
 #include <ModelHighAPI_Tools.h>
 //--------------------------------------------------------------------------------------
 #include "SketchAPI_Arc.h"
+#include "SketchAPI_MacroArc.h"
 #include "SketchAPI_Circle.h"
 #include "SketchAPI_IntersectionPoint.h"
 #include "SketchAPI_Line.h"
@@ -378,46 +379,46 @@ std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(
   return ArcPtr(new SketchAPI_Arc(aFeature, theCenter, theStart, theEnd, theInversed));
 }
 
-std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(double theStartX, double theStartY,
+std::shared_ptr<SketchAPI_MacroArc> SketchAPI_Sketch::addArc(double theStartX, double theStartY,
                                                         double theEndX, double theEndY,
                                                         double thePassedX, double thePassedY)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_Arc::ID());
-  return ArcPtr(new SketchAPI_Arc(aFeature,
-                                  theStartX, theStartY,
-                                  theEndX, theEndY,
-                                  thePassedX, thePassedY));
+  return MacroArcPtr(new SketchAPI_MacroArc(aFeature,
+                                       theStartX, theStartY,
+                                       theEndX, theEndY,
+                                       thePassedX, thePassedY));
 }
 
-std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(
+std::shared_ptr<SketchAPI_MacroArc> SketchAPI_Sketch::addArc(
                                                 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
                                                 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
                                                 const std::shared_ptr<GeomAPI_Pnt2d>& thePassed)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_Arc::ID());
-  return ArcPtr(new SketchAPI_Arc(aFeature, theStart, theEnd, thePassed));
+  return MacroArcPtr(new SketchAPI_MacroArc(aFeature, theStart, theEnd, thePassed));
 }
 
-std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(
+std::shared_ptr<SketchAPI_MacroArc> SketchAPI_Sketch::addArc(
                                                 const ModelHighAPI_RefAttr& theTangentPoint,
                                                 double theEndX, double theEndY,
                                                 bool theInversed)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_Arc::ID());
-  return ArcPtr(new SketchAPI_Arc(aFeature, theTangentPoint, theEndX, theEndY, theInversed));
+  return MacroArcPtr(new SketchAPI_MacroArc(aFeature, theTangentPoint, theEndX, theEndY, theInversed));
 }
 
-std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(
+std::shared_ptr<SketchAPI_MacroArc> SketchAPI_Sketch::addArc(
                                               const ModelHighAPI_RefAttr& theTangentPoint,
                                               const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
                                               bool theInversed)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_Arc::ID());
-  return ArcPtr(new SketchAPI_Arc(aFeature, theTangentPoint, theEnd, theInversed));
+  return MacroArcPtr(new SketchAPI_MacroArc(aFeature, theTangentPoint, theEnd, theInversed));
 }
 
 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const ModelHighAPI_Selection & theExternal)
index 7e7082c14d1cad5821247fad6bbd9505520bae0d..843630f5bd9eaf9744d198ccd61efaff6dff49d9 100644 (file)
@@ -27,6 +27,7 @@ class ModelHighAPI_RefAttr;
 class ModelHighAPI_Reference;
 class ModelHighAPI_Selection;
 class SketchAPI_Arc;
+class SketchAPI_MacroArc;
 class SketchAPI_Circle;
 class SketchAPI_MacroCircle;
 class SketchAPI_IntersectionPoint;
@@ -200,28 +201,28 @@ public:
 
   /// Add arc
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Arc> addArc(
+  std::shared_ptr<SketchAPI_MacroArc> addArc(
       double theStartX, double theStartY,
       double theEndX, double theEndY,
       double thePassedX, double thePassedY);
 
   /// Add arc
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Arc> addArc(
+  std::shared_ptr<SketchAPI_MacroArc> addArc(
       const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
       const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
       const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
 
   /// Add arc
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Arc> addArc(
+  std::shared_ptr<SketchAPI_MacroArc> addArc(
       const ModelHighAPI_RefAttr& theTangentPoint,
       double theEndX, double theEndY,
       bool theInversed);
 
   /// Add arc
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Arc> addArc(
+  std::shared_ptr<SketchAPI_MacroArc> addArc(
       const ModelHighAPI_RefAttr& theTangentPoint,
       const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
       bool theInversed);
index 0bc5da6766c0c518811fc092018a55cf298cd584..264a26bcb51bbbdde5af654da9b6b7acfe6a5442 100644 (file)
@@ -11,6 +11,7 @@
 
   #include "SketchAPI.h"
   #include "SketchAPI_Arc.h"
+  #include "SketchAPI_MacroArc.h"
   #include "SketchAPI_Circle.h"
   #include "SketchAPI_MacroCircle.h"
   #include "SketchAPI_Constraint.h"
index 3319be80e6a18e1e155adc9c66675d47d1fddb6a..e752c7be1f45e5a92b2b6cb08a3b8a623173cea3 100644 (file)
@@ -43,303 +43,105 @@ const double tolerance = 1e-7;
 const double paramTolerance = 1.e-4;
 const double PI = 3.141592653589793238463;
 
-namespace {
-  static const std::string& POINT_ID(int theIndex)
-  {
-    switch (theIndex) {
-    case 1: return SketchPlugin_Arc::START_ID();
-    case 2: return SketchPlugin_Arc::END_ID();
-    case 3: return SketchPlugin_Arc::PASSED_POINT_ID();
-    }
-
-    static const std::string DUMMY;
-    return DUMMY;
-  }
-}
-
-
 
 SketchPlugin_Arc::SketchPlugin_Arc()
-    : SketchPlugin_SketchEntity()
+: SketchPlugin_SketchEntity()
 {
-  myStartUpdate = false;
-  myEndUpdate = false;
-  // default values
-  myXEndBefore = 0;
-  myYEndBefore = 0;
-
-  myParamBefore = PI * 2.0;
+  myParamBefore = 0.0;
 }
 
 void SketchPlugin_Arc::initDerivedClassAttributes()
 {
   data()->addAttribute(CENTER_ID(), GeomDataAPI_Point2D::typeId());
   data()->addAttribute(START_ID(), GeomDataAPI_Point2D::typeId());
-  std::shared_ptr<GeomDataAPI_Point2D> anEndAttr = std::dynamic_pointer_cast<
-    GeomDataAPI_Point2D>(data()->addAttribute(END_ID(), GeomDataAPI_Point2D::typeId()));
+  data()->addAttribute(END_ID(), GeomDataAPI_Point2D::typeId());
+
   data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID());
 
-  AttributeBooleanPtr isInversed = std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(
-    data()->addAttribute(INVERSED_ID(), ModelAPI_AttributeBoolean::typeId()));
-
-  // get the initial values
-  if (anEndAttr->isInitialized()) {
-    myXEndBefore = anEndAttr->x();
-    myYEndBefore = anEndAttr->y();
-  }
-
-  AttributeStringPtr anArcType = std::dynamic_pointer_cast<ModelAPI_AttributeString>(
-    data()->addAttribute(ARC_TYPE(), ModelAPI_AttributeString::typeId()));
+  AttributeBooleanPtr isReversed = std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(
+    data()->addAttribute(REVERSED_ID(), ModelAPI_AttributeBoolean::typeId()));
 
-  data()->addAttribute(PASSED_POINT_ID(), GeomDataAPI_Point2D::typeId());
-  data()->addAttribute(TANGENT_POINT_ID(), ModelAPI_AttributeRefAttr::typeId());
   data()->addAttribute(RADIUS_ID(), ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
 
   // set after all to avoid in attributeChanged reference to not existing attributes
-  if (!isInversed->isInitialized())
-    isInversed->setValue(false);
-  anArcType->setValue(ARC_TYPE_CENTER_START_END());
-
-  //data()->addAttribute(CENTER_REF_ID(), ModelAPI_AttributeRefAttr::typeId());
-  //ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CENTER_REF_ID());
+  if (!isReversed->isInitialized()) {
+    isReversed->setValue(false);
+  }
 }
 
 void SketchPlugin_Arc::execute()
 {
   SketchPlugin_Sketch* aSketch = sketch();
-  // result for the arc is set only when all obligatory attributes are initialized,
-  // otherwise AIS object is used to visualize the arc's preview
-  if (aSketch && isFeatureValid()) {
-    bool hasResult = lastResult().get() != NULL;
-
-    // compute a circle point in 3D view
-    std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = std::dynamic_pointer_cast<
-        GeomDataAPI_Point2D>(data()->attribute(CENTER_ID()));
-    // compute the arc start point
-    std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<
-        GeomDataAPI_Point2D>(data()->attribute(START_ID()));
-
-    std::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
-    // make a visible point
-    std::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::vertex(aCenter);
-    std::shared_ptr<ModelAPI_ResultConstruction> aConstr1 = document()->createConstruction(
-        data(), 0);
-    aConstr1->setShape(aCenterPointShape);
-    aConstr1->setIsInHistory(false);
-    setResult(aConstr1, 0);
-
-    // make a visible circle
-    std::shared_ptr<GeomDataAPI_Dir> aNDir = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
-        aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
-    std::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
-    std::shared_ptr<GeomAPI_Pnt> aStartPoint(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
-
-    // compute and change the arc end point
-    std::shared_ptr<GeomDataAPI_Point2D> anEndAttr = std::dynamic_pointer_cast<
-        GeomDataAPI_Point2D>(data()->attribute(END_ID()));
-    std::shared_ptr<GeomAPI_Circ2d> aCircleForArc(
-        new GeomAPI_Circ2d(aCenterAttr->pnt(), aStartAttr->pnt()));
-    std::shared_ptr<GeomAPI_Pnt2d> aProjection = aCircleForArc->project(anEndAttr->pnt());
-    if (aProjection && anEndAttr->pnt()->distance(aProjection) > tolerance)
-      anEndAttr->setValue(aProjection);
-    std::shared_ptr<GeomAPI_Pnt> aEndPoint(aSketch->to3D(anEndAttr->x(), anEndAttr->y()));
-    AttributeBooleanPtr isInversed =
-        std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(attribute(INVERSED_ID()));
-
-    // compute end parameter
-    aCircleForArc->parameter(anEndAttr->pnt(), paramTolerance, myParamBefore);
-
-    std::shared_ptr<GeomAPI_Shape> aCircleShape;
-    if(!isInversed->value()) {
-      aCircleShape =
-        GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStartPoint, aEndPoint, aNormal);
-    } else {
-      aCircleShape =
-        GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aEndPoint, aStartPoint, aNormal);
-    }
-
-    if (aCircleShape) {
-      std::shared_ptr<ModelAPI_ResultConstruction> aConstr2 = document()->createConstruction(
-          data(), 1);
-      aConstr2->setShape(aCircleShape);
-      aConstr2->setIsInHistory(false);
-      setResult(aConstr2, 1);
-    }
-
-    if (!hasResult && string(ARC_TYPE())->value() == ARC_TYPE_TANGENT()) {
-      // constraints for tangent arc have not been prepared yet, do them
-      tangencyArcConstraints();
-    }
+  if(!aSketch) {
+    return;
   }
-}
 
-AISObjectPtr SketchPlugin_Arc::getAISObject(AISObjectPtr thePrevious)
-{
-  SketchPlugin_Sketch* aSketch = sketch();
-  if (aSketch) {
-    // if the feature is valid, the execute() method should be performed, AIS object is empty
-    if (!isFeatureValid()) {
-      // compute a circle point in 3D view
-      std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = std::dynamic_pointer_cast<
-          GeomDataAPI_Point2D>(data()->attribute(CENTER_ID()));
-
-      std::list<std::shared_ptr<GeomAPI_Shape> > aShapes;
-      if (aCenterAttr->isInitialized()) {
-        std::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
-
-        std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<
-            GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::START_ID()));
-        std::shared_ptr<GeomDataAPI_Point2D> aEndAttr = std::dynamic_pointer_cast<
-            GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::END_ID()));
-        AttributeStringPtr aTypeAttr = std::dynamic_pointer_cast<ModelAPI_AttributeString>(
-            data()->attribute(ARC_TYPE()));
-
-        if (aStartAttr->isInitialized()) {
-          // make a visible circle
-          std::shared_ptr<GeomDataAPI_Dir> aNDir = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
-              aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
-          bool aHasPlane = aNDir && !(aNDir->x() == 0 && aNDir->y() == 0 && aNDir->z() == 0);
-          if (aHasPlane) {
-            std::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
-            std::shared_ptr<GeomAPI_Pnt>
-              aStartPoint(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
-            std::shared_ptr<GeomAPI_Pnt> aEndPoint = aStartPoint;
-            if (aTypeAttr && aTypeAttr->isInitialized() &&
-                aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
-              if (aEndAttr->isInitialized() && //
-                  aEndAttr->pnt()->distance(aStartAttr->pnt()) > tolerance) {
-                aEndPoint = aSketch->to3D(aEndAttr->x(), aEndAttr->y());
-                std::shared_ptr<GeomDataAPI_Point2D> aPassedAttr =
-                  std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-                  data()->attribute(PASSED_POINT_ID()));
-                if (!aPassedAttr->isInitialized()) {
-                  // calculate the appropriate center for the presentation
-                  // check that center is bad for the current start and end and must be recomputed
-                  std::shared_ptr<GeomAPI_Circ2d> aCircleForArc(new GeomAPI_Circ2d(
-                    aCenterAttr->pnt(), aStartAttr->pnt()));
-                  std::shared_ptr<GeomAPI_Pnt2d> aProjection =
-                    aCircleForArc->project(aEndAttr->pnt());
-                  if (!aProjection.get() || aEndAttr->pnt()->distance(aProjection) > tolerance) {
-                    std::shared_ptr<GeomAPI_XY> aDir =
-                      aEndAttr->pnt()->xy()->decreased(aStartAttr->pnt()->xy())->multiplied(0.5);
-                    double x = aDir->x();
-                    double y = aDir->y();
-                    aDir->setX(x - y);
-                    aDir->setY(y + x);
-                    std::shared_ptr<GeomAPI_XY> aCenterXY = aStartAttr->pnt()->xy()->added(aDir);
-                    aCenter = aSketch->to3D(aCenterXY->x(), aCenterXY->y());
-                  }
-                }
-              } else { // issue #1695: don't display circle if initialized only start point
-                return AISObjectPtr();
-              }
-            }
-            AttributeBooleanPtr isInversed =
-              std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(attribute(INVERSED_ID()));
-
-            std::shared_ptr<GeomAPI_Shape> aCircleShape =
-              (isInversed->isInitialized() && isInversed->value()) ?
-                GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aEndPoint, aStartPoint, aNormal) :
-                GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStartPoint, aEndPoint, aNormal);
-
-            if (aCircleShape)
-              aShapes.push_back(aCircleShape);
-          }
-        }
-        // make a visible point
-        std::shared_ptr<GeomAPI_Shape> aCenterPointShape =
-          GeomAlgoAPI_PointBuilder::vertex(aCenter);
-        aShapes.push_back(aCenterPointShape);
-      }
-      if (!aShapes.empty()) {
-        std::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
-        AISObjectPtr anAIS = thePrevious;
-        if (!anAIS)
-          anAIS = AISObjectPtr(new GeomAPI_AISObject);
-        anAIS->createShape(aCompound);
-        double aDeflection = Config_PropManager::real("Visualization", "construction_deflection");
-        anAIS->setDeflection(aDeflection);
-        anAIS->setWidth(3);
-        return anAIS;
-      }
-    }
+  std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr =
+      std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(CENTER_ID()));
+  std::shared_ptr<GeomDataAPI_Point2D> aStartAttr =
+      std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(START_ID()));
+  std::shared_ptr<GeomDataAPI_Point2D> anEndAttr =
+      std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(END_ID()));
+  if(!aCenterAttr->isInitialized() || !aStartAttr->isInitialized() || !anEndAttr->isInitialized()) {
+    return;
   }
-  return AISObjectPtr();
+
+  // Make a visible point.
+  SketchPlugin_Sketch::createPoint2DResult(this, sketch(), CENTER_ID(), 0);
+
+  // Make a visible arc.
+  std::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
+  std::shared_ptr<GeomAPI_Pnt> aStart(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
+  std::shared_ptr<GeomAPI_Pnt> anEnd(aSketch->to3D(anEndAttr->x(), anEndAttr->y()));
+  std::shared_ptr<GeomDataAPI_Dir> aNDir = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
+  std::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z()));
+
+  GeomShapePtr anArcShape = boolean(REVERSED_ID())->value() ?
+      GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, anEnd, aStart, aNormal)
+    : GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStart, anEnd, aNormal);
+
+  std::shared_ptr<ModelAPI_ResultConstruction> aResult = document()->createConstruction(data(), 1);
+  aResult->setShape(anArcShape);
+  aResult->setIsInHistory(false);
+  setResult(aResult, 1);
 }
 
 void SketchPlugin_Arc::move(double theDeltaX, double theDeltaY)
 {
   std::shared_ptr<ModelAPI_Data> aData = data();
-  if (!aData->isValid())
+  if(!aData->isValid()) {
     return;
+  }
 
   bool aWasBlocked = aData->blockSendAttributeUpdated(true);
 
-  myStartUpdate = true;
-  myEndUpdate = true;
-  std::shared_ptr<GeomDataAPI_Point2D> aPoint2 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-      aData->attribute(SketchPlugin_Arc::START_ID()));
-  if (aPoint2->isInitialized())
-    aPoint2->move(theDeltaX, theDeltaY);
-
-  std::shared_ptr<GeomDataAPI_Point2D> aPoint3 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-      aData->attribute(SketchPlugin_Arc::END_ID()));
-  if (aPoint3->isInitialized())
-    aPoint3->move(theDeltaX, theDeltaY);
-  myStartUpdate = false;
-  myEndUpdate = false;
-
-  std::shared_ptr<GeomDataAPI_Point2D> aPoint1 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-      aData->attribute(SketchPlugin_Arc::CENTER_ID()));
-  if (aPoint1->isInitialized())
-    aPoint1->move(theDeltaX, theDeltaY);
-
-  std::shared_ptr<GeomDataAPI_Point2D> aPassedPoint =
-      std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(PASSED_POINT_ID()));
-  if (aPassedPoint->isInitialized())
-    aPassedPoint->move(theDeltaX, theDeltaY);
-  aData->blockSendAttributeUpdated(aWasBlocked);
-}
+  std::shared_ptr<GeomDataAPI_Point2D> aCenter = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      attribute(CENTER_ID()));
+  if(aCenter->isInitialized()) {
+    aCenter->move(theDeltaX, theDeltaY);
+  }
 
-bool SketchPlugin_Arc::isFixed() {
-  return data()->selection(EXTERNAL_ID())->context().get() != NULL;
-}
+  std::shared_ptr<GeomDataAPI_Point2D> aStart = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      attribute(START_ID()));
+  if(aStart->isInitialized()) {
+    aStart->move(theDeltaX, theDeltaY);
+  }
 
-bool SketchPlugin_Arc::isFeatureValid()
-{
-  AttributeStringPtr anArcTypeAttr =
-      std::dynamic_pointer_cast<ModelAPI_AttributeString>(data()->attribute(ARC_TYPE()));
-  if (!anArcTypeAttr)
-    return false;
-  std::string anArcType = anArcTypeAttr->value();
+  std::shared_ptr<GeomDataAPI_Point2D> anEnd = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      attribute(END_ID()));
+  if(anEnd->isInitialized()) {
+    anEnd->move(theDeltaX, theDeltaY);
+  }
 
-  std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = std::dynamic_pointer_cast<
-      GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::CENTER_ID()));
-  std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<
-      GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::START_ID()));
-  std::shared_ptr<GeomDataAPI_Point2D> anEndAttr = std::dynamic_pointer_cast<
-      GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::END_ID()));
-  std::shared_ptr<GeomDataAPI_Point2D> aPassedAttr = std::dynamic_pointer_cast<
-      GeomDataAPI_Point2D>(data()->attribute(PASSED_POINT_ID()));
-
-  bool isValid = false;
-  if (anArcType == ARC_TYPE_THREE_POINTS())
-    isValid = aStartAttr->isInitialized() &&
-      anEndAttr->isInitialized() && aPassedAttr->isInitialized();
-  else
-    isValid = aCenterAttr->isInitialized() &&
-      aStartAttr->isInitialized() && anEndAttr->isInitialized();
-
-  return isValid;
+  aData->blockSendAttributeUpdated(aWasBlocked);
 }
 
-static inline void adjustPeriod(double& theParam)
+bool SketchPlugin_Arc::isFixed()
 {
-  static const double PERIOD = 2.0 * PI;
-  while (theParam < 0.0) theParam += PERIOD;
-  while (theParam >= PERIOD) theParam -= PERIOD;
+  return data()->selection(EXTERNAL_ID())->context().get() != NULL;
 }
 
 void SketchPlugin_Arc::attributeChanged(const std::string& theID)
@@ -350,424 +152,85 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID)
       GeomDataAPI_Point2D>(data()->attribute(START_ID()));
   std::shared_ptr<GeomDataAPI_Point2D> anEndAttr = std::dynamic_pointer_cast<
       GeomDataAPI_Point2D>(data()->attribute(END_ID()));
-  // the second condition for unability to move external segments anywhere
-  if (theID == EXTERNAL_ID() || isFixed()) {
+
+  // The second condition for unability to move external segments anywhere.
+  if(theID == EXTERNAL_ID() || isFixed()) {
     std::shared_ptr<GeomAPI_Shape> aSelection = data()->selection(EXTERNAL_ID())->value();
-    if (!aSelection) {
+    if(!aSelection) {
       // empty shape in selection shows that the shape is equal to context
       ResultPtr anExtRes = selection(EXTERNAL_ID())->context();
-      if (anExtRes)
+      if(anExtRes) {
         aSelection = anExtRes->shape();
+      }
     }
     // update arguments due to the selection value
-    if (aSelection && !aSelection->isNull() && aSelection->isEdge()) {
+    if(aSelection && !aSelection->isNull() && aSelection->isEdge()) {
       std::shared_ptr<GeomAPI_Edge> anEdge( new GeomAPI_Edge(aSelection));
       std::shared_ptr<GeomAPI_Circ> aCirc = anEdge->circle();
-      if (aCirc.get()) {
+      if(aCirc.get()) {
+        bool aWasBlocked = data()->blockSendAttributeUpdated(true);
+        aCenterAttr->setValue(sketch()->to2D(aCirc->center()));
         aStartAttr->setValue(sketch()->to2D(anEdge->firstPoint()));
         anEndAttr->setValue(sketch()->to2D(anEdge->lastPoint()));
-        aCenterAttr->setValue(sketch()->to2D(aCirc->center()));
-
-        data()->real(RADIUS_ID())->setValue(aCirc->radius());
-        double aStartAngle, aEndAngle;
-        anEdge->getRange(aStartAngle, aEndAngle);
-        data()->real(ANGLE_ID())->setValue(aEndAngle - aStartAngle);
-        myParamBefore = aEndAngle;
-        adjustPeriod(myParamBefore);
-      }
-    }
-    return;
-  }
-  AttributeStringPtr aTypeAttr =
-      std::dynamic_pointer_cast<ModelAPI_AttributeString>(attribute(ARC_TYPE()));
-
-  // this is before others since here end attribute may be changed, but with the special behavior
-  if (aTypeAttr->value() == ARC_TYPE_TANGENT() &&
-     (theID == TANGENT_POINT_ID() || theID == END_ID())) {
-    SketchPlugin_Sketch* aSketch = sketch();
-    AttributeRefAttrPtr aTangPtAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-        data()->attribute(TANGENT_POINT_ID()));
-
-    if (aTangPtAttr->isInitialized() && anEndAttr->isInitialized()) {
-      // compute orthogonal direction
-      std::shared_ptr<GeomAPI_Dir2d> anOrthoDir;
-      std::shared_ptr<GeomDataAPI_Point2D> aTangentPoint =
-          std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aTangPtAttr->attr());
-      std::shared_ptr<GeomAPI_Pnt2d> aTangPnt2d = aTangentPoint->pnt();
-      if (aTangPnt2d->isEqual(anEndAttr->pnt()))
-        return;
-      FeaturePtr aTangFeature = ModelAPI_Feature::feature(aTangentPoint->owner());
-      std::shared_ptr<GeomAPI_Edge> aTangEdge = std::dynamic_pointer_cast<GeomAPI_Edge>(
-          aTangFeature->lastResult()->shape());
-      if (aTangEdge->isLine()) {
-        std::shared_ptr<GeomAPI_Dir> aDir = aTangEdge->line()->direction();
-        std::shared_ptr<GeomAPI_Pnt> aPnt(new GeomAPI_Pnt(aDir->x(), aDir->y(), aDir->z()));
-        std::shared_ptr<GeomAPI_Pnt2d> aPnt2d = aSketch->to2D(aPnt);
-        anOrthoDir = std::shared_ptr<GeomAPI_Dir2d>(new GeomAPI_Dir2d(-aPnt2d->y(), aPnt2d->x()));
-      }
-      else if (aTangEdge->isArc()) {
-        std::shared_ptr<GeomAPI_Pnt> aCenter = aTangEdge->circle()->center();
-        std::shared_ptr<GeomAPI_Pnt2d> aCenter2d = aSketch->to2D(aCenter);
-        anOrthoDir = std::shared_ptr<GeomAPI_Dir2d>(
-            new GeomAPI_Dir2d(aTangPnt2d->xy()->decreased(aCenter2d->xy())));
-      }
-
-      // compute parameters of the middle perpendicular
-      std::shared_ptr<GeomAPI_XY> aEndPntCoord = anEndAttr->pnt()->xy();
-      std::shared_ptr<GeomAPI_XY> aTempDir = aEndPntCoord->decreased(aTangPnt2d->xy());
-      std::shared_ptr<GeomAPI_Dir2d> aMidDir(new GeomAPI_Dir2d(-aTempDir->y(), aTempDir->x()));
-      std::shared_ptr<GeomAPI_Pnt2d> aMidPnt(
-          new GeomAPI_Pnt2d(aEndPntCoord->added(aTangPnt2d->xy())->multiplied(0.5)));
-
-      // compute center of arc by calculating intersection of
-      // orthogonal line and middle perpendicular
-      std::shared_ptr<GeomAPI_Lin2d> anOrthoLine(new GeomAPI_Lin2d(aTangPnt2d, anOrthoDir));
-      std::shared_ptr<GeomAPI_Lin2d> aMiddleLine(new GeomAPI_Lin2d(aMidPnt, aMidDir));
-      std::shared_ptr<GeomAPI_Pnt2d> aCenter = anOrthoLine->intersect(aMiddleLine);
-      if (aCenter) {
-        bool aWasBlocked = data()->blockSendAttributeUpdated(true);
-        aCenterAttr->setValue(aCenter);
-        aStartAttr->setValue(aTangPnt2d);
-        data()->blockSendAttributeUpdated(aWasBlocked);
-      }
-
-      tangencyArcConstraints();
-    }
-    return;
-  }
-
-  // if changed the base attributes, update all other (is necessary) without recursion
-  if (theID == CENTER_ID() || theID == START_ID() || theID == END_ID() || theID == ARC_TYPE()) {
-    if (!isFeatureValid())
-      return;
-    std::shared_ptr<GeomAPI_Pnt2d> aCenter = aCenterAttr->pnt();
-    std::shared_ptr<GeomAPI_Pnt2d> aStart = aStartAttr->pnt();
-    std::shared_ptr<GeomAPI_Pnt2d> anEnd = anEndAttr->pnt();
-    double aRadius = aCenter->distance(aStart);
-    if (aRadius < tolerance)
-      return;
-    std::shared_ptr<GeomAPI_Circ2d> aCircleForArc(new GeomAPI_Circ2d(aCenter, aStart));
-
-    bool aWasBlocked = data()->blockSendAttributeUpdated(true);
-    // The Arc end point is projected
-    // on the circle formed by center and start points
-    std::shared_ptr<GeomAPI_Pnt2d> aProjection = aCircleForArc->project(anEnd);
-    if (aProjection && anEnd->distance(aProjection) > tolerance) {
-      anEndAttr->setValue(aProjection);
-      anEnd = aProjection;
-    }
-    // update all other attributes due to the base attributes values
-    if (aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
-      // update passed point due to start, end and center
-      if (aCenter->distance(aStart) > tolerance && aCenter->distance(anEnd) > tolerance) {
-        // project passed point t othe circle
-        std::shared_ptr<GeomDataAPI_Point2D> aPassedAttr =
-          std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(PASSED_POINT_ID()));
-        if (aPassedAttr->isInitialized()) {
-          std::shared_ptr<GeomAPI_Pnt2d> aProjection = aCircleForArc->project(aPassedAttr->pnt());
-          if (aProjection && aPassedAttr->pnt()->distance(aProjection) > tolerance) {
-            aPassedAttr->setValue(aProjection);
-          }
-        } else { // initialize it by some middle - value
-          std::shared_ptr<GeomAPI_Dir2d> aStartDir(new GeomAPI_Dir2d(
-            aStart->xy()->decreased(aCenter->xy())));
-          std::shared_ptr<GeomAPI_Dir2d> aEndDir(new GeomAPI_Dir2d(
-            anEnd->xy()->decreased(aCenter->xy())));
-          std::shared_ptr<GeomAPI_XY> aMidDirXY = aStartDir->xy()->added(aEndDir->xy());
-          if (aMidDirXY->dot(aMidDirXY) < tolerance * tolerance) {
-            // start and end directions are opposite, so middle direction will be orthogonal
-            aMidDirXY->setX(-aStartDir->y());
-            aMidDirXY->setY(aStartDir->x());
-          }
-          std::shared_ptr<GeomAPI_Dir2d> aMidDir(new GeomAPI_Dir2d(aMidDirXY));
-          if ((aStartDir->cross(aMidDir) > 0) ^ !isReversed())
-            aMidDir->reverse();
-          std::shared_ptr<GeomAPI_XY> aPassedPnt =
-            aCenter->xy()->added(aMidDir->xy()->multiplied(aCenter->distance(aStart)));
-          std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(PASSED_POINT_ID()))->
-            setValue(aPassedPnt->x(), aPassedPnt->y());
+        data()->blockSendAttributeUpdated(aWasBlocked, false);
+
+        std::shared_ptr<GeomAPI_Circ2d> aCircle2d =
+          std::shared_ptr<GeomAPI_Circ2d>(new GeomAPI_Circ2d(aCenterAttr->pnt(),
+                                                             aStartAttr->pnt()));
+
+        double anEndParam = 0.0;
+        aCircle2d->parameter(anEndAttr->pnt(), paramTolerance, anEndParam);
+        myParamBefore = anEndParam;
+
+        double aMidParam  = anEndParam / 2.0;
+        std::shared_ptr<GeomAPI_Pnt2d> aMidPnt2d;
+        aCircle2d->D0(aMidParam, aMidPnt2d);
+        std::shared_ptr<GeomAPI_Pnt> aMinPnt = sketch()->to3D(aMidPnt2d->x(), aMidPnt2d->y());
+        double aStartParam = 0.0;
+        aCirc->parameter(anEdge->firstPoint(), paramTolerance, aStartParam);
+        aCirc->parameter(aMinPnt, paramTolerance, aMidParam);
+        aCirc->parameter(anEdge->lastPoint(), paramTolerance, anEndParam);
+        aWasBlocked = data()->blockSendAttributeUpdated(true);
+        if(aStartParam < aMidParam && aMidParam < anEndParam) {
+          setReversed(true);
+        } else {
+          setReversed(false);
         }
+        data()->blockSendAttributeUpdated(aWasBlocked, false);
       }
     }
-    // update radius and angle
-    AttributeDoublePtr aRadiusAttr = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
-        data()->attribute(RADIUS_ID()));
-    aRadiusAttr->setValue(aRadius);
-    AttributeDoublePtr anAngleAttr = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
-        data()->attribute(ANGLE_ID()));
-    std::shared_ptr<GeomAPI_Circ2d> aCircle(new GeomAPI_Circ2d(aCenter, aStart));
-    double aStartParam, aEndParam;
-    aCircle->parameter(aStart, paramTolerance, aStartParam);
-    aCircle->parameter(anEnd, paramTolerance, aEndParam);
-    adjustPeriod(aStartParam);
-    adjustPeriod(aEndParam);
-    // use the passed point for the angle calculation
-    if (aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
-      std::shared_ptr<GeomDataAPI_Point2D> aPassedAttr =
-        std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(PASSED_POINT_ID()));
-      double aPassedParam;
-      aCircle->parameter(aPassedAttr->pnt(), paramTolerance, aPassedParam);
-      adjustPeriod(aPassedParam);
-      double aNewAngle = aPassedParam >= aStartParam && aPassedParam <= aEndParam ?
-        ((aEndParam - aStartParam) * 180.0 / PI) :
-        ((aEndParam - aStartParam - 2.0 * PI) * 180.0 / PI);
-      if (!anAngleAttr->isInitialized() || fabs(aNewAngle - anAngleAttr->value()) > tolerance)
-        anAngleAttr->setValue(aNewAngle);
-    } else {
-      double aNewAngle = (aEndParam - aStartParam) * 180.0 / PI;
-      if (!anAngleAttr->isInitialized() || fabs(aNewAngle - anAngleAttr->value()) > tolerance)
-        anAngleAttr->setValue(aNewAngle);
-    }
-
-    // calculate arc aperture and change the Inversed flag if needed
-    AttributeBooleanPtr isInversed =
-        std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(attribute(INVERSED_ID()));
-    double aParameterNew = aEndParam - aStartParam;
-    if (((0 <= myParamBefore && myParamBefore <= PI / 2.0) || myParamBefore == PI * 2.0) &&
-        PI * 1.5 <= aParameterNew && aParameterNew <= PI * 2.0)
-      isInversed->setValue(true);
-    else if (PI * 1.5 <= myParamBefore && myParamBefore <= PI * 2.0 &&
-             0 <= aParameterNew && aParameterNew <= PI / 2.0)
-      isInversed->setValue(false);
-    myParamBefore = aParameterNew;
-
-    // do not need to inform that other parameters were changed in this basis mode: these arguments
-    // change is enough
-    data()->blockSendAttributeUpdated(aWasBlocked, false);
-    return;
   }
 
-  if (theID == PASSED_POINT_ID()) {
-    bool aWasBlocked = data()->blockSendAttributeUpdated(true);
-
-    std::shared_ptr<GeomAPI_Pnt2d> aPoints[3];
-    int aNbInitialized = 0;
-    for (int i = 1; i <= 3; ++i) {
-      std::shared_ptr<GeomDataAPI_Point2D> aCurPnt =
-          std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(POINT_ID(i)));
-      if (aCurPnt->isInitialized())
-        aPoints[aNbInitialized++] = aCurPnt->pnt();
-    }
-
-    if (aNbInitialized == 3) {
-      std::shared_ptr<GeomAPI_Circ2d> aCircle(
-          new GeomAPI_Circ2d(aPoints[0], aPoints[1], aPoints[2]));
-
-      std::shared_ptr<GeomAPI_Pnt2d> aCenter = aCircle->center();
-      if (aCenter) {
-        aCenterAttr->setValue(aCenter);
+  double aRadius = 0;
+  double anAngle = 0;
+  if(aCenterAttr->isInitialized() && aStartAttr->isInitialized()) {
+    aRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt());
+    if(anEndAttr->isInitialized()) {
+      if(aStartAttr->pnt()->isEqual(anEndAttr->pnt())) {
+        anAngle = 360;
+      } else {
+        GeomAPI_Circ2d aCircleForArc(aCenterAttr->pnt(), aStartAttr->pnt());
+        double aStartParam, anEndParam;
+        aCircleForArc.parameter(aStartAttr->pnt(), paramTolerance, aStartParam);
+        aCircleForArc.parameter(anEndAttr->pnt(), paramTolerance, anEndParam);
+        anAngle = (anEndParam - aStartParam) / PI * 180.0;
+        if(isReversed()) anAngle = 360.0 - anAngle;
       }
     }
-    data()->blockSendAttributeUpdated(aWasBlocked);
-    return;
   }
 
-  if (theID == RADIUS_ID()) {
-    if (!aStartAttr->isInitialized() || !anEndAttr->isInitialized() ||
-        !aCenterAttr->isInitialized())
-      return;
-    // move center and passed point
-    std::shared_ptr<GeomAPI_Pnt2d> aStart = aStartAttr->pnt();
-    std::shared_ptr<GeomAPI_Pnt2d> anEnd = anEndAttr->pnt();
-    std::shared_ptr<GeomAPI_Pnt2d> aCenter = aCenterAttr->pnt();
-    if (aStart->distance(aCenter) < tolerance || anEnd->distance(aCenter) < tolerance)
-      return;
-    AttributeDoublePtr aRadiusAttr = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
-        data()->attribute(RADIUS_ID()));
-    double aRadius = aRadiusAttr->value();
-
-    bool aWasBlocked = data()->blockSendAttributeUpdated(true);
-    std::shared_ptr<GeomAPI_Dir2d>
-      aStartDir(new GeomAPI_Dir2d(aStart->xy()->decreased(aCenter->xy())));
-    std::shared_ptr<GeomAPI_XY>
-      aNewStart = aStartDir->xy()->multiplied(aRadius)->added(aCenter->xy());
-    aStartAttr->setValue(aNewStart->x(), aNewStart->y());
-    std::shared_ptr<GeomAPI_Dir2d>
-      anEndDir(new GeomAPI_Dir2d(anEnd->xy()->decreased(aCenter->xy())));
-    std::shared_ptr<GeomAPI_XY>
-      aNewEnd = anEndDir->xy()->multiplied(aRadius)->added(aCenter->xy());
-    anEndAttr->setValue(aNewEnd->x(), aNewEnd->y());
-    data()->blockSendAttributeUpdated(aWasBlocked);
-    return;
-  }
-  if (theID == ANGLE_ID()) {
-    if (!aStartAttr->isInitialized() || !aCenterAttr->isInitialized())
-      return;
-    AttributeDoublePtr anAngleAttr = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
-        data()->attribute(ANGLE_ID()));
-    bool aWasBlocked = data()->blockSendAttributeUpdated(true);
-    // move end point and passed point
-    std::shared_ptr<GeomAPI_XY> aCenter = aCenterAttr->pnt()->xy();
-    double anAngle = anAngleAttr->value() * PI / 180.0;
-    double sinA = sin(anAngle);
-    double cosA = cos(anAngle);
-    std::shared_ptr<GeomAPI_XY> aStartDir = aStartAttr->pnt()->xy()->decreased(aCenter);
-    std::shared_ptr<GeomAPI_XY> aDir(new GeomAPI_XY(
-        aStartDir->x() * cosA - aStartDir->y() * sinA,
-        aStartDir->x() * sinA + aStartDir->y() * cosA));
-    anEndAttr->setValue(aCenter->x() + aDir->x(), aCenter->y() + aDir->y());
-    data()->blockSendAttributeUpdated(aWasBlocked);
-    return;
-  }
+  bool aWasBlocked = data()->blockSendAttributeUpdated(true);
+  real(RADIUS_ID())->setValue(aRadius);
+  real(ANGLE_ID())->setValue(anAngle);
+  data()->blockSendAttributeUpdated(aWasBlocked, false);
 }
 
 void SketchPlugin_Arc::setReversed(bool isReversed)
 {
-  std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(
-    attribute(INVERSED_ID()))->setValue(isReversed);
-  myParamBefore = 0.0;
+  boolean(REVERSED_ID())->setValue(isReversed);
 }
 
 bool SketchPlugin_Arc::isReversed()
 {
-  return std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(attribute(INVERSED_ID()))->value();
-}
-
-void SketchPlugin_Arc::tangencyArcConstraints()
-{
-  if (!lastResult())
-    return;
-
-  std::shared_ptr<GeomDataAPI_Point2D> aStartAttr =
-      std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(START_ID()));
-  AttributeRefAttrPtr aTangPtAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-      attribute(TANGENT_POINT_ID()));
-  if (!aTangPtAttr->attr())
-    return;
-
-  FeaturePtr aFeature = ModelAPI_Feature::feature(aStartAttr->owner());
-  ObjectPtr aThisArc = aFeature->lastResult();
-  aFeature = ModelAPI_Feature::feature(aTangPtAttr->attr()->owner());
-  ObjectPtr aTangFeature = aFeature->lastResult();
-
-  // trying to find constraints to fix the tangency of the arc
-  std::set<FeaturePtr> aCoincidence;
-  std::set<FeaturePtr> aTangency;
-
-  AttributeRefAttrPtr aRefAttrA, aRefAttrB;
-  std::set<AttributePtr> aRefs = data()->refsToMe();
-  const std::set<AttributePtr>& aRefsToResult = lastResult()->data()->refsToMe();
-  aRefs.insert(aRefsToResult.begin(), aRefsToResult.end());
-  std::set<AttributePtr>::const_iterator aRefIt = aRefs.begin();
-  for (; aRefIt != aRefs.end(); ++aRefIt) {
-    FeaturePtr aConstrFeature = ModelAPI_Feature::feature((*aRefIt)->owner());
-    if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) {
-      aRefAttrA = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-          aConstrFeature->attribute(SketchPlugin_Constraint::ENTITY_A()));
-      aRefAttrB = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-          aConstrFeature->attribute(SketchPlugin_Constraint::ENTITY_B()));
-      if ((aRefAttrA && aRefAttrA->attr() == aStartAttr) ||
-          (aRefAttrB && aRefAttrB->attr() == aStartAttr))
-        aCoincidence.insert(aConstrFeature);
-    }
-    else if (aConstrFeature->getKind() == SketchPlugin_ConstraintTangent::ID()) {
-      aRefAttrA = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-          aConstrFeature->attribute(SketchPlugin_Constraint::ENTITY_A()));
-      aRefAttrB = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-          aConstrFeature->attribute(SketchPlugin_Constraint::ENTITY_B()));
-      if ((aRefAttrA && aRefAttrA->object() == aThisArc) ||
-          (aRefAttrB && aRefAttrB->object() == aThisArc))
-        aTangency.insert(aConstrFeature);
-    }
-  }
-  // search applicable pair of constraints
-  bool isFound = false;
-  FeaturePtr aPrevCoincidence, aPrevTangency;
-  std::set<FeaturePtr>::const_iterator aCIt, aTIt;
-  for (aCIt = aCoincidence.begin(); aCIt != aCoincidence.end() && !isFound; ++aCIt) {
-    aRefAttrA = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-        (*aCIt)->attribute(SketchPlugin_Constraint::ENTITY_A()));
-    aRefAttrB = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-        (*aCIt)->attribute(SketchPlugin_Constraint::ENTITY_B()));
-    AttributePtr anOtherPoint =
-        aRefAttrA->attr() == aStartAttr ? aRefAttrB->attr() : aRefAttrA->attr();
-    for (aTIt = aTangency.begin(); aTIt != aTangency.end() && !isFound; ++aTIt) {
-      aRefAttrA = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-          (*aTIt)->attribute(SketchPlugin_Constraint::ENTITY_A()));
-      aRefAttrB = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-          (*aTIt)->attribute(SketchPlugin_Constraint::ENTITY_B()));
-      ObjectPtr anOtherObject = aRefAttrA->object() == aThisArc ?
-          aRefAttrB->object() : aRefAttrA->object();
-      FeaturePtr anOtherFeature = ModelAPI_Feature::feature(anOtherObject);
-      if (anOtherPoint->owner() == anOtherFeature) {
-        isFound = true;
-        aPrevCoincidence = *aCIt;
-        aPrevTangency = *aTIt;
-      }
-    }
-  }
-
-  if (isFound) {
-    // update previous constraints
-    aRefAttrA = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-        aPrevCoincidence->attribute(SketchPlugin_Constraint::ENTITY_A()));
-    aRefAttrB = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-        aPrevCoincidence->attribute(SketchPlugin_Constraint::ENTITY_B()));
-    if (aRefAttrA->attr() == aStartAttr)
-      aRefAttrB->setAttr(aTangPtAttr->attr());
-    else
-      aRefAttrA->setAttr(aTangPtAttr->attr());
-
-    aRefAttrA = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-        aPrevTangency->attribute(SketchPlugin_Constraint::ENTITY_A()));
-    aRefAttrB = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-        aPrevTangency->attribute(SketchPlugin_Constraint::ENTITY_B()));
-    if (aRefAttrA->object() == aThisArc)
-      aRefAttrB->setObject(aTangFeature);
-    else
-      aRefAttrA->setObject(aTangFeature);
-  } else {
-    // Wait all constraints being removed, then send update events
-    static Events_ID aDeleteEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED);
-    bool isDeleteFlushed = Events_Loop::loop()->isFlushed(aDeleteEvent);
-    if (isDeleteFlushed)
-      Events_Loop::loop()->setFlushed(aDeleteEvent, false);
-    // Remove all obtained constraints which use current arc, because
-    // there is no information which of them were used to build tangency arc.
-    DocumentPtr aDoc = sketch()->document();
-    std::set<FeaturePtr> aFeaturesToBeRemoved;
-    for (aCIt = aCoincidence.begin(); aCIt != aCoincidence.end(); ++aCIt)
-      aFeaturesToBeRemoved.insert(*aCIt);
-    for (aTIt = aTangency.begin(); aTIt != aTangency.end(); ++aTIt)
-      aFeaturesToBeRemoved.insert(*aTIt);
-    ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToBeRemoved);
-    // Send events to update the sub-features by the solver.
-    if (isDeleteFlushed)
-      Events_Loop::loop()->setFlushed(aDeleteEvent, true);
-    else
-      Events_Loop::loop()->flush(aDeleteEvent);
-
-    // Wait all constraints being created, then send update events
-    static Events_ID aCreateEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
-    bool isCreateFlushed = Events_Loop::loop()->isFlushed(aCreateEvent);
-    if (isCreateFlushed)
-      Events_Loop::loop()->setFlushed(aCreateEvent, false);
-
-    // Create new constraints
-    FeaturePtr aConstraint = sketch()->addFeature(SketchPlugin_ConstraintCoincidence::ID());
-    aRefAttrA = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-        aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A()));
-    aRefAttrB = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-        aConstraint->attribute(SketchPlugin_Constraint::ENTITY_B()));
-    aRefAttrA->setAttr(aStartAttr);
-    aRefAttrB->setAttr(aTangPtAttr->attr());
-    aConstraint->execute();
-    ModelAPI_EventCreator::get()->sendUpdated(aConstraint, aCreateEvent);
-
-    aConstraint = sketch()->addFeature(SketchPlugin_ConstraintTangent::ID());
-    aRefAttrA = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-        aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A()));
-    aRefAttrB = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-        aConstraint->attribute(SketchPlugin_Constraint::ENTITY_B()));
-    aRefAttrA->setObject(aThisArc);
-    aRefAttrB->setObject(aTangFeature);
-    aConstraint->execute();
-    ModelAPI_EventCreator::get()->sendUpdated(aConstraint, aCreateEvent);
-
-    // Send events to update the sub-features by the solver.
-    if(isCreateFlushed)
-      Events_Loop::loop()->setFlushed(aCreateEvent, true);
-    else
-      Events_Loop::loop()->flush(aCreateEvent);
-  }
+  return boolean(REVERSED_ID())->value();
 }
index 1a5a5fc5ec54bca456733d12d347c40660547f45..7b2e294724e1371b16e8062078336886a4f95795 100644 (file)
@@ -8,9 +8,10 @@
 #define SketchPlugin_Arc_H_
 
 #include "SketchPlugin.h"
-#include <SketchPlugin_SketchEntity.h>
-#include <SketchPlugin_Sketch.h>
-#include <GeomAPI_IPresentable.h>
+
+#include "SketchPlugin_SketchEntity.h"
+
+
 
 /**\class SketchPlugin_Arc
  * \ingroup Plugins
  * calculated when there is non-initialized attributes of the arc. The second is a result and
  * it is calculated if all attributes are initialized.
  */
-class SketchPlugin_Arc : public SketchPlugin_SketchEntity, public GeomAPI_IPresentable
+class SketchPlugin_Arc: public SketchPlugin_SketchEntity
 {
-  /// to avoid cyclic dependencies in automatic updates: they mean that
-  /// update is performed right now and automatic updates are not needed
-  bool myStartUpdate, myEndUpdate;
-  /// to avoid (if possible) additional modification of changed coordinate (issue #855)
-  double myXEndBefore, myYEndBefore;
-
-  /// to define in which direction draw arc
-  double myParamBefore;
-
  public:
   /// Arc feature kind
   inline static const std::string& ID()
   {
-    static const std::string MY_SKETCH_ARC_ID("SketchArc");
-    return MY_SKETCH_ARC_ID;
-  }
-
-  inline static const std::string& ARC_TYPE()
-  {
-    static const std::string TYPE("ArcType");
-    return TYPE;
-  }
-
-  inline static const std::string& ARC_TYPE_TANGENT()
-  {
-    static const std::string TYPE("Tangent");
-    return TYPE;
-  }
-
-  static const std::string& ARC_TYPE_CENTER_START_END()
-  {
-    static const std::string TYPE("CenterStartEnd");
-    return TYPE;
-  }
-  static const std::string& ARC_TYPE_THREE_POINTS()
-  {
-    static const std::string TYPE("ThreePoints");
-    return TYPE;
-  }
-
-  static const std::string& TANGENT_POINT_ID()
-  {
-    static const std::string TANGENT_PNT("ArcTangentPoint");
-    return TANGENT_PNT;
+    static const std::string ID("SketchArc");
+    return ID;
   }
 
   /// Central 2D point of the circle which contains the arc
   inline static const std::string& CENTER_ID()
   {
-    static const std::string MY_CENTER_ID = "ArcCenter";
-    return MY_CENTER_ID;
-  }
-
-  inline static const std::string& CENTER_REF_ID()
-  {
-    static const std::string MY_CENTER_REF_ID = "ArcCenterRef";
-    return MY_CENTER_REF_ID;
+    static const std::string ID = "center_point";
+    return ID;
   }
 
   /// Start 2D point of the arc
   inline static const std::string& START_ID()
   {
-    static const std::string MY_START_ID = "ArcStartPoint";
-    return MY_START_ID;
+    static const std::string ID = "start_point";
+    return ID;
   }
+
   /// End 2D point of the arc
   inline static const std::string& END_ID()
   {
-    static const std::string MY_END_ID = "ArcEndPoint";
-    return MY_END_ID;
-  }
-
-  /// Inversed flag
-  inline static const std::string& INVERSED_ID()
-  {
-    static const std::string MY_INVERSED_ID("InversedArc");
-    return MY_INVERSED_ID;
-  }
-
-  /// Passed point of the arc.
-  static const std::string& PASSED_POINT_ID()
-  {
-    static const std::string PASSED_PNT("ArcPassedPoint");
-    return PASSED_PNT;
+    static const std::string ID = "end_point";
+    return ID;
   }
 
   /// Arc radius.
   static const std::string& RADIUS_ID()
   {
-    static const std::string RADIUS("ArcRadius");
-    return RADIUS;
+    static const std::string ID("radius");
+    return ID;
   }
 
   /// Arc angle.
   static const std::string& ANGLE_ID()
   {
-    static const std::string ANGLE("ArcAngle");
-    return ANGLE;
+    static const std::string ID("angle");
+    return ID;
+  }
+
+  /// Reversed flag
+  inline static const std::string& REVERSED_ID()
+  {
+    static const std::string ID("reversed");
+    return ID;
   }
 
   /// Returns the kind of a feature
@@ -131,15 +82,12 @@ class SketchPlugin_Arc : public SketchPlugin_SketchEntity, public GeomAPI_IPrese
   /// Returns true is sketch element is under the rigid constraint
   SKETCHPLUGIN_EXPORT virtual bool isFixed();
 
-  /// Creates an arc-shape
-  SKETCHPLUGIN_EXPORT virtual void execute();
-
   /// Called on change of any argument-attribute of this object
   /// \param theID identifier of changed attribute
   SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
 
-  /// Returns the AIS preview
-  virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
+  /// Creates an arc-shape
+  SKETCHPLUGIN_EXPORT virtual void execute();
 
   /// Moves the feature
   /// \param theDeltaX the delta for X coordinate is moved
@@ -149,6 +97,7 @@ class SketchPlugin_Arc : public SketchPlugin_SketchEntity, public GeomAPI_IPrese
   /// Updates the "reversed" flag
   /// \param isReversed  whether the arc will be reversed
   void setReversed(bool isReversed);
+
   /// Returns \c true is the arc is reversed
   bool isReversed();
 
@@ -160,12 +109,8 @@ protected:
   virtual void initDerivedClassAttributes();
 
 private:
-  /// Returns true if all obligatory attributes are initialized
-  bool isFeatureValid();
-
-  /// Compose constraints to build tangency arc
-  void tangencyArcConstraints();
-
+  /// to define in which direction draw arc
+  double myParamBefore;
 };
 
 #endif
index 305aba0bbbb1380c9993748e3745169361950742..e21de959145bec5bc7e92a910de48e5ee504953e 100755 (executable)
@@ -837,10 +837,6 @@ void SketchPlugin_ConstraintSplit::splitArc(FeaturePtr& theSplitFeature,
     return;
   }
 
-  // manually change type of arc to avoid incorrect self-constrainting of the tangent arc
-  aBaseFeature->string(SketchPlugin_Arc::ARC_TYPE())->setValue(
-      SketchPlugin_Arc::ARC_TYPE_CENTER_START_END());
-
   arrangePointsOnArc(aBaseFeature, aStartPointAttrOfBase, anEndPointAttrOfBase,
                      aFirstPointAttrOfSplit, aSecondPointAttrOfSplit);
 #ifdef DEBUG_SPLIT
@@ -1044,7 +1040,7 @@ void SketchPlugin_ConstraintSplit::arrangePointsOnArc(
 
   std::shared_ptr<GeomAPI_Pnt2d> aCenter = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
       theArc->attribute(SketchPlugin_Arc::CENTER_ID()))->pnt();
-  bool isReversed = theArc->boolean(SketchPlugin_Arc::INVERSED_ID())->value();
+  bool isReversed = theArc->boolean(SketchPlugin_Arc::REVERSED_ID())->value();
 
   // collect directions to each point
   std::shared_ptr<GeomAPI_Dir2d> aStartDir(
@@ -1140,9 +1136,6 @@ FeaturePtr SketchPlugin_ConstraintSplit::createArcFeature(const FeaturePtr& theB
   // by arc; moreover, it may cause cyclicity in hte mechanism of updater
   bool aWasBlocked = aFeature->data()->blockSendAttributeUpdated(true);
 
-  aFeature->string(SketchPlugin_Arc::ARC_TYPE())->setValue(
-                SketchPlugin_Arc::ARC_TYPE_CENTER_START_END());
-
   fillAttribute(aFeature->attribute(SketchPlugin_Arc::CENTER_ID()),
                 theBaseFeature->attribute(aCenterAttributeId));
   fillAttribute(aFeature->attribute(SketchPlugin_Arc::START_ID()), theFirstPointAttr);
@@ -1153,8 +1146,8 @@ FeaturePtr SketchPlugin_ConstraintSplit::createArcFeature(const FeaturePtr& theB
 
   /// fill referersed state of created arc as it is on the base arc
   if (theBaseFeature->getKind() == SketchPlugin_Arc::ID()) {
-    bool aReversed = theBaseFeature->boolean(SketchPlugin_Arc::INVERSED_ID())->value();
-    aFeature->boolean(SketchPlugin_Arc::INVERSED_ID())->setValue(aReversed);
+    bool aReversed = theBaseFeature->boolean(SketchPlugin_Arc::REVERSED_ID())->value();
+    aFeature->boolean(SketchPlugin_Arc::REVERSED_ID())->setValue(aReversed);
   }
   aFeature->data()->blockSendAttributeUpdated(aWasBlocked);
   aFeature->execute(); // to obtain result
index f56b27d73e8c0a7a6a79dd9a8e94196b55f0c603..7039a37ad1c79d4bf6d66fabe97770984f6affd3 100644 (file)
@@ -667,7 +667,7 @@ void getPointOnEdge(const FeaturePtr theFeature,
       theFeature->attribute(SketchPlugin_Arc::START_ID()))->pnt();
     std::shared_ptr<GeomAPI_Pnt2d> aPntEnd = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
       theFeature->attribute(SketchPlugin_Arc::END_ID()))->pnt();
-    if(theFeature->attribute(SketchPlugin_Arc::INVERSED_ID())) {
+    if(theFeature->attribute(SketchPlugin_Arc::REVERSED_ID())) {
       aPntTemp = aPntStart;
       aPntStart = aPntEnd;
       aPntEnd = aPntTemp;
index 381326476f89da728a16c91b3a9c6c57d171db39..a5572566b87f60e636ad5b002554cc4f40c2ff18 100644 (file)
@@ -41,7 +41,6 @@ const double PI = 3.141592653589793238463;
 
 SketchPlugin_MacroArc::SketchPlugin_MacroArc()
 : SketchPlugin_SketchEntity(),
-  myIsInversed(false),
   myParamBefore(0.0)
 {
 }
@@ -61,6 +60,8 @@ void SketchPlugin_MacroArc::initAttributes()
   data()->addAttribute(TANGENT_POINT_ID(), ModelAPI_AttributeRefAttr::typeId());
   data()->addAttribute(END_POINT_3_ID(), GeomDataAPI_Point2D::typeId());
 
+  data()->addAttribute(REVERSED_ID(), ModelAPI_AttributeBoolean::typeId());
+
   data()->addAttribute(RADIUS_ID(), ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
 
@@ -71,6 +72,8 @@ void SketchPlugin_MacroArc::initAttributes()
   data()->addAttribute(END_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId());
   data()->addAttribute(PASSED_POINT_REF_ID(), ModelAPI_AttributeRefAttr::typeId());
 
+  boolean(REVERSED_ID())->setValue(false);
+
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CENTER_POINT_REF_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), START_POINT_REF_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), END_POINT_REF_ID());
@@ -107,7 +110,7 @@ void SketchPlugin_MacroArc::attributeChanged(const std::string& theID)
     myCenter.reset();
     myStart.reset();
     myEnd.reset();
-    myIsInversed = false;
+    boolean(REVERSED_ID())->setValue(false);
     myParamBefore = 0.0;
   } else if(anArcType == ARC_TYPE_BY_CENTER_AND_POINTS()) {
     std::shared_ptr<GeomDataAPI_Point2D> aCenterPointAttr =
@@ -141,9 +144,9 @@ void SketchPlugin_MacroArc::attributeChanged(const std::string& theID)
       double aParameterNew = 0.0;
       if(aCircleForArc.parameter(myEnd, paramTolerance, aParameterNew)) {
         if(myParamBefore <= PI / 2.0 && aParameterNew >= PI * 1.5) {
-          myIsInversed = true;
+          boolean(REVERSED_ID())->setValue(true);
         } else if(myParamBefore >= PI * 1.5 && aParameterNew <= PI / 2.0) {
-          myIsInversed = false;
+          boolean(REVERSED_ID())->setValue(false);
         }
       }
       myParamBefore = aParameterNew;
@@ -174,9 +177,9 @@ void SketchPlugin_MacroArc::attributeChanged(const std::string& theID)
       aCircle.parameter(myEnd, paramTolerance, anEndParam);
       aCircle.parameter(aPassed, paramTolerance, aPassedParam);
       if(aPassedParam > anEndParam) {
-        myIsInversed = true;
+        boolean(REVERSED_ID())->setValue(true);
       } else {
-        myIsInversed = false;
+        boolean(REVERSED_ID())->setValue(false);
       }
     } else {
       std::shared_ptr<GeomAPI_XY> aDir = myEnd->xy()->decreased(myStart->xy())->multiplied(0.5);
@@ -251,12 +254,12 @@ void SketchPlugin_MacroArc::attributeChanged(const std::string& theID)
     double aParameterNew = 0.0;
     if(aCircleForArc.parameter(myEnd, paramTolerance, aParameterNew)) {
       if(myParamBefore <= PI / 2.0 && aParameterNew >= PI * 1.5) {
-        if(!myIsInversed) {
-          myIsInversed = true;
+        if(!boolean(REVERSED_ID())->value()) {
+          boolean(REVERSED_ID())->setValue(true);
         }
       } else if(myParamBefore >= PI * 1.5 && aParameterNew <= PI / 2.0) {
-        if(myIsInversed) {
-          myIsInversed = false;
+        if(boolean(REVERSED_ID())->value()) {
+          boolean(REVERSED_ID())->setValue(false);
         }
       }
     }
@@ -276,7 +279,7 @@ void SketchPlugin_MacroArc::attributeChanged(const std::string& theID)
         aCircleForArc.parameter(myStart, paramTolerance, aStartParam);
         aCircleForArc.parameter(myEnd, paramTolerance, anEndParam);
         anAngle = (anEndParam - aStartParam) / PI * 180.0;
-        if(myIsInversed) anAngle = 360.0 - anAngle;
+        if(boolean(REVERSED_ID())->value()) anAngle = 360.0 - anAngle;
       }
     }
   }
@@ -306,7 +309,7 @@ AISObjectPtr SketchPlugin_MacroArc::getAISObject(AISObjectPtr thePrevious)
       std::dynamic_pointer_cast<GeomDataAPI_Dir>(
           aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
   std::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
-  GeomShapePtr anArcShape = myIsInversed ?
+  GeomShapePtr anArcShape = boolean(REVERSED_ID())->value() ?
       GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, anEnd, aStart, aNormal)
     : GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStart, anEnd, aNormal);
   GeomShapePtr aCenterPointShape = GeomAlgoAPI_PointBuilder::vertex(aCenter);
index a082c64a377f16d62b4532ca0a08263bb95f430f..aec30931c7bc33191a98ea2a5ad5b4a1255cfe68 100644 (file)
@@ -8,10 +8,13 @@
 #define SketchPlugin_MacroArc_H_
 
 #include "SketchPlugin.h"
-#include <SketchPlugin_SketchEntity.h>
-#include <SketchPlugin_Sketch.h>
+
+#include "SketchPlugin_SketchEntity.h"
+
 #include <GeomAPI_IPresentable.h>
 
+class GeomAPI_Pnt2d;
+
 /**\class SketchPlugin_MacroArc
  * \ingroup Plugins
  * \brief Feature for creation of the new arc of circle in PartSet.
@@ -132,6 +135,13 @@ class SketchPlugin_MacroArc: public SketchPlugin_SketchEntity,
     return ID;
   }
 
+  /// Reversed flag
+  inline static const std::string& REVERSED_ID()
+  {
+    static const std::string ID("reversed");
+    return ID;
+  }
+
   /// Arc radius.
   static const std::string& RADIUS_ID()
   {
@@ -187,7 +197,6 @@ private:
   std::shared_ptr<GeomAPI_Pnt2d> myEnd;
 
   /// To define in which direction draw arc.
-  bool myIsInversed;
   double myParamBefore;
 };
 
index 05a2d301be328860fe5d3f17d16c87d1a08b38ca..974a0eeb6c529dde433e03d7e9ef50901f76c964 100644 (file)
@@ -9,12 +9,12 @@
 
 #include "SketchPlugin.h"
 
-#include "SketchPlugin_Sketch.h"
 #include "SketchPlugin_SketchEntity.h"
 
 #include <GeomAPI_IPresentable.h>
-#include <GeomAPI_Pnt2d.h>
-#include <GeomAPI_Circ2d.h>
+
+class GeomAPI_Circ2d;
+class GeomAPI_Pnt2d;
 
 /**\class SketchPlugin_MacroCircle
  * \ingroup Plugins
index 4ae70604570ef2ff4fa97a08f636c2c4a824394b..5a6f4e1eed7b1b6b989ebce2f6e6521edced8cc3 100644 (file)
@@ -824,7 +824,7 @@ void SketchPlugin_Trim::arrangePointsOnArc(const FeaturePtr& theArc,
 
   std::shared_ptr<GeomAPI_Pnt2d> aCenter = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
       theArc->attribute(SketchPlugin_Arc::CENTER_ID()))->pnt();
-  bool isReversed = theArc->boolean(SketchPlugin_Arc::INVERSED_ID())->value();
+  bool isReversed = theArc->boolean(SketchPlugin_Arc::REVERSED_ID())->value();
 
   // collect directions to each point
   std::shared_ptr<GeomAPI_Dir2d> aStartDir(
@@ -952,9 +952,6 @@ FeaturePtr SketchPlugin_Trim::createArcFeature(const FeaturePtr& theBaseFeature,
   // by arc; moreover, it may cause cyclicity in hte mechanism of updater
   bool aWasBlocked = aFeature->data()->blockSendAttributeUpdated(true);
 
-  aFeature->string(SketchPlugin_Arc::ARC_TYPE())->setValue(
-                SketchPlugin_Arc::ARC_TYPE_CENTER_START_END());
-
   fillAttribute(aFeature->attribute(SketchPlugin_Arc::CENTER_ID()),
                 theBaseFeature->attribute(aCenterAttributeId));
   fillPointAttribute(aFeature->attribute(SketchPlugin_Arc::START_ID()), theFirstPoint);
@@ -965,8 +962,8 @@ FeaturePtr SketchPlugin_Trim::createArcFeature(const FeaturePtr& theBaseFeature,
 
   /// fill referersed state of created arc as it is on the base arc
   if (theBaseFeature->getKind() == SketchPlugin_Arc::ID()) {
-    bool aReversed = theBaseFeature->boolean(SketchPlugin_Arc::INVERSED_ID())->value();
-    aFeature->boolean(SketchPlugin_Arc::INVERSED_ID())->setValue(aReversed);
+    bool aReversed = theBaseFeature->boolean(SketchPlugin_Arc::REVERSED_ID())->value();
+    aFeature->boolean(SketchPlugin_Arc::REVERSED_ID())->setValue(aReversed);
   }
   aFeature->execute(); // to obtain result
   aFeature->data()->blockSendAttributeUpdated(aWasBlocked);
index ce6ee3b3485f531fe145fbed96bfb7f78ffa5e98..7b929019cb77f29024f0d876f4b0699acb66d443 100755 (executable)
@@ -734,19 +734,6 @@ bool SketchPlugin_ArcTangentPointValidator::isValid(const AttributePtr& theAttri
     return false;
   }
 
-  // Check the tangent point is equal to arc end
-  FeaturePtr anArc = std::dynamic_pointer_cast<ModelAPI_Feature>(aRefAttr->owner());
-  std::shared_ptr<GeomDataAPI_Point2D> anEndPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-      anArc->attribute(SketchPlugin_Arc::END_ID()));
-  if (anEndPoint->isInitialized()) {
-    std::shared_ptr<GeomDataAPI_Point2D> aTangPt =
-        std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttr);
-    if (aTangPt->pnt()->distance(anEndPoint->pnt()) < tolerance) {
-      theError = "Unable to build arc on same points";
-      return false;
-    }
-  }
-
   return true;
 }
 
index 8a11e16c501772080c206a2c3fd4d23c7385f9d6..646060b45e0e3b5ff455ca04e9bdb49d0d21e9ac 100644 (file)
       </feature>
 
       <!-- SketchArc -->
-      <feature
-        id="SketchArc"
-        title="Arc"
-        tooltip="Create arc"
-        icon="icons/Sketch/arc.png">
-        <toolbox id="ArcType">
-          <box id="CenterStartEnd" title="Center and two points" icon="icons/Sketch/arc_base_32x32.png">
-            <sketch-2dpoint_selector id="ArcCenter" accept_expressions="0" title="Center" tooltip="Center of a circle"
-                                     enable_value="enable_by_preferences" reference_attribute="ArcCenterRef" />
-            <!--reference_attribute="ArcCenterRef" />-->
-            <sketch-2dpoint_selector id="ArcStartPoint" accept_expressions="0" title="Start point" tooltip="Start point"
-                                     enable_value="enable_by_preferences"/>
-            <sketch-2dpoint_selector id="ArcEndPoint" accept_expressions="0" title="End point" tooltip="End point"
-                                     enable_value="enable_by_preferences"/>
-            <validator id="GeomValidators_Different" parameters="ArcCenter,ArcStartPoint,ArcEndPoint"/>
-          </box>
-          <box id="ThreePoints" title="Three points on arc" icon="icons/Sketch/arc_3pt_32x32.png">
-            <sketch-2dpoint_selector id="ArcStartPoint" accept_expressions="0" title="Start point" tooltip="Start point"
-                                     enable_value="enable_by_preferences"/>
-            <sketch-2dpoint_selector id="ArcEndPoint" accept_expressions="0" title="End point" tooltip="End point"
-                                     enable_value="enable_by_preferences"/>
-            <sketch-2dpoint_selector id="ArcPassedPoint" accept_expressions="0" title="Passed point" tooltip="Passed point"
-                                     enable_value="enable_by_preferences"/>
-            <validator id="GeomValidators_Different" parameters="ArcStartPoint,ArcEndPoint,ArcPassedPoint"/>
-          </box>
-          <box id="Tangent" title="Tangent with edge" icon="icons/Sketch/arc_tang_32x32.png">
-            <sketch_shape_selector id="ArcTangentPoint" label="Tangent point" tooltip="Select point on line" shape_types="vertex">
-              <validator id="SketchPlugin_ArcTangentPoint" parameters="" />
-            </sketch_shape_selector>
-            <sketch-2dpoint_selector id="ArcEndPoint" accept_expressions="0" title="End point" tooltip="End point"
-                                     enable_value="enable_by_preferences"/>
-          </box>
-        </toolbox>
-        <labelvalue id="ArcRadius" accept_expressions="0" label="Radius:" default="computed" icon="icons/Sketch/radius.png"
-                     tooltip="Set radius" obligatory="0" enable_value="enable_by_preferences">
-          <validator id="GeomValidators_Positive"/>
+      <feature id="SketchArc"
+               icon="icons/Sketch/arc.png"
+               title="Arc"
+               tooltip="Create arc"
+               internal="1">
+        <sketch-2dpoint_selector id="center_point"
+                                 title="Center"
+                                 tooltip="Center of a circle"
+                                 accept_expressions="0"
+                                 enable_value="enable_by_preferences"/>
+        <sketch-2dpoint_selector id="start_point"
+                                 title="Start point"
+                                 tooltip="Start point"
+                                 accept_expressions="0"
+                                 enable_value="enable_by_preferences"/>
+        <sketch-2dpoint_selector id="end_point"
+                                 title="End point"
+                                 tooltip="End point"
+                                 accept_expressions="0"
+                                 enable_value="enable_by_preferences"/>
+        <validator id="GeomValidators_Different" parameters="center_point,start_point,end_point"/>
+        <labelvalue id="radius"
+                    icon="icons/Sketch/radius.png"
+                    label="Radius:"
+                    tooltip="Set radius"
+                    accept_expressions="0"
+                    min="0"
+                    default="0"
+                    obligatory="0"
+                    enable_value="enable_by_preferences">
         </labelvalue>
-        <labelvalue id="ArcAngle" label="Angle:" icon="icons/Sketch/angle.png" tooltip="Set angle" default="90" use_reset="false" obligatory="0"
-                     enable_value="enable_by_preferences"/>
-        <boolvalue id="Auxiliary" label="Auxiliary" default="false" tooltip="Construction element" obligatory="0"/>
+        <labelvalue id="angle"
+                    icon="icons/Sketch/angle.png"
+                    label="Angle:"
+                    tooltip="Set angle"
+                    default="0"
+                    use_reset="false"
+                    obligatory="0"
+                    enable_value="enable_by_preferences"/>
+        <boolvalue id="Auxiliary"
+                   label="Auxiliary"
+                   tooltip="Construction element"
+                   default="false"
+                   obligatory="0"/>
       </feature>
 
       <!-- SketchMacroArc -->
                                    label="Tangent point"
                                    tooltip="Select point on line"
                                    shape_types="vertex">
-              <!--<validator id="SketchPlugin_ArcTangentPoint"/>-->
+              <validator id="SketchPlugin_ArcTangentPoint"/>
             </sketch_shape_selector>
             <sketch-2dpoint_selector id="end_point_3"
                                      reference_attribute="end_point_ref"
index 7dd34c528d7f71aa8372846621b8bfe34e8b55a2..335997a2ed1979910353a93d7f6390b55114b6c3 100644 (file)
@@ -164,8 +164,8 @@ void mirrorEntities(const std::shared_ptr<GeomAPI_Lin2d>& theMirrorLine,
   // process specific features
   if (theOriginal->getKind() == SketchPlugin_Arc::ID()) {
     // orientation of arc
-    theMirrored->boolean(SketchPlugin_Arc::INVERSED_ID())->setValue(
-        !theOriginal->boolean(SketchPlugin_Arc::INVERSED_ID())->value());
+    theMirrored->boolean(SketchPlugin_Arc::REVERSED_ID())->setValue(
+        !theOriginal->boolean(SketchPlugin_Arc::REVERSED_ID())->value());
   } else if (theOriginal->getKind() == SketchPlugin_Circle::ID()) {
     // radius of the circle
     theMirrored->real(SketchPlugin_Circle::RADIUS_ID())->setValue(