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_Integer;
25 class ModelHighAPI_RefAttr;
26 class ModelHighAPI_Selection;
28 class SketchAPI_Circle;
30 class SketchAPI_Mirror;
31 class SketchAPI_Point;
32 class SketchAPI_Translation;
33 //--------------------------------------------------------------------------------------
34 /**\class SketchAPI_Sketch
36 * \brief Interface for Sketch feature
38 class SketchAPI_Sketch : public ModelHighAPI_Interface
41 /// Constructor without values
43 explicit SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature);
44 /// Constructor with values
46 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
47 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
48 /// Constructor with values
50 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
51 const ModelHighAPI_Selection & theExternal);
54 virtual ~SketchAPI_Sketch();
56 INTERFACE_7(SketchPlugin_Sketch::ID(),
57 origin, SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point, /** Origin point */,
58 dirX, SketchPlugin_Sketch::DIRX_ID(), GeomDataAPI_Dir, /** Direction of X */,
59 normal, SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir, /** Normal */,
60 features, SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList, /** Features */,
61 external, SketchPlugin_SketchEntity::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */,
62 solverError, SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString, /** Solver error */,
63 solverDOF, SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString, /** Solver DOF */
68 void setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane);
72 void setExternal(const ModelHighAPI_Selection & theExternal);
74 // TODO(spo): addIntersection
78 std::shared_ptr<SketchAPI_Point> addPoint(
79 double theX, double theY);
82 std::shared_ptr<SketchAPI_Point> addPoint(
83 const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
86 std::shared_ptr<SketchAPI_Point> addPoint(const ModelHighAPI_Selection & theExternal);
89 std::shared_ptr<SketchAPI_Point> addPoint(const std::string & theExternalName);
93 std::shared_ptr<SketchAPI_Line> addLine(
94 double theX1, double theY1, double theX2, double theY2);
97 std::shared_ptr<SketchAPI_Line> addLine(
98 const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
99 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
102 std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
105 std::shared_ptr<SketchAPI_Line> addLine(const std::string & theExternalName);
109 std::shared_ptr<SketchAPI_Circle> addCircle(
110 double theCenterX, double theCenterY,
114 std::shared_ptr<SketchAPI_Circle> addCircle(
115 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
119 std::shared_ptr<SketchAPI_Circle> addCircle(
120 double theX1, double theY1,
121 double theX2, double theY2,
122 double theX3, double theY3);
125 std::shared_ptr<SketchAPI_Circle> addCircle(
126 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
127 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
128 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
131 std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
134 std::shared_ptr<SketchAPI_Circle> addCircle(const std::string & theExternalName);
138 std::shared_ptr<SketchAPI_Arc> addArc(
139 double theCenterX, double theCenterY,
140 double theStartX, double theStartY,
141 double theEndX, double theEndY,
146 std::shared_ptr<SketchAPI_Arc> addArc(
147 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
148 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
149 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
154 std::shared_ptr<SketchAPI_Arc> addArc(
155 double theStartX, double theStartY,
156 double theEndX, double theEndY,
157 double thePassedX, double thePassedY);
161 std::shared_ptr<SketchAPI_Arc> addArc(
162 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
163 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
164 const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
168 std::shared_ptr<SketchAPI_Arc> addArc(
169 const ModelHighAPI_RefAttr& theTangentPoint,
170 double theEndX, double theEndY,
175 std::shared_ptr<SketchAPI_Arc> addArc(
176 const ModelHighAPI_RefAttr& theTangentPoint,
177 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
182 std::shared_ptr<SketchAPI_Arc> addArc(const ModelHighAPI_Selection & theExternal);
186 std::shared_ptr<SketchAPI_Arc> addArc(const std::string & theExternalName);
190 std::shared_ptr<SketchAPI_Mirror> addMirror(
191 const ModelHighAPI_RefAttr & theMirrorLine,
192 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects);
196 std::shared_ptr<SketchAPI_Translation> addTranslation(
197 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
198 const ModelHighAPI_RefAttr & thePoint1,
199 const ModelHighAPI_RefAttr & thePoint2,
200 const ModelHighAPI_Integer & theNumberOfObjects,
201 bool theFullValue = false);
205 std::shared_ptr<ModelAPI_Feature> setAngle(
206 const ModelHighAPI_RefAttr & theLine1,
207 const ModelHighAPI_RefAttr & theLine2,
208 const ModelHighAPI_Double & theValue);
212 std::shared_ptr<ModelAPI_Feature> setCoincident(
213 const ModelHighAPI_RefAttr & thePoint1,
214 const ModelHighAPI_RefAttr & thePoint2);
218 std::shared_ptr<ModelAPI_Feature> setCollinear(
219 const ModelHighAPI_RefAttr & theLine1,
220 const ModelHighAPI_RefAttr & theLine2);
224 std::shared_ptr<ModelAPI_Feature> setDistance(
225 const ModelHighAPI_RefAttr & thePoint,
226 const ModelHighAPI_RefAttr & thePointOrLine,
227 const ModelHighAPI_Double & theValue);
231 std::shared_ptr<ModelAPI_Feature> setEqual(
232 const ModelHighAPI_RefAttr & theObject1,
233 const ModelHighAPI_RefAttr & theObject2);
237 std::shared_ptr<ModelAPI_Feature> setFillet(
238 const std::list<ModelHighAPI_RefAttr> & thePoints,
239 const ModelHighAPI_Double & theRadius);
243 std::shared_ptr<ModelAPI_Feature> setHorizontal(
244 const ModelHighAPI_RefAttr & theLine);
248 std::shared_ptr<ModelAPI_Feature> setLength(
249 const ModelHighAPI_RefAttr & theLine,
250 const ModelHighAPI_Double & theValue);
254 std::shared_ptr<ModelAPI_Feature> setMiddlePoint(
255 const ModelHighAPI_RefAttr & thePoint,
256 const ModelHighAPI_RefAttr & theLine);
260 std::shared_ptr<ModelAPI_Feature> setParallel(
261 const ModelHighAPI_RefAttr & theLine1,
262 const ModelHighAPI_RefAttr & theLine2);
264 /// Set perpendicular
266 std::shared_ptr<ModelAPI_Feature> setPerpendicular(
267 const ModelHighAPI_RefAttr & theLine1,
268 const ModelHighAPI_RefAttr & theLine2);
272 std::shared_ptr<ModelAPI_Feature> setRadius(
273 const ModelHighAPI_RefAttr & theCircleOrArc,
274 const ModelHighAPI_Double & theValue);
278 std::shared_ptr<ModelAPI_Feature> setRigid(
279 const ModelHighAPI_RefAttr & theObject);
283 std::shared_ptr<ModelAPI_Feature> setTangent(
284 const ModelHighAPI_RefAttr & theLine,
285 const ModelHighAPI_RefAttr & theCircle);
289 std::shared_ptr<ModelAPI_Feature> setVertical(
290 const ModelHighAPI_RefAttr & theLine);
292 // TODO(spo): addRectagle, projection, Translation, Rotation
294 /// Set constraint value
297 const std::shared_ptr<ModelAPI_Feature> & theConstraint,
298 const ModelHighAPI_Double & theValue);
300 // TODO(spo): setText. Is it necessary as setValue accepts text expressions?
302 // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
305 std::list<ModelHighAPI_Selection> selectFace() const;
308 std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
312 //! Pointer on Sketch object
313 typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
315 /**\ingroup CPPHighAPI
316 * \brief Create Sketch feature
319 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
320 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
322 /**\ingroup CPPHighAPI
323 * \brief Create Sketch feature
326 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
327 const ModelHighAPI_Selection & theExternal);
329 /**\ingroup CPPHighAPI
330 * \brief Create Sketch feature
333 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
334 const std::string & theExternalName);
336 //--------------------------------------------------------------------------------------
337 //--------------------------------------------------------------------------------------
338 #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */