]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchAPI/SketchAPI_Sketch.h
Salome HOME
Porting to SALOME_8.2.0 : Debug visualization selection for AIS_Trihedron axes.
[modules/shaper.git] / src / SketchAPI / SketchAPI_Sketch.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2 // Name   : SketchAPI_Sketch.h
3 // Purpose:
4 //
5 // History:
6 // 07/06/16 - Sergey POKHODENKO - Creation of the file
7
8 #ifndef SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_
9 #define SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_
10
11 //--------------------------------------------------------------------------------------
12 #include "SketchAPI.h"
13
14 #include <list>
15
16 #include <SketchPlugin_Sketch.h>
17 #include <SketchPlugin_SketchEntity.h>
18
19 #include <ModelHighAPI_Interface.h>
20 #include <ModelHighAPI_Macro.h>
21 //--------------------------------------------------------------------------------------
22 class ModelAPI_CompositeFeature;
23 class ModelAPI_Object;
24 class ModelHighAPI_Double;
25 class ModelHighAPI_Integer;
26 class ModelHighAPI_RefAttr;
27 class ModelHighAPI_Reference;
28 class ModelHighAPI_Selection;
29 class SketchAPI_Arc;
30 class SketchAPI_Circle;
31 class SketchAPI_IntersectionPoint;
32 class SketchAPI_Line;
33 class SketchAPI_Mirror;
34 class SketchAPI_Point;
35 class SketchAPI_Projection;
36 class SketchAPI_Rectangle;
37 class SketchAPI_Rotation;
38 class SketchAPI_Translation;
39 //--------------------------------------------------------------------------------------
40 /**\class SketchAPI_Sketch
41  * \ingroup CPPHighAPI
42  * \brief Interface for Sketch feature
43  */
44 class SketchAPI_Sketch : public ModelHighAPI_Interface
45 {
46 public:
47   /// Constructor without values
48   SKETCHAPI_EXPORT
49   explicit SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature);
50   /// Constructor with values
51   SKETCHAPI_EXPORT
52   SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
53                    const std::shared_ptr<GeomAPI_Ax3> & thePlane);
54   /// Constructor with values
55   SKETCHAPI_EXPORT
56   SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
57                    const ModelHighAPI_Selection & theExternal);
58   /// Constructor with values
59   SKETCHAPI_EXPORT
60   SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
61                    std::shared_ptr<ModelAPI_Object> thePlaneObject);
62   /// Destructor
63   SKETCHAPI_EXPORT
64   virtual ~SketchAPI_Sketch();
65
66   INTERFACE_7(SketchPlugin_Sketch::ID(),
67               origin, SketchPlugin_Sketch::ORIGIN_ID(),
68               GeomDataAPI_Point, /** Origin point */,
69               dirX, SketchPlugin_Sketch::DIRX_ID(),
70               GeomDataAPI_Dir, /** Direction of X */,
71               normal, SketchPlugin_Sketch::NORM_ID(),
72               GeomDataAPI_Dir, /** Normal */,
73               features, SketchPlugin_Sketch::FEATURES_ID(),
74               ModelAPI_AttributeRefList, /** Features */,
75               external, SketchPlugin_SketchEntity::EXTERNAL_ID(),
76               ModelAPI_AttributeSelection, /** External */,
77               solverError, SketchPlugin_Sketch::SOLVER_ERROR(),
78               ModelAPI_AttributeString, /** Solver error */,
79               solverDOF, SketchPlugin_Sketch::SOLVER_DOF(),
80               ModelAPI_AttributeString, /** Solver DOF */
81   )
82
83   /// Set plane
84   SKETCHAPI_EXPORT
85   void setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane);
86
87   /// Set external
88   SKETCHAPI_EXPORT
89   void setExternal(const ModelHighAPI_Selection & theExternal);
90
91   /// Set external
92   SKETCHAPI_EXPORT
93   void setExternal(std::shared_ptr<ModelAPI_Object> thePlaneObject);
94
95   /// Add point
96   SKETCHAPI_EXPORT
97   std::shared_ptr<SketchAPI_Point> addPoint(
98       double theX, double theY);
99   /// Add point
100   SKETCHAPI_EXPORT
101   std::shared_ptr<SketchAPI_Point> addPoint(
102       const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
103   /// Add point
104   SKETCHAPI_EXPORT
105   std::shared_ptr<SketchAPI_Point> addPoint(const ModelHighAPI_Selection & theExternal);
106   /// Add point
107   SKETCHAPI_EXPORT
108   std::shared_ptr<SketchAPI_Point> addPoint(const std::string & theExternalName);
109
110   /// Add intersection point
111   SKETCHAPI_EXPORT
112   std::shared_ptr<SketchAPI_IntersectionPoint>
113     addIntersectionPoint(const ModelHighAPI_Selection & theExternal);
114   /// Add point
115   SKETCHAPI_EXPORT
116   std::shared_ptr<SketchAPI_IntersectionPoint>
117     addIntersectionPoint(const std::string & theExternalName);
118
119   /// Add line
120   SKETCHAPI_EXPORT
121   std::shared_ptr<SketchAPI_Line> addLine(
122       double theX1, double theY1, double theX2, double theY2);
123   /// Add line
124   SKETCHAPI_EXPORT
125   std::shared_ptr<SketchAPI_Line> addLine(
126       const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
127       const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
128   /// Add line
129   SKETCHAPI_EXPORT
130   std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
131   /// Add line
132   SKETCHAPI_EXPORT
133   std::shared_ptr<SketchAPI_Line> addLine(const std::string & theExternalName);
134
135   /// Add rectangle
136   SKETCHAPI_EXPORT
137   std::shared_ptr<SketchAPI_Rectangle> addRectangle(
138       double theX1, double theY1, double theX2, double theY2);
139   /// Add rectangle
140   SKETCHAPI_EXPORT
141   std::shared_ptr<SketchAPI_Rectangle> addRectangle(
142       const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
143       const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
144
145   /// Add circle
146   SKETCHAPI_EXPORT
147   std::shared_ptr<SketchAPI_Circle> addCircle(
148       double theCenterX, double theCenterY,
149       double theRadius);
150   /// Add circle
151   SKETCHAPI_EXPORT
152   std::shared_ptr<SketchAPI_Circle> addCircle(
153       const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
154       double theRadius);
155   /// Add circle
156   SKETCHAPI_EXPORT
157   std::shared_ptr<SketchAPI_Circle> addCircle(
158       double theX1, double theY1,
159       double theX2, double theY2,
160       double theX3, double theY3);
161   /// Add circle
162   SKETCHAPI_EXPORT
163   std::shared_ptr<SketchAPI_Circle> addCircle(
164       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
165       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
166       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
167   /// Add circle
168   SKETCHAPI_EXPORT
169   std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
170   /// Add circle
171   SKETCHAPI_EXPORT
172   std::shared_ptr<SketchAPI_Circle> addCircle(const std::string & theExternalName);
173
174   /// Add arc
175   SKETCHAPI_EXPORT
176   std::shared_ptr<SketchAPI_Arc> addArc(
177       double theCenterX, double theCenterY,
178       double theStartX, double theStartY,
179       double theEndX, double theEndY,
180       bool theInversed);
181
182   /// Add arc
183   SKETCHAPI_EXPORT
184   std::shared_ptr<SketchAPI_Arc> addArc(
185       const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
186       const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
187       const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
188       bool theInversed);
189
190   /// Add arc
191   SKETCHAPI_EXPORT
192   std::shared_ptr<SketchAPI_Arc> addArc(
193       double theStartX, double theStartY,
194       double theEndX, double theEndY,
195       double thePassedX, double thePassedY);
196
197   /// Add arc
198   SKETCHAPI_EXPORT
199   std::shared_ptr<SketchAPI_Arc> addArc(
200       const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
201       const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
202       const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
203
204   /// Add arc
205   SKETCHAPI_EXPORT
206   std::shared_ptr<SketchAPI_Arc> addArc(
207       const ModelHighAPI_RefAttr& theTangentPoint,
208       double theEndX, double theEndY,
209       bool theInversed);
210
211   /// Add arc
212   SKETCHAPI_EXPORT
213   std::shared_ptr<SketchAPI_Arc> addArc(
214       const ModelHighAPI_RefAttr& theTangentPoint,
215       const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
216       bool theInversed);
217
218   /// Add arc
219   SKETCHAPI_EXPORT
220   std::shared_ptr<SketchAPI_Arc> addArc(const ModelHighAPI_Selection & theExternal);
221
222   /// Add arc
223   SKETCHAPI_EXPORT
224   std::shared_ptr<SketchAPI_Arc> addArc(const std::string & theExternalName);
225
226   /// Add projection
227   SKETCHAPI_EXPORT
228   std::shared_ptr<SketchAPI_Projection> addProjection(
229       const ModelHighAPI_Selection & theExternalFeature);
230
231   /// Add projection
232   SKETCHAPI_EXPORT
233   std::shared_ptr<SketchAPI_Projection> addProjection(const std::string & theExternalName);
234
235   /// Add mirror
236   SKETCHAPI_EXPORT
237   std::shared_ptr<SketchAPI_Mirror> addMirror(
238       const ModelHighAPI_RefAttr & theMirrorLine,
239       const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects);
240
241   /// Add translation
242   SKETCHAPI_EXPORT
243   std::shared_ptr<SketchAPI_Translation> addTranslation(
244       const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
245       const ModelHighAPI_RefAttr & thePoint1,
246       const ModelHighAPI_RefAttr & thePoint2,
247       const ModelHighAPI_Integer & theNumberOfObjects,
248       bool theFullValue = false);
249
250   /// Add rotation
251   SKETCHAPI_EXPORT
252   std::shared_ptr<SketchAPI_Rotation> addRotation(
253       const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
254       const ModelHighAPI_RefAttr & theCenter,
255       const ModelHighAPI_Double & theAngle,
256       const ModelHighAPI_Integer & theNumberOfObjects,
257       bool theFullValue = false);
258
259   /// Add split
260   SKETCHAPI_EXPORT
261   std::shared_ptr<ModelHighAPI_Interface> addSplit(
262       const ModelHighAPI_Reference& theFeature,
263       const ModelHighAPI_RefAttr& thePoint1,
264       const ModelHighAPI_RefAttr& thePoint2);
265
266   /// Set angle
267   SKETCHAPI_EXPORT
268   std::shared_ptr<ModelHighAPI_Interface> setAngle(
269       const ModelHighAPI_RefAttr & theLine1,
270       const ModelHighAPI_RefAttr & theLine2,
271       const ModelHighAPI_Double & theValue);
272
273   /// Set complementary angle
274   SKETCHAPI_EXPORT
275   std::shared_ptr<ModelHighAPI_Interface> setAngleComplementary(
276       const ModelHighAPI_RefAttr & theLine1,
277       const ModelHighAPI_RefAttr & theLine2,
278       const ModelHighAPI_Double & theValue);
279
280   /// Set backward angle (= 360 - angle)
281   SKETCHAPI_EXPORT
282   std::shared_ptr<ModelHighAPI_Interface> setAngleBackward(
283       const ModelHighAPI_RefAttr & theLine1,
284       const ModelHighAPI_RefAttr & theLine2,
285       const ModelHighAPI_Double & theValue);
286
287   /// Set coincident
288   SKETCHAPI_EXPORT
289   std::shared_ptr<ModelHighAPI_Interface> setCoincident(
290       const ModelHighAPI_RefAttr & thePoint1,
291       const ModelHighAPI_RefAttr & thePoint2);
292
293   /// Set collinear
294   SKETCHAPI_EXPORT
295   std::shared_ptr<ModelHighAPI_Interface> setCollinear(
296       const ModelHighAPI_RefAttr & theLine1,
297       const ModelHighAPI_RefAttr & theLine2);
298
299   /// Set distance
300   SKETCHAPI_EXPORT
301   std::shared_ptr<ModelHighAPI_Interface> setDistance(
302       const ModelHighAPI_RefAttr & thePoint,
303       const ModelHighAPI_RefAttr & thePointOrLine,
304       const ModelHighAPI_Double & theValue);
305
306   /// Set equal
307   SKETCHAPI_EXPORT
308   std::shared_ptr<ModelHighAPI_Interface> setEqual(
309       const ModelHighAPI_RefAttr & theObject1,
310       const ModelHighAPI_RefAttr & theObject2);
311
312   /// Set fillet
313   SKETCHAPI_EXPORT
314   std::shared_ptr<ModelHighAPI_Interface> setFillet(
315       const std::list<ModelHighAPI_RefAttr> & thePoints,
316       const ModelHighAPI_Double & theRadius);
317
318   /// Set fixed
319   SKETCHAPI_EXPORT
320   std::shared_ptr<ModelHighAPI_Interface> setFixed(
321       const ModelHighAPI_RefAttr & theObject);
322
323   /// Set horizontal
324   SKETCHAPI_EXPORT
325   std::shared_ptr<ModelHighAPI_Interface> setHorizontal(
326       const ModelHighAPI_RefAttr & theLine);
327
328   /// Set length
329   SKETCHAPI_EXPORT
330   std::shared_ptr<ModelHighAPI_Interface> setLength(
331       const ModelHighAPI_RefAttr & theLine,
332       const ModelHighAPI_Double & theValue);
333
334   /// Set middle
335   SKETCHAPI_EXPORT
336   std::shared_ptr<ModelHighAPI_Interface> setMiddlePoint(
337       const ModelHighAPI_RefAttr & thePoint,
338       const ModelHighAPI_RefAttr & theLine);
339
340   /// Set parallel
341   SKETCHAPI_EXPORT
342   std::shared_ptr<ModelHighAPI_Interface> setParallel(
343       const ModelHighAPI_RefAttr & theLine1,
344       const ModelHighAPI_RefAttr & theLine2);
345
346   /// Set perpendicular
347   SKETCHAPI_EXPORT
348   std::shared_ptr<ModelHighAPI_Interface> setPerpendicular(
349       const ModelHighAPI_RefAttr & theLine1,
350       const ModelHighAPI_RefAttr & theLine2);
351
352   /// Set radius
353   SKETCHAPI_EXPORT
354   std::shared_ptr<ModelHighAPI_Interface> setRadius(
355       const ModelHighAPI_RefAttr & theCircleOrArc,
356       const ModelHighAPI_Double & theValue);
357
358   /// Set tangent
359   SKETCHAPI_EXPORT
360   std::shared_ptr<ModelHighAPI_Interface> setTangent(
361       const ModelHighAPI_RefAttr & theLine,
362       const ModelHighAPI_RefAttr & theCircle);
363
364   /// Set vertical
365   SKETCHAPI_EXPORT
366   std::shared_ptr<ModelHighAPI_Interface> setVertical(
367       const ModelHighAPI_RefAttr & theLine);
368
369   /// Set constraint value
370   SKETCHAPI_EXPORT
371   void setValue(
372       const std::shared_ptr<ModelHighAPI_Interface> & theConstraint,
373       const ModelHighAPI_Double & theValue);
374
375   // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
376   /// Select face
377   SKETCHAPI_EXPORT
378   std::list<ModelHighAPI_Selection> selectFace() const;
379
380   /// Dump wrapped feature
381   SKETCHAPI_EXPORT
382   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
383
384 protected:
385   std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
386
387 };
388
389 //! Pointer on Sketch object
390 typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
391
392 /**\ingroup CPPHighAPI
393  * \brief Create Sketch feature
394  */
395 SKETCHAPI_EXPORT
396 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
397                     const std::shared_ptr<GeomAPI_Ax3> & thePlane);
398
399 /**\ingroup CPPHighAPI
400  * \brief Create Sketch feature
401  */
402 SKETCHAPI_EXPORT
403 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
404                     const ModelHighAPI_Selection & theExternal);
405
406 /**\ingroup CPPHighAPI
407  * \brief Create Sketch feature
408  */
409 SKETCHAPI_EXPORT
410 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
411                     const std::string & theExternalName);
412
413 /**\ingroup CPPHighAPI
414  * \brief Create Sketch feature
415  */
416 SKETCHAPI_EXPORT
417 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
418                     std::shared_ptr<ModelAPI_Object> thePlaneObject);
419
420 //--------------------------------------------------------------------------------------
421 //--------------------------------------------------------------------------------------
422 #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */