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_Rotation;
35 class SketchAPI_Translation;
36 //--------------------------------------------------------------------------------------
37 /**\class SketchAPI_Sketch
39 * \brief Interface for Sketch feature
41 class SketchAPI_Sketch : public ModelHighAPI_Interface
44 /// Constructor without values
46 explicit SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature);
47 /// Constructor with values
49 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
50 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
51 /// Constructor with values
53 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
54 const ModelHighAPI_Selection & theExternal);
57 virtual ~SketchAPI_Sketch();
59 INTERFACE_7(SketchPlugin_Sketch::ID(),
60 origin, SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point, /** Origin point */,
61 dirX, SketchPlugin_Sketch::DIRX_ID(), GeomDataAPI_Dir, /** Direction of X */,
62 normal, SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir, /** Normal */,
63 features, SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList, /** Features */,
64 external, SketchPlugin_SketchEntity::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */,
65 solverError, SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString, /** Solver error */,
66 solverDOF, SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString, /** Solver DOF */
71 void setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane);
75 void setExternal(const ModelHighAPI_Selection & theExternal);
77 // TODO(spo): addIntersection
81 std::shared_ptr<SketchAPI_Point> addPoint(
82 double theX, double theY);
85 std::shared_ptr<SketchAPI_Point> addPoint(
86 const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
89 std::shared_ptr<SketchAPI_Point> addPoint(const ModelHighAPI_Selection & theExternal);
92 std::shared_ptr<SketchAPI_Point> addPoint(const std::string & theExternalName);
94 /// Add intersection point
96 std::shared_ptr<SketchAPI_IntersectionPoint> addIntersectionPoint(const ModelHighAPI_Selection & theExternal);
99 std::shared_ptr<SketchAPI_IntersectionPoint> addIntersectionPoint(const std::string & theExternalName);
103 std::shared_ptr<SketchAPI_Line> addLine(
104 double theX1, double theY1, double theX2, double theY2);
107 std::shared_ptr<SketchAPI_Line> addLine(
108 const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
109 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
112 std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
115 std::shared_ptr<SketchAPI_Line> addLine(const std::string & theExternalName);
119 std::shared_ptr<SketchAPI_Circle> addCircle(
120 double theCenterX, double theCenterY,
124 std::shared_ptr<SketchAPI_Circle> addCircle(
125 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
129 std::shared_ptr<SketchAPI_Circle> addCircle(
130 double theX1, double theY1,
131 double theX2, double theY2,
132 double theX3, double theY3);
135 std::shared_ptr<SketchAPI_Circle> addCircle(
136 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
137 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
138 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
141 std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
144 std::shared_ptr<SketchAPI_Circle> addCircle(const std::string & theExternalName);
148 std::shared_ptr<SketchAPI_Arc> addArc(
149 double theCenterX, double theCenterY,
150 double theStartX, double theStartY,
151 double theEndX, double theEndY,
156 std::shared_ptr<SketchAPI_Arc> addArc(
157 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
158 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
159 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
164 std::shared_ptr<SketchAPI_Arc> addArc(
165 double theStartX, double theStartY,
166 double theEndX, double theEndY,
167 double thePassedX, double thePassedY);
171 std::shared_ptr<SketchAPI_Arc> addArc(
172 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
173 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
174 const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
178 std::shared_ptr<SketchAPI_Arc> addArc(
179 const ModelHighAPI_RefAttr& theTangentPoint,
180 double theEndX, double theEndY,
185 std::shared_ptr<SketchAPI_Arc> addArc(
186 const ModelHighAPI_RefAttr& theTangentPoint,
187 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
192 std::shared_ptr<SketchAPI_Arc> addArc(const ModelHighAPI_Selection & theExternal);
196 std::shared_ptr<SketchAPI_Arc> addArc(const std::string & theExternalName);
200 std::shared_ptr<SketchAPI_Projection> addProjection(
201 const ModelHighAPI_Selection & theExternalFeature);
205 std::shared_ptr<SketchAPI_Mirror> addMirror(
206 const ModelHighAPI_RefAttr & theMirrorLine,
207 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects);
211 std::shared_ptr<SketchAPI_Translation> addTranslation(
212 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
213 const ModelHighAPI_RefAttr & thePoint1,
214 const ModelHighAPI_RefAttr & thePoint2,
215 const ModelHighAPI_Integer & theNumberOfObjects,
216 bool theFullValue = false);
220 std::shared_ptr<SketchAPI_Rotation> addRotation(
221 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
222 const ModelHighAPI_RefAttr & theCenter,
223 const ModelHighAPI_Double & theAngle,
224 const ModelHighAPI_Integer & theNumberOfObjects,
225 bool theFullValue = false);
229 std::shared_ptr<ModelAPI_Feature> setAngle(
230 const ModelHighAPI_RefAttr & theLine1,
231 const ModelHighAPI_RefAttr & theLine2,
232 const ModelHighAPI_Double & theValue);
236 std::shared_ptr<ModelAPI_Feature> setCoincident(
237 const ModelHighAPI_RefAttr & thePoint1,
238 const ModelHighAPI_RefAttr & thePoint2);
242 std::shared_ptr<ModelAPI_Feature> setCollinear(
243 const ModelHighAPI_RefAttr & theLine1,
244 const ModelHighAPI_RefAttr & theLine2);
248 std::shared_ptr<ModelAPI_Feature> setDistance(
249 const ModelHighAPI_RefAttr & thePoint,
250 const ModelHighAPI_RefAttr & thePointOrLine,
251 const ModelHighAPI_Double & theValue);
255 std::shared_ptr<ModelAPI_Feature> setEqual(
256 const ModelHighAPI_RefAttr & theObject1,
257 const ModelHighAPI_RefAttr & theObject2);
261 std::shared_ptr<ModelAPI_Feature> setFillet(
262 const std::list<ModelHighAPI_RefAttr> & thePoints,
263 const ModelHighAPI_Double & theRadius);
267 std::shared_ptr<ModelAPI_Feature> setHorizontal(
268 const ModelHighAPI_RefAttr & theLine);
272 std::shared_ptr<ModelAPI_Feature> setLength(
273 const ModelHighAPI_RefAttr & theLine,
274 const ModelHighAPI_Double & theValue);
278 std::shared_ptr<ModelAPI_Feature> setMiddlePoint(
279 const ModelHighAPI_RefAttr & thePoint,
280 const ModelHighAPI_RefAttr & theLine);
284 std::shared_ptr<ModelAPI_Feature> setParallel(
285 const ModelHighAPI_RefAttr & theLine1,
286 const ModelHighAPI_RefAttr & theLine2);
288 /// Set perpendicular
290 std::shared_ptr<ModelAPI_Feature> setPerpendicular(
291 const ModelHighAPI_RefAttr & theLine1,
292 const ModelHighAPI_RefAttr & theLine2);
296 std::shared_ptr<ModelAPI_Feature> setRadius(
297 const ModelHighAPI_RefAttr & theCircleOrArc,
298 const ModelHighAPI_Double & theValue);
302 std::shared_ptr<ModelAPI_Feature> setRigid(
303 const ModelHighAPI_RefAttr & theObject);
307 std::shared_ptr<ModelAPI_Feature> setTangent(
308 const ModelHighAPI_RefAttr & theLine,
309 const ModelHighAPI_RefAttr & theCircle);
313 std::shared_ptr<ModelAPI_Feature> setVertical(
314 const ModelHighAPI_RefAttr & theLine);
316 // TODO(spo): addRectagle, projection
318 /// Set constraint value
321 const std::shared_ptr<ModelAPI_Feature> & theConstraint,
322 const ModelHighAPI_Double & theValue);
324 // TODO(spo): setText. Is it necessary as setValue accepts text expressions?
326 // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
329 std::list<ModelHighAPI_Selection> selectFace() const;
332 std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
336 //! Pointer on Sketch object
337 typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
339 /**\ingroup CPPHighAPI
340 * \brief Create Sketch feature
343 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
344 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
346 /**\ingroup CPPHighAPI
347 * \brief Create Sketch feature
350 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
351 const ModelHighAPI_Selection & theExternal);
353 /**\ingroup CPPHighAPI
354 * \brief Create Sketch feature
357 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
358 const std::string & theExternalName);
360 //--------------------------------------------------------------------------------------
361 //--------------------------------------------------------------------------------------
362 #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */