SHAPER  9.15.0
SketchAPI_Sketch.h
1 // Copyright (C) 2014-2025 CEA, EDF
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 #include <utility>
28 
29 #include <SketchPlugin_Sketch.h>
30 #include <SketchPlugin_SketchEntity.h>
31 #include <SketchPlugin_Offset.h>
32 
33 #include <ModelHighAPI_Double.h>
34 #include <ModelHighAPI_Interface.h>
35 #include <ModelHighAPI_Macro.h>
36 #include <ModelHighAPI_Selection.h>
37 //--------------------------------------------------------------------------------------
39 class ModelAPI_Object;
43 class SketchAPI_Arc;
44 class SketchAPI_MacroArc;
45 class SketchAPI_Circle;
47 class SketchAPI_Ellipse;
51 class SketchAPI_BSpline;
53 class SketchAPI_Line;
54 class SketchAPI_Mirror;
55 class SketchAPI_Offset;
56 class SketchAPI_Point;
59 class SketchAPI_Rotation;
62 
63 //--------------------------------------------------------------------------------------
64 typedef std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> PointOrReference;
65 //--------------------------------------------------------------------------------------
71 {
72 public:
74  SKETCHAPI_EXPORT
75  explicit SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature);
77  SKETCHAPI_EXPORT
78  SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
79  const std::shared_ptr<GeomAPI_Ax3> & thePlane);
81  SKETCHAPI_EXPORT
82  SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
83  const ModelHighAPI_Selection & theExternal);
85  SKETCHAPI_EXPORT
86  SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
87  std::shared_ptr<ModelAPI_Object> thePlaneObject);
89  SKETCHAPI_EXPORT
90  virtual ~SketchAPI_Sketch();
91 
92  INTERFACE_7(SketchPlugin_Sketch::ID(),
107  )
108 
109 
110  SKETCHAPI_EXPORT
111  void setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane);
112 
114  SKETCHAPI_EXPORT
115  void setPlane(const ModelHighAPI_Selection & thePlane,
116  bool theRemoveExternalDependency = false);
117 
119  SKETCHAPI_EXPORT
120  void setExternal(const ModelHighAPI_Selection & theExternal);
121 
123  SKETCHAPI_EXPORT
124  void setExternal(std::shared_ptr<ModelAPI_Object> thePlaneObject);
125 
127  SKETCHAPI_EXPORT
128  void changeFacesOrder(const std::list<std::list<ModelHighAPI_Selection> >& theFaces);
129 
131  SKETCHAPI_EXPORT
132  std::list< std::shared_ptr<SketchAPI_Point> > getFreePoints();
133 
135  SKETCHAPI_EXPORT
136  std::shared_ptr<SketchAPI_Point> addPoint(
137  double theX, double theY);
139  SKETCHAPI_EXPORT
140  std::shared_ptr<SketchAPI_Point> addPoint(
141  const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
143  SKETCHAPI_EXPORT
144  std::shared_ptr<SketchAPI_Point> addPoint(const ModelHighAPI_Selection & theExternal);
146  SKETCHAPI_EXPORT
147  std::shared_ptr<SketchAPI_Point> addPoint(const std::wstring & theExternalName);
148 
150  SKETCHAPI_EXPORT
151  std::shared_ptr<SketchAPI_IntersectionPoint>
152  addIntersectionPoint(const ModelHighAPI_Selection & theExternal,
153  bool theKeepResult = false);
155  SKETCHAPI_EXPORT
156  std::shared_ptr<SketchAPI_IntersectionPoint>
157  addIntersectionPoint(const std::wstring & theExternalName,
158  bool theKeepResult = false);
159 
161  SKETCHAPI_EXPORT
162  std::shared_ptr<SketchAPI_Line> addLine(
163  double theX1, double theY1, double theX2, double theY2);
165  SKETCHAPI_EXPORT
166  std::shared_ptr<SketchAPI_Line> addLine(
167  const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
168  const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
170  SKETCHAPI_EXPORT
171  std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
173  SKETCHAPI_EXPORT
174  std::shared_ptr<SketchAPI_Line> addLine(const std::wstring & theExternalName);
175 
177  SKETCHAPI_EXPORT
178  std::shared_ptr<SketchAPI_Rectangle> addRectangle(
179  double theX1, double theY1, double theX2, double theY2);
181  SKETCHAPI_EXPORT
182  std::shared_ptr<SketchAPI_Rectangle> addRectangle(
183  const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> & theStartPoint,
184  const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> & theEndPoint);
186  SKETCHAPI_EXPORT
187  std::pair<std::shared_ptr<SketchAPI_Rectangle>, std::shared_ptr<SketchAPI_Point>> addRectangleCentered(
188  const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> & theCenter,
189  const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> & theCorner);
191  SKETCHAPI_EXPORT
192  std::pair<std::shared_ptr<SketchAPI_Rectangle>, std::shared_ptr<SketchAPI_Point>> addRectangleCentered(
193  double theCenterX, double theCenterY,
194  double theCornerX, double theCornerY
195  );
196 
198  SKETCHAPI_EXPORT
199  std::shared_ptr<SketchAPI_Circle> addCircle(
200  double theCenterX, double theCenterY,
201  double theRadius);
203  SKETCHAPI_EXPORT
204  std::shared_ptr<SketchAPI_Circle> addCircle(
205  const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
206  double theRadius);
208  SKETCHAPI_EXPORT
209  std::shared_ptr<SketchAPI_MacroCircle> addCircle(
210  double theCenterX, double theCenterY,
211  double thePassedX, double thePassedY);
213  SKETCHAPI_EXPORT
214  std::shared_ptr<SketchAPI_MacroCircle> addCircle(
215  const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
216  const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint);
218  SKETCHAPI_EXPORT
219  std::shared_ptr<SketchAPI_MacroCircle> addCircle(
220  double theX1, double theY1,
221  double theX2, double theY2,
222  double theX3, double theY3);
224  SKETCHAPI_EXPORT
225  std::shared_ptr<SketchAPI_MacroCircle> addCircle(
226  const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
227  const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
228  const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
230  SKETCHAPI_EXPORT
231  std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
233  SKETCHAPI_EXPORT
234  std::shared_ptr<SketchAPI_Circle> addCircle(const std::wstring & theExternalName);
235 
237  SKETCHAPI_EXPORT
238  std::shared_ptr<SketchAPI_Circle> addCircleWithPoint(
239  double theCenterX, double theCenterY,
240  double theRadius, double theAngle);
242  SKETCHAPI_EXPORT
243  std::shared_ptr<SketchAPI_Circle> addCircleWithPoint(
244  const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
245  double theRadius, double theAngle);
247  SKETCHAPI_EXPORT
248  std::shared_ptr<SketchAPI_MacroCircle> addCircleWithPoint(
249  double theCenterX, double theCenterY,
250  double thePassedX, double thePassedY,
251  double theAngle);
253  SKETCHAPI_EXPORT
254  std::shared_ptr<SketchAPI_MacroCircle> addCircleWithPoint(
255  const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
256  const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
257  double theAngle);
259  SKETCHAPI_EXPORT
260  std::shared_ptr<SketchAPI_MacroCircle> addCircleWithPoint(
261  double theX1, double theY1,
262  double theX2, double theY2,
263  double theX3, double theY3,
264  double theAngle);
266  SKETCHAPI_EXPORT
267  std::shared_ptr<SketchAPI_MacroCircle> addCircleWithPoint(
268  const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
269  const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
270  const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3,
271  double theAngle);
273  SKETCHAPI_EXPORT
274  std::shared_ptr<SketchAPI_Circle> addCircleWithPoint(const ModelHighAPI_Selection& theExternal);
276  SKETCHAPI_EXPORT
277  std::shared_ptr<SketchAPI_Circle> addCircleWithPoint(const std::wstring& theExternalName);
278 
280  SKETCHAPI_EXPORT
281  std::shared_ptr<SketchAPI_Arc> addArc(
282  double theCenterX, double theCenterY,
283  double theStartX, double theStartY,
284  double theEndX, double theEndY,
285  bool theInversed);
286 
288  SKETCHAPI_EXPORT
289  std::shared_ptr<SketchAPI_Arc> addArc(
290  const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
291  const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
292  const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
293  bool theInversed);
294 
296  SKETCHAPI_EXPORT
297  std::shared_ptr<SketchAPI_MacroArc> addArc(
298  double theStartX, double theStartY,
299  double theEndX, double theEndY,
300  double thePassedX, double thePassedY);
301 
303  SKETCHAPI_EXPORT
304  std::shared_ptr<SketchAPI_MacroArc> addArc(
305  const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
306  const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
307  const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
308 
310  SKETCHAPI_EXPORT
311  std::shared_ptr<SketchAPI_MacroArc> addArc(
312  const ModelHighAPI_RefAttr& theConnectedPoint,
313  double theEndX, double theEndY,
314  bool theInversed,
315  bool theTransversal = false);
316 
318  SKETCHAPI_EXPORT
319  std::shared_ptr<SketchAPI_MacroArc> addArc(
320  const ModelHighAPI_RefAttr& theConnectedPoint,
321  const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
322  bool theInversed,
323  bool theTransversal = false);
324 
326  SKETCHAPI_EXPORT
327  std::shared_ptr<SketchAPI_Arc> addArc(const ModelHighAPI_Selection & theExternal);
328 
330  SKETCHAPI_EXPORT
331  std::shared_ptr<SketchAPI_Arc> addArc(const std::wstring & theExternalName);
332 
334  SKETCHAPI_EXPORT
335  std::shared_ptr<SketchAPI_Ellipse> addEllipse(
336  double theCenterX, double theCenterY,
337  double theFocusX, double theFocusY,
338  double theMinorRadius);
340  SKETCHAPI_EXPORT
341  std::shared_ptr<SketchAPI_Ellipse> addEllipse(
342  const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
343  const std::shared_ptr<GeomAPI_Pnt2d>& theFocus,
344  double theRadius);
346  SKETCHAPI_EXPORT
347  std::shared_ptr<SketchAPI_MacroEllipse> addEllipse(
348  double thePoint1X, double thePoint1Y,
349  double thePoint2X, double thePoint2Y,
350  double thePassedX, double thePassedY,
351  bool isPoint1Center = true);
353  SKETCHAPI_EXPORT
354  std::shared_ptr<SketchAPI_MacroEllipse> addEllipse(
355  const PointOrReference& thePoint1,
356  const PointOrReference& thePoint2,
357  const PointOrReference& thePassedPoint,
358  bool isPoint1Center = true);
360  SKETCHAPI_EXPORT
361  std::shared_ptr<SketchAPI_Ellipse> addEllipse(const ModelHighAPI_Selection & theExternal);
363  SKETCHAPI_EXPORT
364  std::shared_ptr<SketchAPI_Ellipse> addEllipse(const std::wstring & theExternalName);
365 
367  SKETCHAPI_EXPORT
368  std::shared_ptr<SketchAPI_EllipticArc> addEllipticArc(
369  double theCenterX, double theCenterY,
370  double theFocusX, double theFocusY,
371  double theStartX, double theStartY,
372  double theEndX, double theEndY,
373  bool theInversed = false);
375  SKETCHAPI_EXPORT
377  const PointOrReference& theCenter,
378  const PointOrReference& theMajorAxisPoint,
379  const PointOrReference& theStartPoint,
380  const PointOrReference& theEndPoint,
381  bool theInversed = false);
383  SKETCHAPI_EXPORT
384  std::shared_ptr<SketchAPI_EllipticArc> addEllipticArc(const ModelHighAPI_Selection & theExternal);
386  SKETCHAPI_EXPORT
387  std::shared_ptr<SketchAPI_EllipticArc> addEllipticArc(const std::wstring & theExternalName);
388 
390  SKETCHAPI_EXPORT
391  std::shared_ptr<SketchAPI_BSpline> addSpline(
393  const int degree = -1,
394  const std::list<PointOrReference>& poles = std::list<PointOrReference>(),
395  const std::list<ModelHighAPI_Double>& weights = std::list<ModelHighAPI_Double>(),
396  const std::list<ModelHighAPI_Double>& knots = std::list<ModelHighAPI_Double>(),
397  const std::list<ModelHighAPI_Integer>& multiplicities = std::list<ModelHighAPI_Integer>(),
398  const bool periodic = false);
399 
401  SKETCHAPI_EXPORT
402  std::shared_ptr<SketchAPI_BSpline> addInterpolation(
403  const std::list<ModelHighAPI_RefAttr>& points,
404  const bool periodic = false,
405  const bool closed = false);
406 
408  SKETCHAPI_EXPORT
409  std::shared_ptr<SketchAPI_BSpline> addApproximation(
410  const std::list<ModelHighAPI_RefAttr>& points,
411  const ModelHighAPI_Double& precision = ModelHighAPI_Double(1.e-3),
412  const bool periodic = false,
413  const bool closed = false);
414 
416  SKETCHAPI_EXPORT
417  std::shared_ptr<SketchAPI_Projection> addProjection(
418  const ModelHighAPI_Selection & theExternalFeature,
419  bool keepResult = false,
420  bool keepRefToOriginal = true);
421 
423  SKETCHAPI_EXPORT
424  std::shared_ptr<SketchAPI_Mirror> addMirror(
425  const ModelHighAPI_RefAttr & theMirrorLine,
426  const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects);
427 
429  SKETCHAPI_EXPORT
430  std::shared_ptr<SketchAPI_Offset> addOffset(
431  const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
432  const ModelHighAPI_Double & theValue,
433  const bool theReversed = false,
434  const std::string & theJointType = SketchPlugin_Offset::JOINT_KEEP_DISTANCE(),
435  const bool theApprox = false);
436 
438  SKETCHAPI_EXPORT
439  std::shared_ptr<SketchAPI_Translation> addTranslation(
440  const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
441  const ModelHighAPI_RefAttr & thePoint1,
442  const ModelHighAPI_RefAttr & thePoint2,
443  const ModelHighAPI_Integer & theNumberOfObjects,
444  bool theFullValue = false);
445 
447  SKETCHAPI_EXPORT
448  std::shared_ptr<SketchAPI_Rotation> addRotation(
449  const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
450  const ModelHighAPI_RefAttr & theCenter,
451  const ModelHighAPI_Double & theAngle,
452  const ModelHighAPI_Integer & theNumberOfObjects,
453  bool theFullValue = false,
454  bool theReversed = false);
455 
457  SKETCHAPI_EXPORT
458  std::shared_ptr<ModelHighAPI_Interface> addSplit(
459  const ModelHighAPI_Reference& theFeature,
460  const std::shared_ptr<GeomAPI_Pnt2d>& thePositionPoint);
461 
463  SKETCHAPI_EXPORT
464  std::shared_ptr<ModelHighAPI_Interface> addTrim(
465  const ModelHighAPI_Reference& theFeature,
466  const std::shared_ptr<GeomAPI_Pnt2d>& thePositionPoint);
467 
469  SKETCHAPI_EXPORT
470  std::shared_ptr<ModelHighAPI_Interface> setAngle(
471  const ModelHighAPI_RefAttr & theLine1,
472  const ModelHighAPI_RefAttr & theLine2,
473  const ModelHighAPI_Double & theValue,
474  const std::string& type = std::string(),
475  bool is_active = true);
476 
478  SKETCHAPI_EXPORT
480  const ModelHighAPI_RefAttr & theLine1,
481  const ModelHighAPI_RefAttr & theLine2,
482  const ModelHighAPI_Double & theValue,
483  bool is_active = true);
484 
486  SKETCHAPI_EXPORT
487  std::shared_ptr<ModelHighAPI_Interface> setAngleBackward(
488  const ModelHighAPI_RefAttr & theLine1,
489  const ModelHighAPI_RefAttr & theLine2,
490  const ModelHighAPI_Double & theValue,
491  bool is_active = true);
492 
494  SKETCHAPI_EXPORT
495  std::shared_ptr<ModelHighAPI_Interface> setCoincident(
496  const ModelHighAPI_RefAttr & thePoint1,
497  const ModelHighAPI_RefAttr & thePoint2,
498  bool is_active = true);
499 
501  SKETCHAPI_EXPORT
502  std::shared_ptr<ModelHighAPI_Interface> setCollinear(
503  const ModelHighAPI_RefAttr & theLine1,
504  const ModelHighAPI_RefAttr & theLine2,
505  bool is_active = true);
506 
508  SKETCHAPI_EXPORT
509  std::shared_ptr<ModelHighAPI_Interface> setDistance(
510  const ModelHighAPI_RefAttr & thePoint,
511  const ModelHighAPI_RefAttr & thePointOrLine,
512  const ModelHighAPI_Double & theValue,
513  bool isSigned = false,
514  bool is_active = true);
515 
517  SKETCHAPI_EXPORT
518  std::shared_ptr<ModelHighAPI_Interface> setSignedDistance(
519  const ModelHighAPI_RefAttr & thePoint,
520  const ModelHighAPI_RefAttr & thePointOrLine,
521  const ModelHighAPI_Double & theValue,
522  bool is_active = true);
523 
525  SKETCHAPI_EXPORT
527  const ModelHighAPI_RefAttr & thePoint,
528  const ModelHighAPI_RefAttr & thePointOrLine,
529  const ModelHighAPI_Double & theValue,
530  bool is_active = true);
531 
533  SKETCHAPI_EXPORT
535  const ModelHighAPI_RefAttr & thePoint1,
536  const ModelHighAPI_RefAttr & thePoint2,
537  const ModelHighAPI_Double & theValue,
538  bool is_active = true);
539 
541  SKETCHAPI_EXPORT
543  const ModelHighAPI_RefAttr & thePoint1,
544  const ModelHighAPI_RefAttr & thePoint2,
545  const ModelHighAPI_Double & theValue,
546  bool is_active = true);
547 
549  SKETCHAPI_EXPORT
550  std::shared_ptr<ModelHighAPI_Interface> setEqual(
551  const ModelHighAPI_RefAttr & theObject1,
552  const ModelHighAPI_RefAttr & theObject2,
553  bool is_active = true);
554 
556  SKETCHAPI_EXPORT
557  std::shared_ptr<ModelHighAPI_Interface> setFillet(
558  const ModelHighAPI_RefAttr & thePoint);
559 
561  SKETCHAPI_EXPORT
563  const ModelHighAPI_RefAttr & thePoint,
564  const ModelHighAPI_Double & theRadius);
565 
567  SKETCHAPI_EXPORT
568  std::shared_ptr<ModelHighAPI_Interface> setFixed(
569  const ModelHighAPI_RefAttr & theObject,
570  bool is_active = true);
571 
573  SKETCHAPI_EXPORT
574  std::shared_ptr<ModelHighAPI_Interface> setHorizontal(
575  const ModelHighAPI_RefAttr & theLine,
576  bool is_active = true);
577 
579  SKETCHAPI_EXPORT
580  std::shared_ptr<ModelHighAPI_Interface> setLength(
581  const ModelHighAPI_RefAttr & theLine,
582  const ModelHighAPI_Double & theValue,
583  bool is_active = true);
584 
586  SKETCHAPI_EXPORT
587  std::shared_ptr<ModelHighAPI_Interface> setMiddlePoint(
588  const ModelHighAPI_RefAttr & thePoint,
589  const ModelHighAPI_RefAttr & theLine,
590  bool is_active = true);
591 
593  SKETCHAPI_EXPORT
595  const ModelHighAPI_RefAttr& theLine,
596  bool is_active = true);
597 
599  SKETCHAPI_EXPORT
600  std::shared_ptr<ModelHighAPI_Interface> setParallel(
601  const ModelHighAPI_RefAttr & theLine1,
602  const ModelHighAPI_RefAttr & theLine2,
603  bool is_active = true);
604 
606  SKETCHAPI_EXPORT
607  std::shared_ptr<ModelHighAPI_Interface> setPerpendicular(
608  const ModelHighAPI_RefAttr & theLine1,
609  const ModelHighAPI_RefAttr & theLine2,
610  bool is_active = true);
611 
613  SKETCHAPI_EXPORT
614  std::shared_ptr<ModelHighAPI_Interface> setRadius(
615  const ModelHighAPI_RefAttr & theCircleOrArc,
616  const ModelHighAPI_Double & theValue,
617  bool is_active = true);
618 
620  SKETCHAPI_EXPORT
621  std::shared_ptr<ModelHighAPI_Interface> setTangent(
622  const ModelHighAPI_RefAttr & theLine,
623  const ModelHighAPI_RefAttr & theCircle,
624  bool is_active = true);
625 
627  SKETCHAPI_EXPORT
628  std::shared_ptr<ModelHighAPI_Interface> setVertical(
629  const ModelHighAPI_RefAttr & theLine,
630  bool is_active = true);
631 
633  SKETCHAPI_EXPORT
634  void setValue(
635  const std::shared_ptr<ModelHighAPI_Interface> & theConstraint,
636  const ModelHighAPI_Double & theValue);
637 
639  SKETCHAPI_EXPORT
640  void move(const ModelHighAPI_RefAttr& theMovedEntity,
641  const std::shared_ptr<GeomAPI_Pnt2d>& theTargetPoint);
642 
644  SKETCHAPI_EXPORT
645  void move(const ModelHighAPI_RefAttr& theMovedEntity,
646  double theTargetX, double theTargetY);
647 
648  SKETCHAPI_EXPORT
649  std::shared_ptr<GeomAPI_Pnt2d> to2D(const std::shared_ptr<GeomAPI_Pnt>& thePoint);
650 
651  // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
653  SKETCHAPI_EXPORT
654  std::list<ModelHighAPI_Selection> selectFace() const;
655 
657  SKETCHAPI_EXPORT
658  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
659 
660 protected:
661  std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
662 
663 };
664 
666 typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
667 
668 //--------------------------------------------------------------------------------------
669 
673 SKETCHAPI_EXPORT
674 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
675  const std::shared_ptr<GeomAPI_Ax3> & thePlane);
676 
680 SKETCHAPI_EXPORT
681 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
682  const ModelHighAPI_Selection & theExternal);
683 
687 SKETCHAPI_EXPORT
688 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
689  const std::wstring & theExternalName);
690 
694 SKETCHAPI_EXPORT
695 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
696  std::shared_ptr<ModelAPI_Object> thePlaneObject);
697 
698 //--------------------------------------------------------------------------------------
699 
703 SKETCHAPI_EXPORT
704 SketchPtr copySketch(const std::shared_ptr<ModelAPI_Document> & thePart,
705  const SketchPtr & theSketch);
706 
707 //--------------------------------------------------------------------------------------
708 #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */
The class represents a coordinate plane which is 2d plane with X and Y directions and origin.
Definition: GeomAPI_Ax3.h:33
2D point defined by two coordinates
Definition: GeomAPI_Pnt2d.h:36
3D point defined by three coordinates
Definition: GeomAPI_Pnt.h:38
Attribute that contains 3D direction coordinates.
Definition: GeomDataAPI_Dir.h:35
Attribute that contains 3D point coordinates.
Definition: GeomDataAPI_Point.h:36
Attribute that contains list of references to features (located in the same document).
Definition: ModelAPI_AttributeRefList.h:33
Attribute that contains reference to the sub-shape of some result, the selected shape.
Definition: ModelAPI_AttributeSelection.h:35
API for the attribute that contains std (null terminated) string.
Definition: ModelAPI_AttributeString.h:33
Feature that consists of other features: like sketcher with edges inside.
Definition: ModelAPI_CompositeFeature.h:33
Document for internal data structure of any object storage.
Definition: ModelAPI_Document.h:53
Represents any object in the data model and in the object browser.
Definition: ModelAPI_Object.h:45
Class for filling ModelAPI_AttributeDouble.
Definition: ModelHighAPI_Double.h:37
Dump engine for the model.
Definition: ModelHighAPI_Dumper.h:81
Class for filling ModelAPI_AttributeInteger.
Definition: ModelHighAPI_Integer.h:36
Base class for feature interfaces.
Definition: ModelHighAPI_Interface.h:46
Class for filling ModelAPI_AttributeRefAttr.
Definition: ModelHighAPI_RefAttr.h:41
Class for filling ModelAPI_AttributeReference.
Definition: ModelHighAPI_Reference.h:41
Class for filling ModelAPI_AttributeSelection.
Definition: ModelHighAPI_Selection.h:49
Interface for Arc feature.
Definition: SketchAPI_Arc.h:37
Interface for BSpline feature.
Definition: SketchAPI_BSpline.h:42
Interface for Circle feature.
Definition: SketchAPI_Circle.h:34
Interface for Ellipse feature.
Definition: SketchAPI_Ellipse.h:36
Interface for Elliptic Arc feature.
Definition: SketchAPI_EllipticArc.h:34
Interface for IntersectionPoint feature.
Definition: SketchAPI_IntersectionPoint.h:37
Interface for Line feature.
Definition: SketchAPI_Line.h:39
Interface for Arc feature.
Definition: SketchAPI_MacroArc.h:37
Interface for Circle feature.
Definition: SketchAPI_MacroCircle.h:34
Interface for Ellipse feature.
Definition: SketchAPI_MacroEllipse.h:36
Interface for Elliptic Arc feature.
Definition: SketchAPI_MacroEllipticArc.h:32
Interface for Middle Point feature.
Definition: SketchAPI_MacroMiddlePoint.h:35
Interface for Mirror feature.
Definition: SketchAPI_Mirror.h:42
Interface for Offset feature.
Definition: SketchAPI_Offset.h:43
Interface for Point feature.
Definition: SketchAPI_Point.h:39
Interface for Projection feature.
Definition: SketchAPI_Projection.h:37
Interface for Rectangle feature.
Definition: SketchAPI_Rectangle.h:37
Interface for Rotation feature.
Definition: SketchAPI_Rotation.h:44
Interface for Sketch feature.
Definition: SketchAPI_Sketch.h:71
std::shared_ptr< ModelHighAPI_Interface > setAngleBackward(const ModelHighAPI_RefAttr &theLine1, const ModelHighAPI_RefAttr &theLine2, const ModelHighAPI_Double &theValue, bool is_active=true)
Set backward angle (= 360 - angle)
Definition: SketchAPI_Sketch.cpp:1304
std::shared_ptr< ModelHighAPI_Interface > setTangent(const ModelHighAPI_RefAttr &theLine, const ModelHighAPI_RefAttr &theCircle, bool is_active=true)
Set tangent.
Definition: SketchAPI_Sketch.cpp:1576
std::shared_ptr< ModelHighAPI_Interface > setPerpendicular(const ModelHighAPI_RefAttr &theLine1, const ModelHighAPI_RefAttr &theLine2, bool is_active=true)
Set perpendicular.
Definition: SketchAPI_Sketch.cpp:1548
std::shared_ptr< SketchAPI_Line > addLine(double theX1, double theY1, double theX2, double theY2)
Add line.
Definition: SketchAPI_Sketch.cpp:503
std::shared_ptr< ModelHighAPI_Interface > setCoincident(const ModelHighAPI_RefAttr &thePoint1, const ModelHighAPI_RefAttr &thePoint2, bool is_active=true)
Set coincident.
Definition: SketchAPI_Sketch.cpp:1324
SketchAPI_Sketch(const std::shared_ptr< ModelAPI_Feature > &theFeature)
Constructor without values.
Definition: SketchAPI_Sketch.cpp:209
std::shared_ptr< ModelHighAPI_Interface > setSignedDistance(const ModelHighAPI_RefAttr &thePoint, const ModelHighAPI_RefAttr &thePointOrLine, const ModelHighAPI_Double &theValue, bool is_active=true)
Set signed distance.
Definition: SketchAPI_Sketch.cpp:1370
std::shared_ptr< ModelHighAPI_Interface > setEqual(const ModelHighAPI_RefAttr &theObject1, const ModelHighAPI_RefAttr &theObject2, bool is_active=true)
Set equal.
Definition: SketchAPI_Sketch.cpp:1422
virtual std::shared_ptr< ModelAPI_AttributeSelection > external() const
External.
Definition: SketchAPI_Sketch.h:107
std::shared_ptr< SketchAPI_Circle > addCircle(double theCenterX, double theCenterY, double theRadius)
Add circle.
Definition: SketchAPI_Sketch.cpp:622
std::list< std::shared_ptr< SketchAPI_Point > > getFreePoints()
List points not connected by constraints with other sketch entities.
Definition: SketchAPI_Sketch.cpp:380
std::shared_ptr< ModelHighAPI_Interface > setDistance(const ModelHighAPI_RefAttr &thePoint, const ModelHighAPI_RefAttr &thePointOrLine, const ModelHighAPI_Double &theValue, bool isSigned=false, bool is_active=true)
Set distance.
Definition: SketchAPI_Sketch.cpp:1352
void setValue(const std::shared_ptr< ModelHighAPI_Interface > &theConstraint, const ModelHighAPI_Double &theValue)
Set constraint value.
Definition: SketchAPI_Sketch.cpp:301
virtual std::shared_ptr< GeomDataAPI_Point > origin() const
Origin point.
Definition: SketchAPI_Sketch.h:107
std::shared_ptr< SketchAPI_Point > addPoint(double theX, double theY)
Add point.
Definition: SketchAPI_Sketch.cpp:452
std::shared_ptr< ModelHighAPI_Interface > setVertical(const ModelHighAPI_RefAttr &theLine, bool is_active=true)
Set vertical.
Definition: SketchAPI_Sketch.cpp:1590
std::pair< std::shared_ptr< SketchAPI_Rectangle >, std::shared_ptr< SketchAPI_Point > > addRectangleCentered(const std::pair< std::shared_ptr< GeomAPI_Pnt2d >, ModelHighAPI_RefAttr > &theCenter, const std::pair< std::shared_ptr< GeomAPI_Pnt2d >, ModelHighAPI_RefAttr > &theCorner)
Add rectangle.
Definition: SketchAPI_Sketch.cpp:586
std::shared_ptr< ModelHighAPI_Interface > setAngle(const ModelHighAPI_RefAttr &theLine1, const ModelHighAPI_RefAttr &theLine2, const ModelHighAPI_Double &theValue, const std::string &type=std::string(), bool is_active=true)
Set angle.
Definition: SketchAPI_Sketch.cpp:1242
virtual void dump(ModelHighAPI_Dumper &theDumper) const
Dump wrapped feature.
Definition: SketchAPI_Sketch.cpp:1742
std::shared_ptr< SketchAPI_BSpline > addSpline(const ModelHighAPI_Selection &external=ModelHighAPI_Selection(), const int degree=-1, const std::list< PointOrReference > &poles=std::list< PointOrReference >(), const std::list< ModelHighAPI_Double > &weights=std::list< ModelHighAPI_Double >(), const std::list< ModelHighAPI_Double > &knots=std::list< ModelHighAPI_Double >(), const std::list< ModelHighAPI_Integer > &multiplicities=std::list< ModelHighAPI_Integer >(), const bool periodic=false)
Add B-spline.
Definition: SketchAPI_Sketch.cpp:1001
std::shared_ptr< SketchAPI_Ellipse > addEllipse(double theCenterX, double theCenterY, double theFocusX, double theFocusY, double theMinorRadius)
Add ellipse.
Definition: SketchAPI_Sketch.cpp:874
std::shared_ptr< SketchAPI_Offset > addOffset(const std::list< std::shared_ptr< ModelAPI_Object > > &theObjects, const ModelHighAPI_Double &theValue, const bool theReversed=false, const std::string &theJointType=SketchPlugin_Offset::JOINT_KEEP_DISTANCE(), const bool theApprox=false)
Add offset.
Definition: SketchAPI_Sketch.cpp:1163
std::shared_ptr< ModelHighAPI_Interface > setUnsignedDistance(const ModelHighAPI_RefAttr &thePoint, const ModelHighAPI_RefAttr &thePointOrLine, const ModelHighAPI_Double &theValue, bool is_active=true)
Set unsigned distance.
Definition: SketchAPI_Sketch.cpp:1379
std::shared_ptr< ModelHighAPI_Interface > setLength(const ModelHighAPI_RefAttr &theLine, const ModelHighAPI_Double &theValue, bool is_active=true)
Set length.
Definition: SketchAPI_Sketch.cpp:1488
std::shared_ptr< SketchAPI_Circle > addCircleWithPoint(double theCenterX, double theCenterY, double theRadius, double theAngle)
Add circle with point.
Definition: SketchAPI_Sketch.cpp:699
virtual std::shared_ptr< ModelAPI_AttributeString > solverDOF() const
Solver DOF.
Definition: SketchAPI_Sketch.h:107
virtual std::shared_ptr< ModelAPI_AttributeRefList > features() const
Features.
Definition: SketchAPI_Sketch.h:107
std::shared_ptr< SketchAPI_BSpline > addApproximation(const std::list< ModelHighAPI_RefAttr > &points, const ModelHighAPI_Double &precision=ModelHighAPI_Double(1.e-3), const bool periodic=false, const bool closed=false)
Add approximation feature.
Definition: SketchAPI_Sketch.cpp:1123
std::shared_ptr< SketchAPI_IntersectionPoint > addIntersectionPoint(const ModelHighAPI_Selection &theExternal, bool theKeepResult=false)
Add intersection point.
Definition: SketchAPI_Sketch.cpp:481
std::shared_ptr< ModelHighAPI_Interface > setVerticalDistance(const ModelHighAPI_RefAttr &thePoint1, const ModelHighAPI_RefAttr &thePoint2, const ModelHighAPI_Double &theValue, bool is_active=true)
Set vertical distance.
Definition: SketchAPI_Sketch.cpp:1405
virtual ~SketchAPI_Sketch()
Destructor.
Definition: SketchAPI_Sketch.cpp:246
std::shared_ptr< ModelHighAPI_Interface > setParallel(const ModelHighAPI_RefAttr &theLine1, const ModelHighAPI_RefAttr &theLine2, bool is_active=true)
Set parallel.
Definition: SketchAPI_Sketch.cpp:1534
std::shared_ptr< SketchAPI_EllipticArc > addEllipticArc(double theCenterX, double theCenterY, double theFocusX, double theFocusY, double theStartX, double theStartY, double theEndX, double theEndY, bool theInversed=false)
Add elliptic arc.
Definition: SketchAPI_Sketch.cpp:949
std::list< ModelHighAPI_Selection > selectFace() const
Select face.
Definition: SketchAPI_Sketch.cpp:311
virtual std::shared_ptr< GeomDataAPI_Dir > normal() const
Normal.
Definition: SketchAPI_Sketch.h:107
virtual std::shared_ptr< ModelAPI_AttributeString > solverError() const
Solver error.
Definition: SketchAPI_Sketch.h:107
std::shared_ptr< ModelHighAPI_Interface > setHorizontalDistance(const ModelHighAPI_RefAttr &thePoint1, const ModelHighAPI_RefAttr &thePoint2, const ModelHighAPI_Double &theValue, bool is_active=true)
Set horizontal distance.
Definition: SketchAPI_Sketch.cpp:1388
std::shared_ptr< SketchAPI_Rotation > addRotation(const std::list< std::shared_ptr< ModelAPI_Object > > &theObjects, const ModelHighAPI_RefAttr &theCenter, const ModelHighAPI_Double &theAngle, const ModelHighAPI_Integer &theNumberOfObjects, bool theFullValue=false, bool theReversed=false)
Add rotation.
Definition: SketchAPI_Sketch.cpp:1190
std::shared_ptr< ModelHighAPI_Interface > setFixed(const ModelHighAPI_RefAttr &theObject, bool is_active=true)
Set fixed.
Definition: SketchAPI_Sketch.cpp:1464
std::shared_ptr< ModelHighAPI_Interface > setMiddlePoint(const ModelHighAPI_RefAttr &thePoint, const ModelHighAPI_RefAttr &theLine, bool is_active=true)
Set middle.
Definition: SketchAPI_Sketch.cpp:1502
std::shared_ptr< SketchAPI_Translation > addTranslation(const std::list< std::shared_ptr< ModelAPI_Object > > &theObjects, const ModelHighAPI_RefAttr &thePoint1, const ModelHighAPI_RefAttr &thePoint2, const ModelHighAPI_Integer &theNumberOfObjects, bool theFullValue=false)
Add translation.
Definition: SketchAPI_Sketch.cpp:1176
std::shared_ptr< ModelHighAPI_Interface > setFilletWithRadius(const ModelHighAPI_RefAttr &thePoint, const ModelHighAPI_Double &theRadius)
Set fillet with additional radius constraint.
Definition: SketchAPI_Sketch.cpp:1446
void setExternal(const ModelHighAPI_Selection &theExternal)
Set external.
Definition: SketchAPI_Sketch.cpp:286
std::shared_ptr< ModelHighAPI_Interface > setRadius(const ModelHighAPI_RefAttr &theCircleOrArc, const ModelHighAPI_Double &theValue, bool is_active=true)
Set radius.
Definition: SketchAPI_Sketch.cpp:1562
virtual std::shared_ptr< GeomDataAPI_Dir > dirX() const
Direction of X.
Definition: SketchAPI_Sketch.h:107
std::shared_ptr< SketchAPI_Projection > addProjection(const ModelHighAPI_Selection &theExternalFeature, bool keepResult=false, bool keepRefToOriginal=true)
Add projection.
Definition: SketchAPI_Sketch.cpp:1138
std::shared_ptr< SketchAPI_Mirror > addMirror(const ModelHighAPI_RefAttr &theMirrorLine, const std::list< std::shared_ptr< ModelAPI_Object > > &theObjects)
Add mirror.
Definition: SketchAPI_Sketch.cpp:1153
std::shared_ptr< ModelHighAPI_Interface > setFillet(const ModelHighAPI_RefAttr &thePoint)
Set fillet.
Definition: SketchAPI_Sketch.cpp:1436
void move(const ModelHighAPI_RefAttr &theMovedEntity, const std::shared_ptr< GeomAPI_Pnt2d > &theTargetPoint)
Move point or sketch feature.
Definition: SketchAPI_Sketch.cpp:1604
std::shared_ptr< ModelHighAPI_Interface > setAngleComplementary(const ModelHighAPI_RefAttr &theLine1, const ModelHighAPI_RefAttr &theLine2, const ModelHighAPI_Double &theValue, bool is_active=true)
Set complementary angle.
Definition: SketchAPI_Sketch.cpp:1284
std::shared_ptr< SketchAPI_Arc > addArc(double theCenterX, double theCenterY, double theStartX, double theStartY, double theEndX, double theEndY, bool theInversed)
Add arc.
Definition: SketchAPI_Sketch.cpp:780
void changeFacesOrder(const std::list< std::list< ModelHighAPI_Selection > > &theFaces)
Change order of sketch results (faces)
Definition: SketchAPI_Sketch.cpp:401
std::shared_ptr< SketchAPI_Rectangle > addRectangle(double theX1, double theY1, double theX2, double theY2)
Add rectangle.
Definition: SketchAPI_Sketch.cpp:533
std::shared_ptr< ModelHighAPI_Interface > addTrim(const ModelHighAPI_Reference &theFeature, const std::shared_ptr< GeomAPI_Pnt2d > &thePositionPoint)
Add trim.
Definition: SketchAPI_Sketch.cpp:1224
void setPlane(const std::shared_ptr< GeomAPI_Ax3 > &thePlane)
Set plane.
Definition: SketchAPI_Sketch.cpp:258
std::shared_ptr< SketchAPI_BSpline > addInterpolation(const std::list< ModelHighAPI_RefAttr > &points, const bool periodic=false, const bool closed=false)
Add interpolation feature.
Definition: SketchAPI_Sketch.cpp:1111
std::shared_ptr< ModelHighAPI_Interface > setHorizontal(const ModelHighAPI_RefAttr &theLine, bool is_active=true)
Set horizontal.
Definition: SketchAPI_Sketch.cpp:1476
std::shared_ptr< ModelHighAPI_Interface > setCollinear(const ModelHighAPI_RefAttr &theLine1, const ModelHighAPI_RefAttr &theLine2, bool is_active=true)
Set collinear.
Definition: SketchAPI_Sketch.cpp:1338
std::shared_ptr< ModelHighAPI_Interface > addSplit(const ModelHighAPI_Reference &theFeature, const std::shared_ptr< GeomAPI_Pnt2d > &thePositionPoint)
Add split.
Definition: SketchAPI_Sketch.cpp:1206
Interface for Translation feature.
Definition: SketchAPI_Translation.h:43
Builds offset curves in the sketch.
Definition: SketchPlugin_Offset.h:39
static const std::string & EXTERNAL_ID()
Reference to the external edge or vertex as a AttributeSelection.
Definition: SketchPlugin_SketchEntity.h:55
static const std::string & ID()
Sketch feature kind.
Definition: SketchPlugin_Sketch.h:50
static const std::string & SOLVER_DOF()
Sketch solver error.
Definition: SketchPlugin_Sketch.h:165
static const std::string & NORM_ID()
Vector Z, normal to the sketch plane.
Definition: SketchPlugin_Sketch.h:68
static const std::string & SOLVER_ERROR()
Sketch solver error.
Definition: SketchPlugin_Sketch.h:158
static const std::string & DIRX_ID()
Vector X inside of the sketch plane.
Definition: SketchPlugin_Sketch.h:62
static const std::string & ORIGIN_ID()
Origin point of the sketcher in 3D space.
Definition: SketchPlugin_Sketch.h:56
static const std::string & FEATURES_ID()
All features of this sketch (list of references)
Definition: SketchPlugin_Sketch.h:152
SketchPtr addSketch(const std::shared_ptr< ModelAPI_Document > &thePart, const std::shared_ptr< GeomAPI_Ax3 > &thePlane)
Create Sketch feature.
Definition: SketchAPI_Sketch.cpp:332
SketchPtr copySketch(const std::shared_ptr< ModelAPI_Document > &thePart, const SketchPtr &theSketch)
Copy sketch with all its sub-features.
Definition: SketchAPI_Sketch.cpp:362