+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_Ellipse> SketchAPI_Sketch::addEllipse(
+ double theCenterX, double theCenterY,
+ double theFocusX, double theFocusY,
+ double theMinorRadius)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_Ellipse::ID());
+ return EllipsePtr(new SketchAPI_Ellipse(aFeature,
+ theCenterX, theCenterY, theFocusX, theFocusY, theMinorRadius));
+}
+
+std::shared_ptr<SketchAPI_Ellipse> SketchAPI_Sketch::addEllipse(
+ const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theFocus,
+ double theMinorRadius)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_Ellipse::ID());
+ return EllipsePtr(new SketchAPI_Ellipse(aFeature, theCenter, theFocus, theMinorRadius));
+}
+
+std::shared_ptr<SketchAPI_MacroEllipse> SketchAPI_Sketch::addEllipse(
+ double thePoint1X, double thePoint1Y,
+ double thePoint2X, double thePoint2Y,
+ double thePassedX, double thePassedY,
+ bool isPoint1Center)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_MacroEllipse::ID());
+ return MacroEllipsePtr(new SketchAPI_MacroEllipse(aFeature,
+ thePoint1X, thePoint1Y, thePoint2X, thePoint2Y, thePassedX, thePassedY, isPoint1Center));
+}
+
+std::shared_ptr<SketchAPI_MacroEllipse> SketchAPI_Sketch::addEllipse(
+ const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>& thePoint1,
+ const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>& thePoint2,
+ const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>& thePassedPoint,
+ bool isPoint1Center)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_MacroEllipse::ID());
+ MacroEllipsePtr anEllipse;
+ if (thePoint1.second.isEmpty() &&
+ thePoint2.second.isEmpty() &&
+ thePassedPoint.second.isEmpty()) {
+ anEllipse.reset(new SketchAPI_MacroEllipse(aFeature,
+ thePoint1.first, thePoint2.first, thePassedPoint.first, isPoint1Center));
+ }
+ else {
+ anEllipse.reset(new SketchAPI_MacroEllipse(aFeature,
+ thePoint1.first, thePoint1.second,
+ thePoint2.first, thePoint2.second,
+ thePassedPoint.first, thePassedPoint.second,
+ isPoint1Center));
+ }
+ return anEllipse;
+}
+
+std::shared_ptr<SketchAPI_Ellipse> SketchAPI_Sketch::addEllipse(
+ const ModelHighAPI_Selection & theExternal)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_Ellipse::ID());
+ return EllipsePtr(new SketchAPI_Ellipse(aFeature, theExternal));
+}
+
+std::shared_ptr<SketchAPI_Ellipse> SketchAPI_Sketch::addEllipse(
+ const std::string & theExternalName)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_Ellipse::ID());
+ return EllipsePtr(new SketchAPI_Ellipse(aFeature, theExternalName));
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_EllipticArc> SketchAPI_Sketch::addEllipticArc(
+ double theCenterX, double theCenterY,
+ double theFocusX, double theFocusY,
+ double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ bool theInversed)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_EllipticArc::ID());
+ return EllipticArcPtr(new SketchAPI_EllipticArc(aFeature,
+ theCenterX, theCenterY,
+ theFocusX, theFocusY,
+ theStartX, theStartY,
+ theEndX, theEndY,
+ theInversed));
+}
+
+std::shared_ptr<SketchAPI_MacroEllipticArc> SketchAPI_Sketch::addEllipticArc(
+ const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>& theCenter,
+ const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>& theMajorAxisPoint,
+ const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>& theStartPoint,
+ const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>& theEndPoint,
+ bool theInversed)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_MacroEllipticArc::ID());
+ return MacroEllipticArcPtr(new SketchAPI_MacroEllipticArc(aFeature,
+ theCenter.first, theCenter.second,
+ theMajorAxisPoint.first, theMajorAxisPoint.second,
+ theStartPoint.first, theStartPoint.second,
+ theEndPoint.first, theEndPoint.second,
+ theInversed));
+}
+
+std::shared_ptr<SketchAPI_EllipticArc> SketchAPI_Sketch::addEllipticArc(
+ const ModelHighAPI_Selection & theExternal)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_EllipticArc::ID());
+ return EllipticArcPtr(new SketchAPI_EllipticArc(aFeature, theExternal));
+}
+
+std::shared_ptr<SketchAPI_EllipticArc> SketchAPI_Sketch::addEllipticArc(
+ const std::string & theExternalName)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_EllipticArc::ID());
+ return EllipticArcPtr(new SketchAPI_EllipticArc(aFeature, theExternalName));
+}
+
+//--------------------------------------------------------------------------------------
+
+std::shared_ptr<SketchAPI_BSpline> SketchAPI_Sketch::addSpline(
+ const ModelHighAPI_Selection & external,
+ const int degree,
+ const std::list<std::shared_ptr<GeomAPI_Pnt2d> >& poles,
+ const std::list<ModelHighAPI_Double>& weights,
+ const std::list<ModelHighAPI_Double>& knots,
+ const std::list<ModelHighAPI_Integer>& multiplicities,
+ const bool periodic)
+{
+ FeaturePtr aFeature = compositeFeature()->addFeature(
+ periodic ? SketchPlugin_BSplinePeriodic::ID() : SketchPlugin_BSpline::ID());
+
+ BSplinePtr aBSpline(periodic ? new SketchAPI_BSplinePeriodic(aFeature)
+ : new SketchAPI_BSpline(aFeature));
+ if (external.variantType() != ModelHighAPI_Selection::VT_Empty)
+ aBSpline->setByExternal(external);
+ else if (knots.empty() || multiplicities.empty())
+ aBSpline->setByDegreePolesAndWeights(degree, poles, weights);
+ else
+ aBSpline->setByParameters(degree, poles, weights, knots, multiplicities);
+
+ return aBSpline;
+}
+