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_Projection;
34 class SketchAPI_Rectangle;
35 class SketchAPI_Rotation;
36 class SketchAPI_Translation;
37 //--------------------------------------------------------------------------------------
38 /**\class SketchAPI_Sketch
40 * \brief Interface for Sketch feature
42 class SketchAPI_Sketch : public ModelHighAPI_Interface
45 /// Constructor without values
47 explicit SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature);
48 /// Constructor with values
50 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
51 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
52 /// Constructor with values
54 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
55 const ModelHighAPI_Selection & theExternal);
58 virtual ~SketchAPI_Sketch();
60 INTERFACE_7(SketchPlugin_Sketch::ID(),
61 origin, SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point, /** Origin point */,
62 dirX, SketchPlugin_Sketch::DIRX_ID(), GeomDataAPI_Dir, /** Direction of X */,
63 normal, SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir, /** Normal */,
64 features, SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList, /** Features */,
65 external, SketchPlugin_SketchEntity::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */,
66 solverError, SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString, /** Solver error */,
67 solverDOF, SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString, /** Solver DOF */
72 void setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane);
76 void setExternal(const ModelHighAPI_Selection & theExternal);
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_Rectangle> addRectangle(
119 double theX1, double theY1, double theX2, double theY2);
122 std::shared_ptr<SketchAPI_Rectangle> addRectangle(
123 const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
124 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
128 std::shared_ptr<SketchAPI_Circle> addCircle(
129 double theCenterX, double theCenterY,
133 std::shared_ptr<SketchAPI_Circle> addCircle(
134 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
138 std::shared_ptr<SketchAPI_Circle> addCircle(
139 double theX1, double theY1,
140 double theX2, double theY2,
141 double theX3, double theY3);
144 std::shared_ptr<SketchAPI_Circle> addCircle(
145 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
146 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
147 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
150 std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
153 std::shared_ptr<SketchAPI_Circle> addCircle(const std::string & theExternalName);
157 std::shared_ptr<SketchAPI_Arc> addArc(
158 double theCenterX, double theCenterY,
159 double theStartX, double theStartY,
160 double theEndX, double theEndY,
165 std::shared_ptr<SketchAPI_Arc> addArc(
166 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
167 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
168 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
173 std::shared_ptr<SketchAPI_Arc> addArc(
174 double theStartX, double theStartY,
175 double theEndX, double theEndY,
176 double thePassedX, double thePassedY);
180 std::shared_ptr<SketchAPI_Arc> addArc(
181 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
182 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
183 const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
187 std::shared_ptr<SketchAPI_Arc> addArc(
188 const ModelHighAPI_RefAttr& theTangentPoint,
189 double theEndX, double theEndY,
194 std::shared_ptr<SketchAPI_Arc> addArc(
195 const ModelHighAPI_RefAttr& theTangentPoint,
196 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
201 std::shared_ptr<SketchAPI_Arc> addArc(const ModelHighAPI_Selection & theExternal);
205 std::shared_ptr<SketchAPI_Arc> addArc(const std::string & theExternalName);
209 std::shared_ptr<SketchAPI_Projection> addProjection(
210 const ModelHighAPI_Selection & theExternalFeature);
214 std::shared_ptr<SketchAPI_Mirror> addMirror(
215 const ModelHighAPI_RefAttr & theMirrorLine,
216 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects);
220 std::shared_ptr<SketchAPI_Translation> addTranslation(
221 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
222 const ModelHighAPI_RefAttr & thePoint1,
223 const ModelHighAPI_RefAttr & thePoint2,
224 const ModelHighAPI_Integer & theNumberOfObjects,
225 bool theFullValue = false);
229 std::shared_ptr<SketchAPI_Rotation> addRotation(
230 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
231 const ModelHighAPI_RefAttr & theCenter,
232 const ModelHighAPI_Double & theAngle,
233 const ModelHighAPI_Integer & theNumberOfObjects,
234 bool theFullValue = false);
238 std::shared_ptr<ModelAPI_Feature> setAngle(
239 const ModelHighAPI_RefAttr & theLine1,
240 const ModelHighAPI_RefAttr & theLine2,
241 const ModelHighAPI_Double & theValue);
245 std::shared_ptr<ModelAPI_Feature> setCoincident(
246 const ModelHighAPI_RefAttr & thePoint1,
247 const ModelHighAPI_RefAttr & thePoint2);
251 std::shared_ptr<ModelAPI_Feature> setCollinear(
252 const ModelHighAPI_RefAttr & theLine1,
253 const ModelHighAPI_RefAttr & theLine2);
257 std::shared_ptr<ModelAPI_Feature> setDistance(
258 const ModelHighAPI_RefAttr & thePoint,
259 const ModelHighAPI_RefAttr & thePointOrLine,
260 const ModelHighAPI_Double & theValue);
264 std::shared_ptr<ModelAPI_Feature> setEqual(
265 const ModelHighAPI_RefAttr & theObject1,
266 const ModelHighAPI_RefAttr & theObject2);
270 std::shared_ptr<ModelAPI_Feature> setFillet(
271 const std::list<ModelHighAPI_RefAttr> & thePoints,
272 const ModelHighAPI_Double & theRadius);
276 std::shared_ptr<ModelAPI_Feature> setFixed(
277 const ModelHighAPI_RefAttr & theObject);
281 std::shared_ptr<ModelAPI_Feature> setHorizontal(
282 const ModelHighAPI_RefAttr & theLine);
286 std::shared_ptr<ModelAPI_Feature> setLength(
287 const ModelHighAPI_RefAttr & theLine,
288 const ModelHighAPI_Double & theValue);
292 std::shared_ptr<ModelAPI_Feature> setMiddlePoint(
293 const ModelHighAPI_RefAttr & thePoint,
294 const ModelHighAPI_RefAttr & theLine);
298 std::shared_ptr<ModelAPI_Feature> setParallel(
299 const ModelHighAPI_RefAttr & theLine1,
300 const ModelHighAPI_RefAttr & theLine2);
302 /// Set perpendicular
304 std::shared_ptr<ModelAPI_Feature> setPerpendicular(
305 const ModelHighAPI_RefAttr & theLine1,
306 const ModelHighAPI_RefAttr & theLine2);
310 std::shared_ptr<ModelAPI_Feature> setRadius(
311 const ModelHighAPI_RefAttr & theCircleOrArc,
312 const ModelHighAPI_Double & theValue);
316 std::shared_ptr<ModelAPI_Feature> setTangent(
317 const ModelHighAPI_RefAttr & theLine,
318 const ModelHighAPI_RefAttr & theCircle);
322 std::shared_ptr<ModelAPI_Feature> setVertical(
323 const ModelHighAPI_RefAttr & theLine);
325 /// Set constraint value
328 const std::shared_ptr<ModelAPI_Feature> & theConstraint,
329 const ModelHighAPI_Double & theValue);
331 // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
334 std::list<ModelHighAPI_Selection> selectFace() const;
337 std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
341 //! Pointer on Sketch object
342 typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
344 /**\ingroup CPPHighAPI
345 * \brief Create Sketch feature
348 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
349 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
351 /**\ingroup CPPHighAPI
352 * \brief Create Sketch feature
355 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
356 const ModelHighAPI_Selection & theExternal);
358 /**\ingroup CPPHighAPI
359 * \brief Create Sketch feature
362 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
363 const std::string & theExternalName);
365 //--------------------------------------------------------------------------------------
366 //--------------------------------------------------------------------------------------
367 #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */