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 //--------------------------------------------------------------------------------------
29 /**\class SketchAPI_Sketch
31 * \brief Interface for Sketch feature
33 class SketchAPI_Sketch : public ModelHighAPI_Interface
36 /// Constructor without values
38 explicit SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature);
39 /// Constructor with values
41 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
42 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
43 /// Constructor with values
45 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
46 const ModelHighAPI_Selection & theExternal);
49 virtual ~SketchAPI_Sketch();
51 INTERFACE_7(SketchPlugin_Sketch::ID(),
52 origin, SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point, /** Origin point */,
53 dirX, SketchPlugin_Sketch::DIRX_ID(), GeomDataAPI_Dir, /** Direction of X */,
54 normal, SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir, /** Normal */,
55 features, SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList, /** Features */,
56 external, SketchPlugin_SketchEntity::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */,
57 solverError, SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString, /** Solver error */,
58 solverDOF, SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString, /** Solver DOF */
63 void setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane);
67 void setExternal(const ModelHighAPI_Selection & theExternal);
69 // TODO(spo): addPoint
73 std::shared_ptr<SketchAPI_Line> addLine(
74 double theX1, double theY1, double theX2, double theY2);
77 std::shared_ptr<SketchAPI_Line> addLine(
78 const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
79 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
82 std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
85 std::shared_ptr<SketchAPI_Line> addLine(const std::string & theExternalName);
89 std::shared_ptr<SketchAPI_Circle> addCircle(
90 double theCenterX, double theCenterY,
94 std::shared_ptr<SketchAPI_Circle> addCircle(
95 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
99 std::shared_ptr<SketchAPI_Circle> addCircle(
100 double theX1, double theY1,
101 double theX2, double theY2,
102 double theX3, double theY3);
105 std::shared_ptr<SketchAPI_Circle> addCircle(
106 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
107 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
108 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
111 std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
114 std::shared_ptr<SketchAPI_Circle> addCircle(const std::string & theExternalName);
118 std::shared_ptr<SketchAPI_Arc> addArc(
119 double theCenterX, double theCenterY,
120 double theStartX, double theStartY,
121 double theEndX, double theEndY,
126 std::shared_ptr<SketchAPI_Arc> addArc(
127 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
128 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
129 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
134 std::shared_ptr<SketchAPI_Arc> addArc(
135 double theStartX, double theStartY,
136 double theEndX, double theEndY,
137 double thePassedX, double thePassedY);
141 std::shared_ptr<SketchAPI_Arc> addArc(
142 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
143 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
144 const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
148 std::shared_ptr<SketchAPI_Arc> addArc(
149 const ModelHighAPI_RefAttr& theTangentPoint,
150 double theEndX, double theEndY,
155 std::shared_ptr<SketchAPI_Arc> addArc(
156 const ModelHighAPI_RefAttr& theTangentPoint,
157 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
162 std::shared_ptr<SketchAPI_Arc> addArc(const ModelHighAPI_Selection & theExternal);
166 std::shared_ptr<SketchAPI_Arc> addArc(const std::string & theExternalName);
170 std::shared_ptr<ModelAPI_Feature> setCoincident(
171 const ModelHighAPI_RefAttr & thePoint1,
172 const ModelHighAPI_RefAttr & thePoint2);
176 std::shared_ptr<ModelAPI_Feature> setDistance(
177 const ModelHighAPI_RefAttr & thePoint,
178 const ModelHighAPI_RefAttr & theLine,
179 const ModelHighAPI_Double & theValue);
183 std::shared_ptr<ModelAPI_Feature> setFillet(
184 const std::list<ModelHighAPI_RefAttr> & thePoints,
185 const ModelHighAPI_Double & theRadius);
189 std::shared_ptr<ModelAPI_Feature> setHorizontal(
190 const ModelHighAPI_RefAttr & theLine);
194 std::shared_ptr<ModelAPI_Feature> setLength(
195 const ModelHighAPI_RefAttr & theLine,
196 const ModelHighAPI_Double & theValue);
200 std::shared_ptr<ModelAPI_Feature> setParallel(
201 const ModelHighAPI_RefAttr & theLine1,
202 const ModelHighAPI_RefAttr & theLine2);
204 /// Set perpendicular
206 std::shared_ptr<ModelAPI_Feature> setPerpendicular(
207 const ModelHighAPI_RefAttr & theLine1,
208 const ModelHighAPI_RefAttr & theLine2);
212 std::shared_ptr<ModelAPI_Feature> setRigid(
213 const ModelHighAPI_RefAttr & theObject);
217 std::shared_ptr<ModelAPI_Feature> setVertical(
218 const ModelHighAPI_RefAttr & theLine);
220 // TODO(spo): set* (constraints)
222 // TODO(spo): addMirror
224 /// Set constraint value
227 const std::shared_ptr<ModelAPI_Feature> & theConstraint,
228 const ModelHighAPI_Double & theValue);
230 // TODO(spo): setText. Is it necessary as setValue accepts text expressions?
232 // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
235 std::list<ModelHighAPI_Selection> selectFace() const;
238 std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
242 //! Pointer on Sketch object
243 typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
245 /**\ingroup CPPHighAPI
246 * \brief Create Sketch feature
249 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
250 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
252 /**\ingroup CPPHighAPI
253 * \brief Create Sketch feature
256 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
257 const ModelHighAPI_Selection & theExternal);
259 /**\ingroup CPPHighAPI
260 * \brief Create Sketch feature
263 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
264 const std::string & theExternalName);
266 //--------------------------------------------------------------------------------------
267 //--------------------------------------------------------------------------------------
268 #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */