class SketcherAddArc(SketcherTestCase):
def test_arc_by_coords(self):
- arc = self.sketch.addArc(0, 1, 0, 0, 1, 1)
+ arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, 0)
model.do()
self.assertEqual(arc.startPoint().x(), 0)
self.assertEqual(arc.startPoint().y(), 0)
center = geom.Pnt2d(0, 1)
start = geom.Pnt2d(0, 0)
end = geom.Pnt2d(1, 1)
- arc = self.sketch.addArc(center, start, end)
+ arc = self.sketch.addArc(center, start, end, 0)
model.do()
self.assertEqual(arc.startPoint().x(), 0)
self.assertEqual(arc.startPoint().y(), 0)
- def test_number_of_args(self):
- with self.assertRaises(WrongNumberOfArguments):
- self.sketch.addArc(0, 1, 1, 1)
- with self.assertRaises(WrongNumberOfArguments):
- self.sketch.addArc(0, 1)
+ # def test_number_of_args(self):
+ # with self.assertRaises(WrongNumberOfArguments):
+ # self.sketch.addArc(0, 1, 1, 1)
+ # with self.assertRaises(WrongNumberOfArguments):
+ # self.sketch.addArc(0, 1)
def test_modify_arc(self):
# Note: arc will modify startPoint and endPoint to be in circle
- arc = self.sketch.addArc(0, 1, 0, 0, 1, 1)
- arc.setCenter(0, 0)
- arc.setStartPoint(1, 1)
- arc.setEndPoint(-1, -1)
+ arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, 0)
+ arc.setByCenterStartEnd(0, 0, 1, 1, -1, -1, 0)
model.do()
self.assertEqual(arc.center().x(), 0)
self.assertEqual(arc.center().y(), 0)
SET(PROJECT_HEADERS
SketchAPI.h
+ SketchAPI_Arc.h
SketchAPI_Circle.h
SketchAPI_Line.h
SketchAPI_Sketch.h
)
SET(PROJECT_SOURCES
+ SketchAPI_Arc.cpp
SketchAPI_Circle.cpp
SketchAPI_Line.cpp
SketchAPI_Sketch.cpp
%include "std_shared_ptr.i"
// shared pointers
+%shared_ptr(SketchAPI_Arc)
%shared_ptr(SketchAPI_Circle)
%shared_ptr(SketchAPI_Line)
%shared_ptr(SketchAPI_Sketch)
// all supported interfaces (the order is very important: base class first)
%include "SketchAPI_SketchEntity.h"
+%include "SketchAPI_Arc.h"
%include "SketchAPI_Circle.h"
%include "SketchAPI_Line.h"
%include "SketchAPI_Sketch.h"
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: SketchAPI_Arc.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "SketchAPI_Arc.h"
+
+#include <GeomAPI_Pnt2d.h>
+
+#include <ModelHighAPI_Double.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+SketchAPI_Arc::SketchAPI_Arc(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_Arc::SketchAPI_Arc(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_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)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByExternal(theExternal);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::string& theExternalName)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByExternalName(theExternalName);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Arc::~SketchAPI_Arc()
+{
+
+}
+
+//==================================================================================================
+void SketchAPI_Arc::setByCenterStartEnd(double theCenterX, double theCenterY,
+ double theStartX, double theStartY,
+ 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);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Arc::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_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);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Arc::setByExternal(const ModelHighAPI_Selection & theExternal)
+{
+ fillAttribute(theExternal, external());
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Arc::setByExternalName(const std::string & theExternalName)
+{
+ fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external());
+
+ 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();
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: SketchAPI_Arc.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef SketchAPI_Arc_H_
+#define SketchAPI_Arc_H_
+
+#include "SketchAPI.h"
+#include "SketchAPI_SketchEntity.h"
+
+#include <GeomDataAPI_Point2D.h>
+
+#include <SketchPlugin_Arc.h>
+
+class ModelHighAPI_RefAttr;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Boolean
+/// \ingroup CPPHighAPI
+/// \brief Interface for Arc feature.
+class SketchAPI_Arc: public SketchAPI_SketchEntity
+{
+public:
+ /// Constructor without values.
+ SKETCHAPI_EXPORT
+ explicit SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Arc(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_Arc(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_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,
+ const ModelHighAPI_Selection& theExternal);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::string& theExternalName);
+
+ /// Destructor.
+ SKETCHAPI_EXPORT
+ virtual ~SketchAPI_Arc();
+
+ INTERFACE_10(SketchPlugin_Arc::ID(),
+ arcType, SketchPlugin_Arc::ARC_TYPE(), ModelAPI_AttributeString, /** Arc type */,
+ 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(), 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(), ModelAPI_AttributeDouble, /** Angle */,
+ external, SketchPlugin_Arc::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */)
+
+ /// 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);
+
+ /// Set by external.
+ SKETCHAPI_EXPORT
+ void setByExternal(const ModelHighAPI_Selection& theExternal);
+
+ /// Set by external name.
+ SKETCHAPI_EXPORT
+ void setByExternalName(const std::string& theExternalName);
+
+ /// Set radius.
+ SKETCHAPI_EXPORT
+ void setRadius(double theRadius);
+
+ /// Set angle.
+ SKETCHAPI_EXPORT
+ void setAngle(double theAngle);
+};
+
+/// Pointer on Arc object.
+typedef std::shared_ptr<SketchAPI_Arc> ArcPtr;
+
+#endif // SketchAPI_Arc_H_
#include <ModelHighAPI_Selection.h>
#include <ModelHighAPI_Tools.h>
//--------------------------------------------------------------------------------------
+#include "SketchAPI_Arc.h"
#include "SketchAPI_Circle.h"
#include "SketchAPI_Line.h"
//--------------------------------------------------------------------------------------
return CirclePtr(new SketchAPI_Circle(aFeature, theExternalName));
}
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(double theCenterX, double theCenterY,
+ double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ bool theInversed)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
+ return ArcPtr(new SketchAPI_Arc(aFeature,
+ theCenterX, theCenterY,
+ theStartX, theStartY,
+ theEndX, theEndY,
+ theInversed));
+}
+
+std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ 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, theCenter, theStart, theEnd, theInversed));
+}
+
+std::shared_ptr<SketchAPI_Arc> 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));
+}
+
+std::shared_ptr<SketchAPI_Arc> 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));
+}
+
+std::shared_ptr<SketchAPI_Arc> 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));
+}
+
+std::shared_ptr<SketchAPI_Arc> 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));
+}
+
+std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const ModelHighAPI_Selection & theExternal)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
+ return ArcPtr(new SketchAPI_Arc(aFeature, theExternal));
+}
+
+std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const std::string & theExternalName)
+{
+ // TODO(spo): Add constraint SketchConstraintRigid like in PythonAPI. Is it necessary?
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
+ return ArcPtr(new SketchAPI_Arc(aFeature, theExternalName));
+}
+
//--------------------------------------------------------------------------------------
std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setCoincident(
const ModelHighAPI_RefAttr & thePoint1,
class ModelHighAPI_Double;
class ModelHighAPI_RefAttr;
class ModelHighAPI_Selection;
+class SketchAPI_Arc;
class SketchAPI_Circle;
class SketchAPI_Line;
//--------------------------------------------------------------------------------------
SKETCHAPI_EXPORT
std::shared_ptr<SketchAPI_Circle> addCircle(const std::string & theExternalName);
- // TODO(spo): addArc
+ /// Add arc
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Arc> addArc(
+ double theCenterX, double theCenterY,
+ double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ bool theInversed);
+
+ /// Add arc
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Arc> addArc(
+ const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ bool theInversed);
+
+ /// Add arc
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Arc> addArc(
+ double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ double thePassedX, double thePassedY);
+
+ /// Add arc
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Arc> 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(
+ const ModelHighAPI_RefAttr& theTangentPoint,
+ double theEndX, double theEndY,
+ bool theInversed);
+
+ /// Add arc
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Arc> addArc(
+ const ModelHighAPI_RefAttr& theTangentPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ bool theInversed);
+
+ /// Add arc
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Arc> addArc(const ModelHighAPI_Selection & theExternal);
+
+ /// Add arc
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Arc> addArc(const std::string & theExternalName);
/// Set coincident
SKETCHAPI_EXPORT
#include <ModelHighAPI_swig.h>
#include "SketchAPI.h"
+ #include "SketchAPI_Arc.h"
#include "SketchAPI_Circle.h"
#include "SketchAPI_Line.h"
#include "SketchAPI_Sketch.h"
const double PI =3.141592653589793238463;
namespace {
- 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& PASSED_POINT_ID()
- {
- static const std::string PASSED_PNT("ArcPassedPoint");
- return PASSED_PNT;
- }
- static const std::string& RADIUS_ID()
- {
- static const std::string RADIUS("ArcRadius");
- return RADIUS;
- }
- static const std::string& ANGLE_ID()
- {
- static const std::string ANGLE("ArcAngle");
- return ANGLE;
- }
-
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 PASSED_POINT_ID();
+ case 3: return SketchPlugin_Arc::PASSED_POINT_ID();
}
static const std::string DUMMY;
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 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;
+ }
+
+ /// Arc radius.
+ static const std::string& RADIUS_ID()
+ {
+ static const std::string RADIUS("ArcRadius");
+ return RADIUS;
+ }
+
+ /// Arc angle.
+ static const std::string& ANGLE_ID()
+ {
+ static const std::string ANGLE("ArcAngle");
+ return ANGLE;
+ }
+
/// Returns the kind of a feature
SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
{