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> setCoincident(
187 const ModelHighAPI_RefAttr & thePoint1,
188 const ModelHighAPI_RefAttr & thePoint2);
192 std::shared_ptr<ModelAPI_Feature> setDistance(
193 const ModelHighAPI_RefAttr & thePoint,
194 const ModelHighAPI_RefAttr & theLine,
195 const ModelHighAPI_Double & theValue);
199 std::shared_ptr<ModelAPI_Feature> setFillet(
200 const std::list<ModelHighAPI_RefAttr> & thePoints,
201 const ModelHighAPI_Double & theRadius);
205 std::shared_ptr<ModelAPI_Feature> setHorizontal(
206 const ModelHighAPI_RefAttr & theLine);
210 std::shared_ptr<ModelAPI_Feature> setLength(
211 const ModelHighAPI_RefAttr & theLine,
212 const ModelHighAPI_Double & theValue);
216 std::shared_ptr<ModelAPI_Feature> setParallel(
217 const ModelHighAPI_RefAttr & theLine1,
218 const ModelHighAPI_RefAttr & theLine2);
220 /// Set perpendicular
222 std::shared_ptr<ModelAPI_Feature> setPerpendicular(
223 const ModelHighAPI_RefAttr & theLine1,
224 const ModelHighAPI_RefAttr & theLine2);
228 std::shared_ptr<ModelAPI_Feature> setRigid(
229 const ModelHighAPI_RefAttr & theObject);
233 std::shared_ptr<ModelAPI_Feature> setVertical(
234 const ModelHighAPI_RefAttr & theLine);
236 // TODO(spo): set* (constraints)
238 // TODO(spo): addMirror
240 /// Set constraint value
243 const std::shared_ptr<ModelAPI_Feature> & theConstraint,
244 const ModelHighAPI_Double & theValue);
246 // TODO(spo): setText. Is it necessary as setValue accepts text expressions?
248 // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
251 std::list<ModelHighAPI_Selection> selectFace() const;
254 std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
258 //! Pointer on Sketch object
259 typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
261 /**\ingroup CPPHighAPI
262 * \brief Create Sketch feature
265 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
266 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
268 /**\ingroup CPPHighAPI
269 * \brief Create Sketch feature
272 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
273 const ModelHighAPI_Selection & theExternal);
275 /**\ingroup CPPHighAPI
276 * \brief Create Sketch feature
279 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
280 const std::string & theExternalName);
282 //--------------------------------------------------------------------------------------
283 //--------------------------------------------------------------------------------------
284 #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */