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"
15 #include <SketchPlugin_Sketch.h>
16 #include <SketchPlugin_SketchEntity.h>
18 #include <ModelHighAPI_Interface.h>
19 #include <ModelHighAPI_Macro.h>
20 //--------------------------------------------------------------------------------------
21 class ModelAPI_CompositeFeature;
22 class ModelHighAPI_Double;
23 class ModelHighAPI_RefAttr;
24 class ModelHighAPI_Selection;
25 class SketchAPI_Circle;
27 //--------------------------------------------------------------------------------------
28 /**\class SketchAPI_Sketch
30 * \brief Interface for Sketch feature
32 class SketchAPI_Sketch : public ModelHighAPI_Interface
35 /// Constructor without values
37 explicit SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature);
38 /// Constructor with values
40 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
41 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
42 /// Constructor with values
44 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
45 const ModelHighAPI_Selection & theExternal);
48 virtual ~SketchAPI_Sketch();
50 INTERFACE_7(SketchPlugin_Sketch::ID(),
51 origin, SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point, /** Origin point */,
52 dirX, SketchPlugin_Sketch::DIRX_ID(), GeomDataAPI_Dir, /** Direction of X */,
53 normal, SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir, /** Normal */,
54 features, SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList, /** Features */,
55 external, SketchPlugin_SketchEntity::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */,
56 solverError, SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString, /** Solver error */,
57 solverDOF, SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString, /** Solver DOF */
62 void setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane);
66 void setExternal(const ModelHighAPI_Selection & theExternal);
68 // TODO(spo): addPoint
72 std::shared_ptr<SketchAPI_Line> addLine(
73 double theX1, double theY1, double theX2, double theY2);
76 std::shared_ptr<SketchAPI_Line> addLine(
77 const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
78 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
81 std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
84 std::shared_ptr<SketchAPI_Line> addLine(const std::string & theExternalName);
88 std::shared_ptr<SketchAPI_Circle> addCircle(
89 double theCenterX, double theCenterY,
93 std::shared_ptr<SketchAPI_Circle> addCircle(
94 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
98 std::shared_ptr<SketchAPI_Circle> addCircle(
99 double theX1, double theY1,
100 double theX2, double theY2,
101 double theX3, double theY3);
104 std::shared_ptr<SketchAPI_Circle> addCircle(
105 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
106 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
107 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
110 std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
113 std::shared_ptr<SketchAPI_Circle> addCircle(const std::string & theExternalName);
119 std::shared_ptr<ModelAPI_Feature> setCoincident(
120 const ModelHighAPI_RefAttr & thePoint1,
121 const ModelHighAPI_RefAttr & thePoint2);
125 std::shared_ptr<ModelAPI_Feature> setDistance(
126 const ModelHighAPI_RefAttr & thePoint,
127 const ModelHighAPI_RefAttr & theLine,
128 const ModelHighAPI_Double & theValue);
132 std::shared_ptr<ModelAPI_Feature> setLength(
133 const ModelHighAPI_RefAttr & theLine,
134 const ModelHighAPI_Double & theValue);
138 std::shared_ptr<ModelAPI_Feature> setParallel(
139 const ModelHighAPI_RefAttr & theLine1,
140 const ModelHighAPI_RefAttr & theLine2);
142 /// Set perpendicular
144 std::shared_ptr<ModelAPI_Feature> setPerpendicular(
145 const ModelHighAPI_RefAttr & theLine1,
146 const ModelHighAPI_RefAttr & theLine2);
148 // TODO(spo): set* (constraints)
150 // TODO(spo): addMirror
152 /// Set constraint value
155 const std::shared_ptr<ModelAPI_Feature> & theConstraint,
156 const ModelHighAPI_Double & theValue);
158 // TODO(spo): setText. Is it necessary as setValue accepts text expressions?
160 // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
163 std::list<ModelHighAPI_Selection> selectFace() const;
166 std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
170 //! Pointer on Sketch object
171 typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
173 /**\ingroup CPPHighAPI
174 * \brief Create Sketch feature
177 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
178 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
180 /**\ingroup CPPHighAPI
181 * \brief Create Sketch feature
184 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
185 const ModelHighAPI_Selection & theExternal);
187 /**\ingroup CPPHighAPI
188 * \brief Create Sketch feature
191 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
192 const std::string & theExternalName);
194 //--------------------------------------------------------------------------------------
195 //--------------------------------------------------------------------------------------
196 #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */