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 ModelAPI_Object;
23 class ModelHighAPI_Double;
24 class ModelHighAPI_RefAttr;
25 class ModelHighAPI_Selection;
27 class SketchAPI_Circle;
29 class SketchAPI_Mirror;
30 class SketchAPI_Point;
31 //--------------------------------------------------------------------------------------
32 /**\class SketchAPI_Sketch
34 * \brief Interface for Sketch feature
36 class SketchAPI_Sketch : public ModelHighAPI_Interface
39 /// Constructor without values
41 explicit SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature);
42 /// Constructor with values
44 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
45 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
46 /// Constructor with values
48 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
49 const ModelHighAPI_Selection & theExternal);
52 virtual ~SketchAPI_Sketch();
54 INTERFACE_7(SketchPlugin_Sketch::ID(),
55 origin, SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point, /** Origin point */,
56 dirX, SketchPlugin_Sketch::DIRX_ID(), GeomDataAPI_Dir, /** Direction of X */,
57 normal, SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir, /** Normal */,
58 features, SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList, /** Features */,
59 external, SketchPlugin_SketchEntity::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */,
60 solverError, SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString, /** Solver error */,
61 solverDOF, SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString, /** Solver DOF */
66 void setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane);
70 void setExternal(const ModelHighAPI_Selection & theExternal);
72 // TODO(spo): addIntersection
76 std::shared_ptr<SketchAPI_Point> addPoint(
77 double theX, double theY);
80 std::shared_ptr<SketchAPI_Point> addPoint(
81 const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
84 std::shared_ptr<SketchAPI_Point> addPoint(const ModelHighAPI_Selection & theExternal);
87 std::shared_ptr<SketchAPI_Point> addPoint(const std::string & theExternalName);
91 std::shared_ptr<SketchAPI_Line> addLine(
92 double theX1, double theY1, double theX2, double theY2);
95 std::shared_ptr<SketchAPI_Line> addLine(
96 const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
97 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
100 std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
103 std::shared_ptr<SketchAPI_Line> addLine(const std::string & theExternalName);
107 std::shared_ptr<SketchAPI_Circle> addCircle(
108 double theCenterX, double theCenterY,
112 std::shared_ptr<SketchAPI_Circle> addCircle(
113 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
117 std::shared_ptr<SketchAPI_Circle> addCircle(
118 double theX1, double theY1,
119 double theX2, double theY2,
120 double theX3, double theY3);
123 std::shared_ptr<SketchAPI_Circle> addCircle(
124 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
125 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
126 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
129 std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
132 std::shared_ptr<SketchAPI_Circle> addCircle(const std::string & theExternalName);
136 std::shared_ptr<SketchAPI_Arc> addArc(
137 double theCenterX, double theCenterY,
138 double theStartX, double theStartY,
139 double theEndX, double theEndY,
144 std::shared_ptr<SketchAPI_Arc> addArc(
145 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
146 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
147 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
152 std::shared_ptr<SketchAPI_Arc> addArc(
153 double theStartX, double theStartY,
154 double theEndX, double theEndY,
155 double thePassedX, double thePassedY);
159 std::shared_ptr<SketchAPI_Arc> addArc(
160 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
161 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
162 const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
166 std::shared_ptr<SketchAPI_Arc> addArc(
167 const ModelHighAPI_RefAttr& theTangentPoint,
168 double theEndX, double theEndY,
173 std::shared_ptr<SketchAPI_Arc> addArc(
174 const ModelHighAPI_RefAttr& theTangentPoint,
175 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
180 std::shared_ptr<SketchAPI_Arc> addArc(const ModelHighAPI_Selection & theExternal);
184 std::shared_ptr<SketchAPI_Arc> addArc(const std::string & theExternalName);
188 std::shared_ptr<SketchAPI_Mirror> addMirror(
189 const ModelHighAPI_RefAttr & theMirrorLine,
190 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects);
194 std::shared_ptr<ModelAPI_Feature> setAngle(
195 const ModelHighAPI_RefAttr & theLine1,
196 const ModelHighAPI_RefAttr & theLine2,
197 const ModelHighAPI_Double & theValue);
201 std::shared_ptr<ModelAPI_Feature> setCoincident(
202 const ModelHighAPI_RefAttr & thePoint1,
203 const ModelHighAPI_RefAttr & thePoint2);
207 std::shared_ptr<ModelAPI_Feature> setCollinear(
208 const ModelHighAPI_RefAttr & theLine1,
209 const ModelHighAPI_RefAttr & theLine2);
213 std::shared_ptr<ModelAPI_Feature> setDistance(
214 const ModelHighAPI_RefAttr & thePoint,
215 const ModelHighAPI_RefAttr & thePointOrLine,
216 const ModelHighAPI_Double & theValue);
220 std::shared_ptr<ModelAPI_Feature> setEqual(
221 const ModelHighAPI_RefAttr & theObject1,
222 const ModelHighAPI_RefAttr & theObject2);
226 std::shared_ptr<ModelAPI_Feature> setFillet(
227 const std::list<ModelHighAPI_RefAttr> & thePoints,
228 const ModelHighAPI_Double & theRadius);
232 std::shared_ptr<ModelAPI_Feature> setHorizontal(
233 const ModelHighAPI_RefAttr & theLine);
237 std::shared_ptr<ModelAPI_Feature> setLength(
238 const ModelHighAPI_RefAttr & theLine,
239 const ModelHighAPI_Double & theValue);
243 std::shared_ptr<ModelAPI_Feature> setMiddlePoint(
244 const ModelHighAPI_RefAttr & thePoint,
245 const ModelHighAPI_RefAttr & theLine);
249 std::shared_ptr<ModelAPI_Feature> setParallel(
250 const ModelHighAPI_RefAttr & theLine1,
251 const ModelHighAPI_RefAttr & theLine2);
253 /// Set perpendicular
255 std::shared_ptr<ModelAPI_Feature> setPerpendicular(
256 const ModelHighAPI_RefAttr & theLine1,
257 const ModelHighAPI_RefAttr & theLine2);
261 std::shared_ptr<ModelAPI_Feature> setRadius(
262 const ModelHighAPI_RefAttr & theCircleOrArc,
263 const ModelHighAPI_Double & theValue);
267 std::shared_ptr<ModelAPI_Feature> setRigid(
268 const ModelHighAPI_RefAttr & theObject);
272 std::shared_ptr<ModelAPI_Feature> setTangent(
273 const ModelHighAPI_RefAttr & theLine,
274 const ModelHighAPI_RefAttr & theCircle);
278 std::shared_ptr<ModelAPI_Feature> setVertical(
279 const ModelHighAPI_RefAttr & theLine);
281 // TODO(spo): addRectagle, projection, Translation, Rotation
283 /// Set constraint value
286 const std::shared_ptr<ModelAPI_Feature> & theConstraint,
287 const ModelHighAPI_Double & theValue);
289 // TODO(spo): setText. Is it necessary as setValue accepts text expressions?
291 // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
294 std::list<ModelHighAPI_Selection> selectFace() const;
297 std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
301 //! Pointer on Sketch object
302 typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
304 /**\ingroup CPPHighAPI
305 * \brief Create Sketch feature
308 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
309 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
311 /**\ingroup CPPHighAPI
312 * \brief Create Sketch feature
315 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
316 const ModelHighAPI_Selection & theExternal);
318 /**\ingroup CPPHighAPI
319 * \brief Create Sketch feature
322 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
323 const std::string & theExternalName);
325 //--------------------------------------------------------------------------------------
326 //--------------------------------------------------------------------------------------
327 #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */