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;
26 class SketchAPI_Circle;
28 class SketchAPI_Point;
29 //--------------------------------------------------------------------------------------
30 /**\class SketchAPI_Sketch
32 * \brief Interface for Sketch feature
34 class SketchAPI_Sketch : public ModelHighAPI_Interface
37 /// Constructor without values
39 explicit SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature);
40 /// Constructor with values
42 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
43 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
44 /// Constructor with values
46 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
47 const ModelHighAPI_Selection & theExternal);
50 virtual ~SketchAPI_Sketch();
52 INTERFACE_7(SketchPlugin_Sketch::ID(),
53 origin, SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point, /** Origin point */,
54 dirX, SketchPlugin_Sketch::DIRX_ID(), GeomDataAPI_Dir, /** Direction of X */,
55 normal, SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir, /** Normal */,
56 features, SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList, /** Features */,
57 external, SketchPlugin_SketchEntity::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */,
58 solverError, SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString, /** Solver error */,
59 solverDOF, SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString, /** Solver DOF */
64 void setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane);
68 void setExternal(const ModelHighAPI_Selection & theExternal);
70 // TODO(spo): addIntersection
74 std::shared_ptr<SketchAPI_Point> addPoint(
75 double theX, double theY);
78 std::shared_ptr<SketchAPI_Point> addPoint(
79 const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
82 std::shared_ptr<SketchAPI_Point> addPoint(const ModelHighAPI_Selection & theExternal);
85 std::shared_ptr<SketchAPI_Point> addPoint(const std::string & theExternalName);
89 std::shared_ptr<SketchAPI_Line> addLine(
90 double theX1, double theY1, double theX2, double theY2);
93 std::shared_ptr<SketchAPI_Line> addLine(
94 const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
95 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
98 std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
101 std::shared_ptr<SketchAPI_Line> addLine(const std::string & theExternalName);
105 std::shared_ptr<SketchAPI_Circle> addCircle(
106 double theCenterX, double theCenterY,
110 std::shared_ptr<SketchAPI_Circle> addCircle(
111 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
115 std::shared_ptr<SketchAPI_Circle> addCircle(
116 double theX1, double theY1,
117 double theX2, double theY2,
118 double theX3, double theY3);
121 std::shared_ptr<SketchAPI_Circle> addCircle(
122 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
123 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
124 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
127 std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
130 std::shared_ptr<SketchAPI_Circle> addCircle(const std::string & theExternalName);
134 std::shared_ptr<SketchAPI_Arc> addArc(
135 double theCenterX, double theCenterY,
136 double theStartX, double theStartY,
137 double theEndX, double theEndY,
142 std::shared_ptr<SketchAPI_Arc> addArc(
143 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
144 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
145 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
150 std::shared_ptr<SketchAPI_Arc> addArc(
151 double theStartX, double theStartY,
152 double theEndX, double theEndY,
153 double thePassedX, double thePassedY);
157 std::shared_ptr<SketchAPI_Arc> addArc(
158 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
159 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
160 const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
164 std::shared_ptr<SketchAPI_Arc> addArc(
165 const ModelHighAPI_RefAttr& theTangentPoint,
166 double theEndX, double theEndY,
171 std::shared_ptr<SketchAPI_Arc> addArc(
172 const ModelHighAPI_RefAttr& theTangentPoint,
173 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
178 std::shared_ptr<SketchAPI_Arc> addArc(const ModelHighAPI_Selection & theExternal);
182 std::shared_ptr<SketchAPI_Arc> addArc(const std::string & theExternalName);
186 std::shared_ptr<ModelAPI_Feature> setAngle(
187 const ModelHighAPI_RefAttr & theLine1,
188 const ModelHighAPI_RefAttr & theLine2,
189 const ModelHighAPI_Double & theValue);
193 std::shared_ptr<ModelAPI_Feature> setCoincident(
194 const ModelHighAPI_RefAttr & thePoint1,
195 const ModelHighAPI_RefAttr & thePoint2);
199 std::shared_ptr<ModelAPI_Feature> setCollinear(
200 const ModelHighAPI_RefAttr & theLine1,
201 const ModelHighAPI_RefAttr & theLine2);
205 std::shared_ptr<ModelAPI_Feature> setDistance(
206 const ModelHighAPI_RefAttr & thePoint,
207 const ModelHighAPI_RefAttr & thePointOrLine,
208 const ModelHighAPI_Double & theValue);
212 std::shared_ptr<ModelAPI_Feature> setEqual(
213 const ModelHighAPI_RefAttr & theObject1,
214 const ModelHighAPI_RefAttr & theObject2);
218 std::shared_ptr<ModelAPI_Feature> setFillet(
219 const std::list<ModelHighAPI_RefAttr> & thePoints,
220 const ModelHighAPI_Double & theRadius);
224 std::shared_ptr<ModelAPI_Feature> setHorizontal(
225 const ModelHighAPI_RefAttr & theLine);
229 std::shared_ptr<ModelAPI_Feature> setLength(
230 const ModelHighAPI_RefAttr & theLine,
231 const ModelHighAPI_Double & theValue);
235 std::shared_ptr<ModelAPI_Feature> setMiddlePoint(
236 const ModelHighAPI_RefAttr & thePoint,
237 const ModelHighAPI_RefAttr & theLine);
239 // TODO(spo): setMirror
243 std::shared_ptr<ModelAPI_Feature> setParallel(
244 const ModelHighAPI_RefAttr & theLine1,
245 const ModelHighAPI_RefAttr & theLine2);
247 /// Set perpendicular
249 std::shared_ptr<ModelAPI_Feature> setPerpendicular(
250 const ModelHighAPI_RefAttr & theLine1,
251 const ModelHighAPI_RefAttr & theLine2);
255 std::shared_ptr<ModelAPI_Feature> setRadius(
256 const ModelHighAPI_RefAttr & theCircleOrArc,
257 const ModelHighAPI_Double & theValue);
261 std::shared_ptr<ModelAPI_Feature> setRigid(
262 const ModelHighAPI_RefAttr & theObject);
266 std::shared_ptr<ModelAPI_Feature> setTangent(
267 const ModelHighAPI_RefAttr & theLine,
268 const ModelHighAPI_RefAttr & theCircle);
272 std::shared_ptr<ModelAPI_Feature> setVertical(
273 const ModelHighAPI_RefAttr & theLine);
275 // TODO(spo): addRectagle, projection, Translation, Rotation
277 /// Set constraint value
280 const std::shared_ptr<ModelAPI_Feature> & theConstraint,
281 const ModelHighAPI_Double & theValue);
283 // TODO(spo): setText. Is it necessary as setValue accepts text expressions?
285 // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
288 std::list<ModelHighAPI_Selection> selectFace() const;
291 std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
295 //! Pointer on Sketch object
296 typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
298 /**\ingroup CPPHighAPI
299 * \brief Create Sketch feature
302 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
303 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
305 /**\ingroup CPPHighAPI
306 * \brief Create Sketch feature
309 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
310 const ModelHighAPI_Selection & theExternal);
312 /**\ingroup CPPHighAPI
313 * \brief Create Sketch feature
316 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
317 const std::string & theExternalName);
319 //--------------------------------------------------------------------------------------
320 //--------------------------------------------------------------------------------------
321 #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */