1 // Name : SketchAPI_Sketch.h
5 // 07/06/16 - Sergey POKHODENKO - Creation of the file
7 #ifndef SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_
8 #define SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_
10 //--------------------------------------------------------------------------------------
11 #include "SketchAPI.h"
13 #include <SketchPlugin_Sketch.h>
14 #include <SketchPlugin_SketchEntity.h>
16 #include <ModelHighAPI_Interface.h>
17 #include <ModelHighAPI_Macro.h>
18 //--------------------------------------------------------------------------------------
19 class ModelAPI_CompositeFeature;
20 class ModelHighAPI_Double;
21 class ModelHighAPI_RefAttr;
22 class ModelHighAPI_Selection;
23 class SketchAPI_Circle;
25 //--------------------------------------------------------------------------------------
26 /**\class SketchAPI_Sketch
28 * \brief Interface for Sketch feature
30 class SketchAPI_Sketch : public ModelHighAPI_Interface
33 /// Constructor without values
35 explicit SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature);
36 /// Constructor with values
38 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
39 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
40 /// Constructor with values
42 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
43 const ModelHighAPI_Selection & theExternal);
46 virtual ~SketchAPI_Sketch();
48 INTERFACE_7(SketchPlugin_Sketch::ID(),
49 origin, SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point, /** Origin point */,
50 dirX, SketchPlugin_Sketch::DIRX_ID(), GeomDataAPI_Dir, /** Direction of X */,
51 normal, SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir, /** Normal */,
52 features, SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList, /** Features */,
53 external, SketchPlugin_SketchEntity::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */,
54 solverError, SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString, /** Solver error */,
55 solverDOF, SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString, /** Solver DOF */
60 void setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane);
64 void setExternal(const ModelHighAPI_Selection & theExternal);
66 // TODO(spo): addPoint
70 std::shared_ptr<SketchAPI_Line> addLine(
71 double theX1, double theY1, double theX2, double theY2);
74 std::shared_ptr<SketchAPI_Line> addLine(
75 const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
76 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
79 std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
82 std::shared_ptr<SketchAPI_Line> addLine(const std::string & theExternalName);
86 std::shared_ptr<SketchAPI_Circle> addCircle(
87 double theCenterX, double theCenterY,
91 std::shared_ptr<SketchAPI_Circle> addCircle(
92 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
96 std::shared_ptr<SketchAPI_Circle> addCircle(
97 double theX1, double theY1,
98 double theX2, double theY2,
99 double theX3, double theY3);
102 std::shared_ptr<SketchAPI_Circle> addCircle(
103 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
104 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
105 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
108 std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
111 std::shared_ptr<SketchAPI_Circle> addCircle(const std::string & theExternalName);
117 std::shared_ptr<ModelAPI_Feature> setCoincident(
118 // TODO(spo): should it be more concrete type (e.g. ModelAPI_Object)?
119 const ModelHighAPI_RefAttr & thePoint1,
120 const ModelHighAPI_RefAttr & thePoint2);
122 // TODO(spo): set* (constraints)
124 // TODO(spo): addMirror
129 const std::shared_ptr<ModelAPI_Feature> & theConstraint,
130 const ModelHighAPI_Double & theValue);
132 // TODO(spo): setText. Is it necessary as setValue accepts text expressions?
135 std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
139 //! Pointer on Sketch object
140 typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
142 /**\ingroup CPPHighAPI
143 * \brief Create Sketch feature
146 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
147 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
149 /**\ingroup CPPHighAPI
150 * \brief Create Sketch feature
153 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
154 const ModelHighAPI_Selection & theExternal);
156 //--------------------------------------------------------------------------------------
157 //--------------------------------------------------------------------------------------
158 #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */