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;
29 class SketchAPI_IntersectionPoint;
31 class SketchAPI_Mirror;
32 class SketchAPI_Point;
33 class SketchAPI_Rotation;
34 class SketchAPI_Translation;
35 //--------------------------------------------------------------------------------------
36 /**\class SketchAPI_Sketch
38 * \brief Interface for Sketch feature
40 class SketchAPI_Sketch : public ModelHighAPI_Interface
43 /// Constructor without values
45 explicit SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature);
46 /// Constructor with values
48 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
49 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
50 /// Constructor with values
52 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
53 const ModelHighAPI_Selection & theExternal);
56 virtual ~SketchAPI_Sketch();
58 INTERFACE_7(SketchPlugin_Sketch::ID(),
59 origin, SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point, /** Origin point */,
60 dirX, SketchPlugin_Sketch::DIRX_ID(), GeomDataAPI_Dir, /** Direction of X */,
61 normal, SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir, /** Normal */,
62 features, SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList, /** Features */,
63 external, SketchPlugin_SketchEntity::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */,
64 solverError, SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString, /** Solver error */,
65 solverDOF, SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString, /** Solver DOF */
70 void setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane);
74 void setExternal(const ModelHighAPI_Selection & theExternal);
76 // TODO(spo): addIntersection
80 std::shared_ptr<SketchAPI_Point> addPoint(
81 double theX, double theY);
84 std::shared_ptr<SketchAPI_Point> addPoint(
85 const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
88 std::shared_ptr<SketchAPI_Point> addPoint(const ModelHighAPI_Selection & theExternal);
91 std::shared_ptr<SketchAPI_Point> addPoint(const std::string & theExternalName);
93 /// Add intersection point
95 std::shared_ptr<SketchAPI_IntersectionPoint> addIntersectionPoint(const ModelHighAPI_Selection & theExternal);
98 std::shared_ptr<SketchAPI_IntersectionPoint> addIntersectionPoint(const std::string & theExternalName);
102 std::shared_ptr<SketchAPI_Line> addLine(
103 double theX1, double theY1, double theX2, double theY2);
106 std::shared_ptr<SketchAPI_Line> addLine(
107 const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
108 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
111 std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
114 std::shared_ptr<SketchAPI_Line> addLine(const std::string & theExternalName);
118 std::shared_ptr<SketchAPI_Circle> addCircle(
119 double theCenterX, double theCenterY,
123 std::shared_ptr<SketchAPI_Circle> addCircle(
124 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
128 std::shared_ptr<SketchAPI_Circle> addCircle(
129 double theX1, double theY1,
130 double theX2, double theY2,
131 double theX3, double theY3);
134 std::shared_ptr<SketchAPI_Circle> addCircle(
135 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
136 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
137 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
140 std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
143 std::shared_ptr<SketchAPI_Circle> addCircle(const std::string & theExternalName);
147 std::shared_ptr<SketchAPI_Arc> addArc(
148 double theCenterX, double theCenterY,
149 double theStartX, double theStartY,
150 double theEndX, double theEndY,
155 std::shared_ptr<SketchAPI_Arc> addArc(
156 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
157 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
158 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
163 std::shared_ptr<SketchAPI_Arc> addArc(
164 double theStartX, double theStartY,
165 double theEndX, double theEndY,
166 double thePassedX, double thePassedY);
170 std::shared_ptr<SketchAPI_Arc> addArc(
171 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
172 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
173 const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
177 std::shared_ptr<SketchAPI_Arc> addArc(
178 const ModelHighAPI_RefAttr& theTangentPoint,
179 double theEndX, double theEndY,
184 std::shared_ptr<SketchAPI_Arc> addArc(
185 const ModelHighAPI_RefAttr& theTangentPoint,
186 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
191 std::shared_ptr<SketchAPI_Arc> addArc(const ModelHighAPI_Selection & theExternal);
195 std::shared_ptr<SketchAPI_Arc> addArc(const std::string & theExternalName);
199 std::shared_ptr<SketchAPI_Mirror> addMirror(
200 const ModelHighAPI_RefAttr & theMirrorLine,
201 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects);
205 std::shared_ptr<SketchAPI_Translation> addTranslation(
206 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
207 const ModelHighAPI_RefAttr & thePoint1,
208 const ModelHighAPI_RefAttr & thePoint2,
209 const ModelHighAPI_Integer & theNumberOfObjects,
210 bool theFullValue = false);
214 std::shared_ptr<SketchAPI_Rotation> addRotation(
215 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
216 const ModelHighAPI_RefAttr & theCenter,
217 const ModelHighAPI_Double & theAngle,
218 const ModelHighAPI_Integer & theNumberOfObjects,
219 bool theFullValue = false);
223 std::shared_ptr<ModelAPI_Feature> setAngle(
224 const ModelHighAPI_RefAttr & theLine1,
225 const ModelHighAPI_RefAttr & theLine2,
226 const ModelHighAPI_Double & theValue);
230 std::shared_ptr<ModelAPI_Feature> setCoincident(
231 const ModelHighAPI_RefAttr & thePoint1,
232 const ModelHighAPI_RefAttr & thePoint2);
236 std::shared_ptr<ModelAPI_Feature> setCollinear(
237 const ModelHighAPI_RefAttr & theLine1,
238 const ModelHighAPI_RefAttr & theLine2);
242 std::shared_ptr<ModelAPI_Feature> setDistance(
243 const ModelHighAPI_RefAttr & thePoint,
244 const ModelHighAPI_RefAttr & thePointOrLine,
245 const ModelHighAPI_Double & theValue);
249 std::shared_ptr<ModelAPI_Feature> setEqual(
250 const ModelHighAPI_RefAttr & theObject1,
251 const ModelHighAPI_RefAttr & theObject2);
255 std::shared_ptr<ModelAPI_Feature> setFillet(
256 const std::list<ModelHighAPI_RefAttr> & thePoints,
257 const ModelHighAPI_Double & theRadius);
261 std::shared_ptr<ModelAPI_Feature> setHorizontal(
262 const ModelHighAPI_RefAttr & theLine);
266 std::shared_ptr<ModelAPI_Feature> setLength(
267 const ModelHighAPI_RefAttr & theLine,
268 const ModelHighAPI_Double & theValue);
272 std::shared_ptr<ModelAPI_Feature> setMiddlePoint(
273 const ModelHighAPI_RefAttr & thePoint,
274 const ModelHighAPI_RefAttr & theLine);
278 std::shared_ptr<ModelAPI_Feature> setParallel(
279 const ModelHighAPI_RefAttr & theLine1,
280 const ModelHighAPI_RefAttr & theLine2);
282 /// Set perpendicular
284 std::shared_ptr<ModelAPI_Feature> setPerpendicular(
285 const ModelHighAPI_RefAttr & theLine1,
286 const ModelHighAPI_RefAttr & theLine2);
290 std::shared_ptr<ModelAPI_Feature> setRadius(
291 const ModelHighAPI_RefAttr & theCircleOrArc,
292 const ModelHighAPI_Double & theValue);
296 std::shared_ptr<ModelAPI_Feature> setRigid(
297 const ModelHighAPI_RefAttr & theObject);
301 std::shared_ptr<ModelAPI_Feature> setTangent(
302 const ModelHighAPI_RefAttr & theLine,
303 const ModelHighAPI_RefAttr & theCircle);
307 std::shared_ptr<ModelAPI_Feature> setVertical(
308 const ModelHighAPI_RefAttr & theLine);
310 // TODO(spo): addRectagle, projection
312 /// Set constraint value
315 const std::shared_ptr<ModelAPI_Feature> & theConstraint,
316 const ModelHighAPI_Double & theValue);
318 // TODO(spo): setText. Is it necessary as setValue accepts text expressions?
320 // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
323 std::list<ModelHighAPI_Selection> selectFace() const;
326 std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
330 //! Pointer on Sketch object
331 typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
333 /**\ingroup CPPHighAPI
334 * \brief Create Sketch feature
337 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
338 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
340 /**\ingroup CPPHighAPI
341 * \brief Create Sketch feature
344 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
345 const ModelHighAPI_Selection & theExternal);
347 /**\ingroup CPPHighAPI
348 * \brief Create Sketch feature
351 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
352 const std::string & theExternalName);
354 //--------------------------------------------------------------------------------------
355 //--------------------------------------------------------------------------------------
356 #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */