Salome HOME
[bos #20476][EDF] 22546 - sigsegv with offset. Add approximation checkbox.
[modules/shaper.git] / src / SketchAPI / SketchAPI_Sketch.h
1 // Copyright (C) 2014-2022  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_
21 #define SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_
22
23 //--------------------------------------------------------------------------------------
24 #include "SketchAPI.h"
25
26 #include <list>
27
28 #include <SketchPlugin_Sketch.h>
29 #include <SketchPlugin_SketchEntity.h>
30 #include <SketchPlugin_Offset.h>
31
32 #include <ModelHighAPI_Double.h>
33 #include <ModelHighAPI_Interface.h>
34 #include <ModelHighAPI_Macro.h>
35 #include <ModelHighAPI_Selection.h>
36 //--------------------------------------------------------------------------------------
37 class ModelAPI_CompositeFeature;
38 class ModelAPI_Object;
39 class ModelHighAPI_Integer;
40 class ModelHighAPI_RefAttr;
41 class ModelHighAPI_Reference;
42 class SketchAPI_Arc;
43 class SketchAPI_MacroArc;
44 class SketchAPI_Circle;
45 class SketchAPI_MacroCircle;
46 class SketchAPI_Ellipse;
47 class SketchAPI_MacroEllipse;
48 class SketchAPI_EllipticArc;
49 class SketchAPI_MacroEllipticArc;
50 class SketchAPI_BSpline;
51 class SketchAPI_IntersectionPoint;
52 class SketchAPI_Line;
53 class SketchAPI_Mirror;
54 class SketchAPI_Offset;
55 class SketchAPI_Point;
56 class SketchAPI_Projection;
57 class SketchAPI_Rectangle;
58 class SketchAPI_Rotation;
59 class SketchAPI_Translation;
60
61 //--------------------------------------------------------------------------------------
62 typedef std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> PointOrReference;
63 //--------------------------------------------------------------------------------------
64 /**\class SketchAPI_Sketch
65  * \ingroup CPPHighAPI
66  * \brief Interface for Sketch feature
67  */
68 class SketchAPI_Sketch : public ModelHighAPI_Interface
69 {
70 public:
71   /// Constructor without values
72   SKETCHAPI_EXPORT
73   explicit SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature);
74   /// Constructor with values
75   SKETCHAPI_EXPORT
76   SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
77                    const std::shared_ptr<GeomAPI_Ax3> & thePlane);
78   /// Constructor with values
79   SKETCHAPI_EXPORT
80   SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
81                    const ModelHighAPI_Selection & theExternal);
82   /// Constructor with values
83   SKETCHAPI_EXPORT
84   SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
85                    std::shared_ptr<ModelAPI_Object> thePlaneObject);
86   /// Destructor
87   SKETCHAPI_EXPORT
88   virtual ~SketchAPI_Sketch();
89
90   INTERFACE_7(SketchPlugin_Sketch::ID(),
91               origin, SketchPlugin_Sketch::ORIGIN_ID(),
92               GeomDataAPI_Point, /** Origin point */,
93               dirX, SketchPlugin_Sketch::DIRX_ID(),
94               GeomDataAPI_Dir, /** Direction of X */,
95               normal, SketchPlugin_Sketch::NORM_ID(),
96               GeomDataAPI_Dir, /** Normal */,
97               features, SketchPlugin_Sketch::FEATURES_ID(),
98               ModelAPI_AttributeRefList, /** Features */,
99               external, SketchPlugin_SketchEntity::EXTERNAL_ID(),
100               ModelAPI_AttributeSelection, /** External */,
101               solverError, SketchPlugin_Sketch::SOLVER_ERROR(),
102               ModelAPI_AttributeString, /** Solver error */,
103               solverDOF, SketchPlugin_Sketch::SOLVER_DOF(),
104               ModelAPI_AttributeString, /** Solver DOF */
105   )
106
107   /// Set plane
108   SKETCHAPI_EXPORT
109   void setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane);
110
111   /// Change sketch plane
112   SKETCHAPI_EXPORT
113   void setPlane(const ModelHighAPI_Selection & thePlane,
114                 bool theRemoveExternalDependency = false);
115
116   /// Set external
117   SKETCHAPI_EXPORT
118   void setExternal(const ModelHighAPI_Selection & theExternal);
119
120   /// Set external
121   SKETCHAPI_EXPORT
122   void setExternal(std::shared_ptr<ModelAPI_Object> thePlaneObject);
123
124   /// Change order of sketch results (faces)
125   SKETCHAPI_EXPORT
126   void changeFacesOrder(const std::list<std::list<ModelHighAPI_Selection> >& theFaces);
127
128   /// List points not connected by constraints with other sketch entitites
129   SKETCHAPI_EXPORT
130   std::list< std::shared_ptr<SketchAPI_Point> > getFreePoints();
131
132   /// Add point
133   SKETCHAPI_EXPORT
134   std::shared_ptr<SketchAPI_Point> addPoint(
135       double theX, double theY);
136   /// Add point
137   SKETCHAPI_EXPORT
138   std::shared_ptr<SketchAPI_Point> addPoint(
139       const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
140   /// Add point
141   SKETCHAPI_EXPORT
142   std::shared_ptr<SketchAPI_Point> addPoint(const ModelHighAPI_Selection & theExternal);
143   /// Add point
144   SKETCHAPI_EXPORT
145   std::shared_ptr<SketchAPI_Point> addPoint(const std::wstring & theExternalName);
146
147   /// Add intersection point
148   SKETCHAPI_EXPORT
149   std::shared_ptr<SketchAPI_IntersectionPoint>
150     addIntersectionPoint(const ModelHighAPI_Selection & theExternal,
151                          bool theKeepResult = false);
152   /// Add point
153   SKETCHAPI_EXPORT
154   std::shared_ptr<SketchAPI_IntersectionPoint>
155     addIntersectionPoint(const std::wstring & theExternalName,
156                          bool theKeepResult = false);
157
158   /// Add line
159   SKETCHAPI_EXPORT
160   std::shared_ptr<SketchAPI_Line> addLine(
161       double theX1, double theY1, double theX2, double theY2);
162   /// Add line
163   SKETCHAPI_EXPORT
164   std::shared_ptr<SketchAPI_Line> addLine(
165       const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
166       const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
167   /// Add line
168   SKETCHAPI_EXPORT
169   std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
170   /// Add line
171   SKETCHAPI_EXPORT
172   std::shared_ptr<SketchAPI_Line> addLine(const std::wstring & theExternalName);
173
174   /// Add rectangle
175   SKETCHAPI_EXPORT
176   std::shared_ptr<SketchAPI_Rectangle> addRectangle(
177       double theX1, double theY1, double theX2, double theY2);
178   /// Add rectangle
179   SKETCHAPI_EXPORT
180   std::shared_ptr<SketchAPI_Rectangle> addRectangle(
181       const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
182       const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
183   /// Add rectangle
184   SKETCHAPI_EXPORT
185   std::shared_ptr<SketchAPI_Rectangle> addRectangleCentered(
186       const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> & theCenter,
187       const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> & theCorner);
188
189   /// Add circle
190   SKETCHAPI_EXPORT
191   std::shared_ptr<SketchAPI_Circle> addCircle(
192       double theCenterX, double theCenterY,
193       double theRadius);
194   /// Add circle
195   SKETCHAPI_EXPORT
196   std::shared_ptr<SketchAPI_Circle> addCircle(
197       const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
198       double theRadius);
199   /// Add circle
200   SKETCHAPI_EXPORT
201   std::shared_ptr<SketchAPI_MacroCircle> addCircle(
202       double theCenterX, double theCenterY,
203       double thePassedX, double thePassedY);
204   /// Add circle
205   SKETCHAPI_EXPORT
206   std::shared_ptr<SketchAPI_MacroCircle> addCircle(
207       const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
208       const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint);
209   /// Add circle
210   SKETCHAPI_EXPORT
211   std::shared_ptr<SketchAPI_MacroCircle> addCircle(
212       double theX1, double theY1,
213       double theX2, double theY2,
214       double theX3, double theY3);
215   /// Add circle
216   SKETCHAPI_EXPORT
217   std::shared_ptr<SketchAPI_MacroCircle> addCircle(
218       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
219       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
220       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
221   /// Add circle
222   SKETCHAPI_EXPORT
223   std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
224   /// Add circle
225   SKETCHAPI_EXPORT
226   std::shared_ptr<SketchAPI_Circle> addCircle(const std::wstring & theExternalName);
227
228   /// Add arc
229   SKETCHAPI_EXPORT
230   std::shared_ptr<SketchAPI_Arc> addArc(
231       double theCenterX, double theCenterY,
232       double theStartX, double theStartY,
233       double theEndX, double theEndY,
234       bool theInversed);
235
236   /// Add arc
237   SKETCHAPI_EXPORT
238   std::shared_ptr<SketchAPI_Arc> addArc(
239       const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
240       const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
241       const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
242       bool theInversed);
243
244   /// Add arc
245   SKETCHAPI_EXPORT
246   std::shared_ptr<SketchAPI_MacroArc> addArc(
247       double theStartX, double theStartY,
248       double theEndX, double theEndY,
249       double thePassedX, double thePassedY);
250
251   /// Add arc
252   SKETCHAPI_EXPORT
253   std::shared_ptr<SketchAPI_MacroArc> addArc(
254       const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
255       const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
256       const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
257
258   /// Add transversal/tangent arc
259   SKETCHAPI_EXPORT
260   std::shared_ptr<SketchAPI_MacroArc> addArc(
261       const ModelHighAPI_RefAttr& theConnectedPoint,
262       double theEndX, double theEndY,
263       bool theInversed,
264       bool theTransversal = false);
265
266   /// Add transversal/tangent arc
267   SKETCHAPI_EXPORT
268   std::shared_ptr<SketchAPI_MacroArc> addArc(
269       const ModelHighAPI_RefAttr& theConnectedPoint,
270       const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
271       bool theInversed,
272       bool theTransversal = false);
273
274   /// Add arc
275   SKETCHAPI_EXPORT
276   std::shared_ptr<SketchAPI_Arc> addArc(const ModelHighAPI_Selection & theExternal);
277
278   /// Add arc
279   SKETCHAPI_EXPORT
280   std::shared_ptr<SketchAPI_Arc> addArc(const std::wstring & theExternalName);
281
282   /// Add ellipse
283   SKETCHAPI_EXPORT
284   std::shared_ptr<SketchAPI_Ellipse> addEllipse(
285       double theCenterX, double theCenterY,
286       double theFocusX, double theFocusY,
287       double theMinorRadius);
288   /// Add ellipse
289   SKETCHAPI_EXPORT
290   std::shared_ptr<SketchAPI_Ellipse> addEllipse(
291       const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
292       const std::shared_ptr<GeomAPI_Pnt2d>& theFocus,
293       double theRadius);
294   /// Add ellipse
295   SKETCHAPI_EXPORT
296   std::shared_ptr<SketchAPI_MacroEllipse> addEllipse(
297       double thePoint1X, double thePoint1Y,
298       double thePoint2X, double thePoint2Y,
299       double thePassedX, double thePassedY,
300       bool isPoint1Center = true);
301   /// Add ellipse
302   SKETCHAPI_EXPORT
303   std::shared_ptr<SketchAPI_MacroEllipse> addEllipse(
304       const PointOrReference& thePoint1,
305       const PointOrReference& thePoint2,
306       const PointOrReference& thePassedPoint,
307       bool isPoint1Center = true);
308   /// Add ellipse
309   SKETCHAPI_EXPORT
310   std::shared_ptr<SketchAPI_Ellipse> addEllipse(const ModelHighAPI_Selection & theExternal);
311   /// Add ellipse
312   SKETCHAPI_EXPORT
313   std::shared_ptr<SketchAPI_Ellipse> addEllipse(const std::wstring & theExternalName);
314
315   /// Add elliptic arc
316   SKETCHAPI_EXPORT
317   std::shared_ptr<SketchAPI_EllipticArc> addEllipticArc(
318       double theCenterX, double theCenterY,
319       double theFocusX, double theFocusY,
320       double theStartX, double theStartY,
321       double theEndX, double theEndY,
322       bool theInversed = false);
323   /// Add elliptic arc
324   SKETCHAPI_EXPORT
325   std::shared_ptr<SketchAPI_MacroEllipticArc> addEllipticArc(
326       const PointOrReference& theCenter,
327       const PointOrReference& theMajorAxisPoint,
328       const PointOrReference& theStartPoint,
329       const PointOrReference& theEndPoint,
330       bool theInversed = false);
331   /// Add elliptic arc
332   SKETCHAPI_EXPORT
333   std::shared_ptr<SketchAPI_EllipticArc> addEllipticArc(const ModelHighAPI_Selection & theExternal);
334   /// Add elliptic arc
335   SKETCHAPI_EXPORT
336   std::shared_ptr<SketchAPI_EllipticArc> addEllipticArc(const std::wstring & theExternalName);
337
338   /// Add B-spline
339   SKETCHAPI_EXPORT
340   std::shared_ptr<SketchAPI_BSpline> addSpline(
341       const ModelHighAPI_Selection & external = ModelHighAPI_Selection(),
342       const int degree = -1,
343       const std::list<PointOrReference>& poles = std::list<PointOrReference>(),
344       const std::list<ModelHighAPI_Double>& weights = std::list<ModelHighAPI_Double>(),
345       const std::list<ModelHighAPI_Double>& knots = std::list<ModelHighAPI_Double>(),
346       const std::list<ModelHighAPI_Integer>& multiplicities = std::list<ModelHighAPI_Integer>(),
347       const bool periodic = false);
348
349   /// Add interpolation feature
350   SKETCHAPI_EXPORT
351   std::shared_ptr<SketchAPI_BSpline> addInterpolation(
352       const std::list<ModelHighAPI_RefAttr>& points,
353       const bool periodic = false,
354       const bool closed = false);
355
356   /// Add approximation feature
357   SKETCHAPI_EXPORT
358   std::shared_ptr<SketchAPI_BSpline> addApproximation(
359       const std::list<ModelHighAPI_RefAttr>& points,
360       const ModelHighAPI_Double& precision = ModelHighAPI_Double(1.e-3),
361       const bool periodic = false,
362       const bool closed = false);
363
364   /// Add projection
365   SKETCHAPI_EXPORT
366   std::shared_ptr<SketchAPI_Projection> addProjection(
367       const ModelHighAPI_Selection & theExternalFeature,
368       bool keepResult = false,
369       bool keepRefToOriginal = true);
370
371   /// Add mirror
372   SKETCHAPI_EXPORT
373   std::shared_ptr<SketchAPI_Mirror> addMirror(
374       const ModelHighAPI_RefAttr & theMirrorLine,
375       const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects);
376
377   /// Add offset
378   SKETCHAPI_EXPORT
379     std::shared_ptr<SketchAPI_Offset> addOffset(
380       const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
381       const ModelHighAPI_Double & theValue,
382       const bool theReversed = false,
383       const std::string & theJointType = SketchPlugin_Offset::JOINT_KEEP_DISTANCE(),
384       const bool theApprox = false);
385
386   /// Add translation
387   SKETCHAPI_EXPORT
388   std::shared_ptr<SketchAPI_Translation> addTranslation(
389       const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
390       const ModelHighAPI_RefAttr & thePoint1,
391       const ModelHighAPI_RefAttr & thePoint2,
392       const ModelHighAPI_Integer & theNumberOfObjects,
393       bool theFullValue = false);
394
395   /// Add rotation
396   SKETCHAPI_EXPORT
397   std::shared_ptr<SketchAPI_Rotation> addRotation(
398       const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
399       const ModelHighAPI_RefAttr & theCenter,
400       const ModelHighAPI_Double & theAngle,
401       const ModelHighAPI_Integer & theNumberOfObjects,
402       bool theFullValue = false,
403       bool theReversed  = false);
404
405   /// Add split
406   SKETCHAPI_EXPORT
407   std::shared_ptr<ModelHighAPI_Interface> addSplit(
408       const ModelHighAPI_Reference& theFeature,
409       const std::shared_ptr<GeomAPI_Pnt2d>& thePositionPoint);
410
411   /// Add trim
412   SKETCHAPI_EXPORT
413   std::shared_ptr<ModelHighAPI_Interface> addTrim(
414       const ModelHighAPI_Reference& theFeature,
415       const std::shared_ptr<GeomAPI_Pnt2d>& thePositionPoint);
416
417   /// Set angle
418   SKETCHAPI_EXPORT
419   std::shared_ptr<ModelHighAPI_Interface> setAngle(
420       const ModelHighAPI_RefAttr & theLine1,
421       const ModelHighAPI_RefAttr & theLine2,
422       const ModelHighAPI_Double & theValue,
423       const std::string& type = std::string());
424
425   /// Set complementary angle
426   SKETCHAPI_EXPORT
427   std::shared_ptr<ModelHighAPI_Interface> setAngleComplementary(
428       const ModelHighAPI_RefAttr & theLine1,
429       const ModelHighAPI_RefAttr & theLine2,
430       const ModelHighAPI_Double & theValue);
431
432   /// Set backward angle (= 360 - angle)
433   SKETCHAPI_EXPORT
434   std::shared_ptr<ModelHighAPI_Interface> setAngleBackward(
435       const ModelHighAPI_RefAttr & theLine1,
436       const ModelHighAPI_RefAttr & theLine2,
437       const ModelHighAPI_Double & theValue);
438
439   /// Set coincident
440   SKETCHAPI_EXPORT
441   std::shared_ptr<ModelHighAPI_Interface> setCoincident(
442       const ModelHighAPI_RefAttr & thePoint1,
443       const ModelHighAPI_RefAttr & thePoint2);
444
445   /// Set collinear
446   SKETCHAPI_EXPORT
447   std::shared_ptr<ModelHighAPI_Interface> setCollinear(
448       const ModelHighAPI_RefAttr & theLine1,
449       const ModelHighAPI_RefAttr & theLine2);
450
451   /// Set distance
452   SKETCHAPI_EXPORT
453   std::shared_ptr<ModelHighAPI_Interface> setDistance(
454       const ModelHighAPI_RefAttr & thePoint,
455       const ModelHighAPI_RefAttr & thePointOrLine,
456       const ModelHighAPI_Double & theValue,
457       bool isSigned = false);
458
459   /// Set signed distance
460   SKETCHAPI_EXPORT
461   std::shared_ptr<ModelHighAPI_Interface> setSignedDistance(
462       const ModelHighAPI_RefAttr & thePoint,
463       const ModelHighAPI_RefAttr & thePointOrLine,
464       const ModelHighAPI_Double & theValue);
465
466   /// Set unsigned distance
467   SKETCHAPI_EXPORT
468   std::shared_ptr<ModelHighAPI_Interface> setUnsignedDistance(
469       const ModelHighAPI_RefAttr & thePoint,
470       const ModelHighAPI_RefAttr & thePointOrLine,
471       const ModelHighAPI_Double & theValue);
472
473   /// Set horizontal distance
474   SKETCHAPI_EXPORT
475   std::shared_ptr<ModelHighAPI_Interface> setHorizontalDistance(
476       const ModelHighAPI_RefAttr & thePoint1,
477       const ModelHighAPI_RefAttr & thePoint2,
478       const ModelHighAPI_Double & theValue);
479
480   /// Set vertical distance
481   SKETCHAPI_EXPORT
482   std::shared_ptr<ModelHighAPI_Interface> setVerticalDistance(
483       const ModelHighAPI_RefAttr & thePoint1,
484       const ModelHighAPI_RefAttr & thePoint2,
485       const ModelHighAPI_Double & theValue);
486
487   /// Set equal
488   SKETCHAPI_EXPORT
489   std::shared_ptr<ModelHighAPI_Interface> setEqual(
490       const ModelHighAPI_RefAttr & theObject1,
491       const ModelHighAPI_RefAttr & theObject2);
492
493   /// Set fillet
494   SKETCHAPI_EXPORT
495   std::shared_ptr<ModelHighAPI_Interface> setFillet(
496       const ModelHighAPI_RefAttr & thePoint);
497
498   /// Set fillet with additional radius constraint
499   SKETCHAPI_EXPORT
500   std::shared_ptr<ModelHighAPI_Interface> setFilletWithRadius(
501       const ModelHighAPI_RefAttr & thePoint,
502       const ModelHighAPI_Double & theRadius);
503
504   /// Set fixed
505   SKETCHAPI_EXPORT
506   std::shared_ptr<ModelHighAPI_Interface> setFixed(
507       const ModelHighAPI_RefAttr & theObject);
508
509   /// Set horizontal
510   SKETCHAPI_EXPORT
511   std::shared_ptr<ModelHighAPI_Interface> setHorizontal(
512       const ModelHighAPI_RefAttr & theLine);
513
514   /// Set length
515   SKETCHAPI_EXPORT
516   std::shared_ptr<ModelHighAPI_Interface> setLength(
517       const ModelHighAPI_RefAttr & theLine,
518       const ModelHighAPI_Double & theValue);
519
520   /// Set middle
521   SKETCHAPI_EXPORT
522   std::shared_ptr<ModelHighAPI_Interface> setMiddlePoint(
523       const ModelHighAPI_RefAttr & thePoint,
524       const ModelHighAPI_RefAttr & theLine);
525
526   /// Set parallel
527   SKETCHAPI_EXPORT
528   std::shared_ptr<ModelHighAPI_Interface> setParallel(
529       const ModelHighAPI_RefAttr & theLine1,
530       const ModelHighAPI_RefAttr & theLine2);
531
532   /// Set perpendicular
533   SKETCHAPI_EXPORT
534   std::shared_ptr<ModelHighAPI_Interface> setPerpendicular(
535       const ModelHighAPI_RefAttr & theLine1,
536       const ModelHighAPI_RefAttr & theLine2);
537
538   /// Set radius
539   SKETCHAPI_EXPORT
540   std::shared_ptr<ModelHighAPI_Interface> setRadius(
541       const ModelHighAPI_RefAttr & theCircleOrArc,
542       const ModelHighAPI_Double & theValue);
543
544   /// Set tangent
545   SKETCHAPI_EXPORT
546   std::shared_ptr<ModelHighAPI_Interface> setTangent(
547       const ModelHighAPI_RefAttr & theLine,
548       const ModelHighAPI_RefAttr & theCircle);
549
550   /// Set vertical
551   SKETCHAPI_EXPORT
552   std::shared_ptr<ModelHighAPI_Interface> setVertical(
553       const ModelHighAPI_RefAttr & theLine);
554
555   /// Set constraint value
556   SKETCHAPI_EXPORT
557   void setValue(
558       const std::shared_ptr<ModelHighAPI_Interface> & theConstraint,
559       const ModelHighAPI_Double & theValue);
560
561   /// Move point or sketch feature
562   SKETCHAPI_EXPORT
563   void move(const ModelHighAPI_RefAttr& theMovedEntity,
564             const std::shared_ptr<GeomAPI_Pnt2d>& theTargetPoint);
565
566   /// Move point or sketch feature
567   SKETCHAPI_EXPORT
568   void move(const ModelHighAPI_RefAttr& theMovedEntity,
569             double theTargetX, double theTargetY);
570
571   SKETCHAPI_EXPORT
572   std::shared_ptr<GeomAPI_Pnt2d> to2D(const std::shared_ptr<GeomAPI_Pnt>& thePoint);
573
574   // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
575   /// Select face
576   SKETCHAPI_EXPORT
577   std::list<ModelHighAPI_Selection> selectFace() const;
578
579   /// Dump wrapped feature
580   SKETCHAPI_EXPORT
581   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
582
583 protected:
584   std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
585
586 };
587
588 //! Pointer on Sketch object
589 typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
590
591 //--------------------------------------------------------------------------------------
592
593 /**\ingroup CPPHighAPI
594  * \brief Create Sketch feature
595  */
596 SKETCHAPI_EXPORT
597 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
598                     const std::shared_ptr<GeomAPI_Ax3> & thePlane);
599
600 /**\ingroup CPPHighAPI
601  * \brief Create Sketch feature
602  */
603 SKETCHAPI_EXPORT
604 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
605                     const ModelHighAPI_Selection & theExternal);
606
607 /**\ingroup CPPHighAPI
608  * \brief Create Sketch feature
609  */
610 SKETCHAPI_EXPORT
611 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
612                     const std::wstring & theExternalName);
613
614 /**\ingroup CPPHighAPI
615  * \brief Create Sketch feature
616  */
617 SKETCHAPI_EXPORT
618 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
619                     std::shared_ptr<ModelAPI_Object> thePlaneObject);
620
621 //--------------------------------------------------------------------------------------
622
623 /** \ingroup CPPHighAPI
624  *  \brief Copy sketch with all its sub-features
625  */
626 SKETCHAPI_EXPORT
627 SketchPtr copySketch(const std::shared_ptr<ModelAPI_Document> & thePart,
628                      const SketchPtr & theSketch);
629
630 //--------------------------------------------------------------------------------------
631 #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */