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;
30 class SketchAPI_Mirror;
31 class SketchAPI_Point;
32 class SketchAPI_Rotation;
33 class SketchAPI_Translation;
34 //--------------------------------------------------------------------------------------
35 /**\class SketchAPI_Sketch
37 * \brief Interface for Sketch feature
39 class SketchAPI_Sketch : public ModelHighAPI_Interface
42 /// Constructor without values
44 explicit SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature);
45 /// Constructor with values
47 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
48 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
49 /// Constructor with values
51 SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
52 const ModelHighAPI_Selection & theExternal);
55 virtual ~SketchAPI_Sketch();
57 INTERFACE_7(SketchPlugin_Sketch::ID(),
58 origin, SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point, /** Origin point */,
59 dirX, SketchPlugin_Sketch::DIRX_ID(), GeomDataAPI_Dir, /** Direction of X */,
60 normal, SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir, /** Normal */,
61 features, SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList, /** Features */,
62 external, SketchPlugin_SketchEntity::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */,
63 solverError, SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString, /** Solver error */,
64 solverDOF, SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString, /** Solver DOF */
69 void setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane);
73 void setExternal(const ModelHighAPI_Selection & theExternal);
75 // TODO(spo): addIntersection
79 std::shared_ptr<SketchAPI_Point> addPoint(
80 double theX, double theY);
83 std::shared_ptr<SketchAPI_Point> addPoint(
84 const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
87 std::shared_ptr<SketchAPI_Point> addPoint(const ModelHighAPI_Selection & theExternal);
90 std::shared_ptr<SketchAPI_Point> addPoint(const std::string & theExternalName);
94 std::shared_ptr<SketchAPI_Line> addLine(
95 double theX1, double theY1, double theX2, double theY2);
98 std::shared_ptr<SketchAPI_Line> addLine(
99 const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
100 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
103 std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
106 std::shared_ptr<SketchAPI_Line> addLine(const std::string & theExternalName);
110 std::shared_ptr<SketchAPI_Circle> addCircle(
111 double theCenterX, double theCenterY,
115 std::shared_ptr<SketchAPI_Circle> addCircle(
116 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
120 std::shared_ptr<SketchAPI_Circle> addCircle(
121 double theX1, double theY1,
122 double theX2, double theY2,
123 double theX3, double theY3);
126 std::shared_ptr<SketchAPI_Circle> addCircle(
127 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
128 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
129 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
132 std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
135 std::shared_ptr<SketchAPI_Circle> addCircle(const std::string & theExternalName);
139 std::shared_ptr<SketchAPI_Arc> addArc(
140 double theCenterX, double theCenterY,
141 double theStartX, double theStartY,
142 double theEndX, double theEndY,
147 std::shared_ptr<SketchAPI_Arc> addArc(
148 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
149 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
150 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
155 std::shared_ptr<SketchAPI_Arc> addArc(
156 double theStartX, double theStartY,
157 double theEndX, double theEndY,
158 double thePassedX, double thePassedY);
162 std::shared_ptr<SketchAPI_Arc> addArc(
163 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
164 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
165 const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
169 std::shared_ptr<SketchAPI_Arc> addArc(
170 const ModelHighAPI_RefAttr& theTangentPoint,
171 double theEndX, double theEndY,
176 std::shared_ptr<SketchAPI_Arc> addArc(
177 const ModelHighAPI_RefAttr& theTangentPoint,
178 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
183 std::shared_ptr<SketchAPI_Arc> addArc(const ModelHighAPI_Selection & theExternal);
187 std::shared_ptr<SketchAPI_Arc> addArc(const std::string & theExternalName);
191 std::shared_ptr<SketchAPI_Mirror> addMirror(
192 const ModelHighAPI_RefAttr & theMirrorLine,
193 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects);
197 std::shared_ptr<SketchAPI_Translation> addTranslation(
198 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
199 const ModelHighAPI_RefAttr & thePoint1,
200 const ModelHighAPI_RefAttr & thePoint2,
201 const ModelHighAPI_Integer & theNumberOfObjects,
202 bool theFullValue = false);
206 std::shared_ptr<SketchAPI_Rotation> addRotation(
207 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
208 const ModelHighAPI_RefAttr & theCenter,
209 const ModelHighAPI_Double & theAngle,
210 const ModelHighAPI_Integer & theNumberOfObjects,
211 bool theFullValue = false);
215 std::shared_ptr<ModelAPI_Feature> setAngle(
216 const ModelHighAPI_RefAttr & theLine1,
217 const ModelHighAPI_RefAttr & theLine2,
218 const ModelHighAPI_Double & theValue);
222 std::shared_ptr<ModelAPI_Feature> setCoincident(
223 const ModelHighAPI_RefAttr & thePoint1,
224 const ModelHighAPI_RefAttr & thePoint2);
228 std::shared_ptr<ModelAPI_Feature> setCollinear(
229 const ModelHighAPI_RefAttr & theLine1,
230 const ModelHighAPI_RefAttr & theLine2);
234 std::shared_ptr<ModelAPI_Feature> setDistance(
235 const ModelHighAPI_RefAttr & thePoint,
236 const ModelHighAPI_RefAttr & thePointOrLine,
237 const ModelHighAPI_Double & theValue);
241 std::shared_ptr<ModelAPI_Feature> setEqual(
242 const ModelHighAPI_RefAttr & theObject1,
243 const ModelHighAPI_RefAttr & theObject2);
247 std::shared_ptr<ModelAPI_Feature> setFillet(
248 const std::list<ModelHighAPI_RefAttr> & thePoints,
249 const ModelHighAPI_Double & theRadius);
253 std::shared_ptr<ModelAPI_Feature> setHorizontal(
254 const ModelHighAPI_RefAttr & theLine);
258 std::shared_ptr<ModelAPI_Feature> setLength(
259 const ModelHighAPI_RefAttr & theLine,
260 const ModelHighAPI_Double & theValue);
264 std::shared_ptr<ModelAPI_Feature> setMiddlePoint(
265 const ModelHighAPI_RefAttr & thePoint,
266 const ModelHighAPI_RefAttr & theLine);
270 std::shared_ptr<ModelAPI_Feature> setParallel(
271 const ModelHighAPI_RefAttr & theLine1,
272 const ModelHighAPI_RefAttr & theLine2);
274 /// Set perpendicular
276 std::shared_ptr<ModelAPI_Feature> setPerpendicular(
277 const ModelHighAPI_RefAttr & theLine1,
278 const ModelHighAPI_RefAttr & theLine2);
282 std::shared_ptr<ModelAPI_Feature> setRadius(
283 const ModelHighAPI_RefAttr & theCircleOrArc,
284 const ModelHighAPI_Double & theValue);
288 std::shared_ptr<ModelAPI_Feature> setRigid(
289 const ModelHighAPI_RefAttr & theObject);
293 std::shared_ptr<ModelAPI_Feature> setTangent(
294 const ModelHighAPI_RefAttr & theLine,
295 const ModelHighAPI_RefAttr & theCircle);
299 std::shared_ptr<ModelAPI_Feature> setVertical(
300 const ModelHighAPI_RefAttr & theLine);
302 // TODO(spo): addRectagle, projection
304 /// Set constraint value
307 const std::shared_ptr<ModelAPI_Feature> & theConstraint,
308 const ModelHighAPI_Double & theValue);
310 // TODO(spo): setText. Is it necessary as setValue accepts text expressions?
312 // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
315 std::list<ModelHighAPI_Selection> selectFace() const;
318 std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
322 //! Pointer on Sketch object
323 typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
325 /**\ingroup CPPHighAPI
326 * \brief Create Sketch feature
329 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
330 const std::shared_ptr<GeomAPI_Ax3> & thePlane);
332 /**\ingroup CPPHighAPI
333 * \brief Create Sketch feature
336 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
337 const ModelHighAPI_Selection & theExternal);
339 /**\ingroup CPPHighAPI
340 * \brief Create Sketch feature
343 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
344 const std::string & theExternalName);
346 //--------------------------------------------------------------------------------------
347 //--------------------------------------------------------------------------------------
348 #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */