1 // Name : SketchAPI_Sketch.cpp
5 // 07/06/16 - Sergey POKHODENKO - Creation of the file
7 //--------------------------------------------------------------------------------------
8 #include "SketchAPI_Sketch.h"
9 //--------------------------------------------------------------------------------------
10 #include <SketchPlugin_Constraint.h>
11 #include <SketchPlugin_ConstraintAngle.h>
12 #include <SketchPlugin_ConstraintCoincidence.h>
13 #include <SketchPlugin_ConstraintCollinear.h>
14 #include <SketchPlugin_ConstraintDistance.h>
15 #include <SketchPlugin_ConstraintEqual.h>
16 #include <SketchPlugin_ConstraintFillet.h>
17 #include <SketchPlugin_ConstraintHorizontal.h>
18 #include <SketchPlugin_ConstraintLength.h>
19 #include <SketchPlugin_ConstraintMiddle.h>
20 #include <SketchPlugin_ConstraintMirror.h>
21 #include <SketchPlugin_ConstraintParallel.h>
22 #include <SketchPlugin_ConstraintPerpendicular.h>
23 #include <SketchPlugin_ConstraintRadius.h>
24 #include <SketchPlugin_ConstraintRigid.h>
25 #include <SketchPlugin_ConstraintTangent.h>
26 #include <SketchPlugin_ConstraintVertical.h>
27 //--------------------------------------------------------------------------------------
28 #include <ModelAPI_CompositeFeature.h>
29 #include <ModelAPI_ResultConstruction.h>
30 #include <ModelHighAPI_RefAttr.h>
31 #include <ModelHighAPI_Selection.h>
32 #include <ModelHighAPI_Tools.h>
33 //--------------------------------------------------------------------------------------
34 #include "SketchAPI_Arc.h"
35 #include "SketchAPI_Circle.h"
36 #include "SketchAPI_IntersectionPoint.h"
37 #include "SketchAPI_Line.h"
38 #include "SketchAPI_Mirror.h"
39 #include "SketchAPI_Point.h"
40 #include "SketchAPI_Projection.h"
41 #include "SketchAPI_Rotation.h"
42 #include "SketchAPI_Translation.h"
43 //--------------------------------------------------------------------------------------
44 SketchAPI_Sketch::SketchAPI_Sketch(
45 const std::shared_ptr<ModelAPI_Feature> & theFeature)
46 : ModelHighAPI_Interface(theFeature)
51 SketchAPI_Sketch::SketchAPI_Sketch(
52 const std::shared_ptr<ModelAPI_Feature> & theFeature,
53 const std::shared_ptr<GeomAPI_Ax3> & thePlane)
54 : ModelHighAPI_Interface(theFeature)
61 SketchAPI_Sketch::SketchAPI_Sketch(
62 const std::shared_ptr<ModelAPI_Feature> & theFeature,
63 const ModelHighAPI_Selection & theExternal)
64 : ModelHighAPI_Interface(theFeature)
67 setExternal(theExternal);
71 SketchAPI_Sketch::~SketchAPI_Sketch()
76 //--------------------------------------------------------------------------------------
77 std::shared_ptr<ModelAPI_CompositeFeature> SketchAPI_Sketch::compositeFeature() const
79 return std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(feature());
82 //--------------------------------------------------------------------------------------
83 void SketchAPI_Sketch::setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane)
85 fillAttribute(thePlane->origin(), myorigin);
86 fillAttribute(thePlane->dirX(), mydirX);
87 fillAttribute(thePlane->normal(), mynormal);
92 void SketchAPI_Sketch::setExternal(const ModelHighAPI_Selection & theExternal)
94 fillAttribute(theExternal, myexternal);
99 //--------------------------------------------------------------------------------------
100 void SketchAPI_Sketch::setValue(
101 const std::shared_ptr<ModelAPI_Feature> & theConstraint,
102 const ModelHighAPI_Double & theValue)
104 // TODO(spo): check somehow that the feature is a constraint or eliminate crash if the feature have no real attribute VALUE
105 fillAttribute(theValue, theConstraint->real(SketchPlugin_Constraint::VALUE()));
107 // theConstraint->execute();
110 //--------------------------------------------------------------------------------------
111 std::list<ModelHighAPI_Selection> SketchAPI_Sketch::selectFace() const
113 const_cast<SketchAPI_Sketch*>(this)->execute();
115 std::list<ModelHighAPI_Selection> aSelectionList;
117 ResultConstructionPtr aResultConstruction =
118 std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(feature()->firstResult());
119 if (aResultConstruction.get() == NULL)
120 return aSelectionList;
122 for (int anIndex = 0; anIndex < aResultConstruction->facesNum(); ++anIndex) {
123 aSelectionList.push_back(
124 ModelHighAPI_Selection(aResultConstruction,
125 aResultConstruction->face(anIndex)));
128 return aSelectionList;
131 //--------------------------------------------------------------------------------------
132 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
133 const std::shared_ptr<GeomAPI_Ax3> & thePlane)
135 // TODO(spo): check that thePart is not empty
136 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
137 return SketchPtr(new SketchAPI_Sketch(aFeature, thePlane));
140 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
141 const ModelHighAPI_Selection & theExternal)
143 // TODO(spo): check that thePart is not empty
144 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
145 return SketchPtr(new SketchAPI_Sketch(aFeature, theExternal));
148 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
149 const std::string & theExternalName)
151 // TODO(spo): check that thePart is not empty
152 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
153 return SketchPtr(new SketchAPI_Sketch(aFeature, ModelHighAPI_Selection("FACE", theExternalName)));
156 //--------------------------------------------------------------------------------------
157 std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(
158 double theX, double theY)
160 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID());
161 return PointPtr(new SketchAPI_Point(aFeature, theX, theY));
163 std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(
164 const std::shared_ptr<GeomAPI_Pnt2d> & thePoint)
166 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID());
167 return PointPtr(new SketchAPI_Point(aFeature, thePoint));
169 std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(const ModelHighAPI_Selection & theExternal)
171 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID());
172 return PointPtr(new SketchAPI_Point(aFeature, theExternal));
174 std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(const std::string & theExternalName)
176 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID());
177 return PointPtr(new SketchAPI_Point(aFeature, theExternalName));
180 //--------------------------------------------------------------------------------------
181 std::shared_ptr<SketchAPI_IntersectionPoint> SketchAPI_Sketch::addIntersectionPoint(
182 const ModelHighAPI_Selection & theExternal)
184 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_IntersectionPoint::ID());
185 return IntersectionPointPtr(new SketchAPI_IntersectionPoint(aFeature, theExternal));
187 std::shared_ptr<SketchAPI_IntersectionPoint> SketchAPI_Sketch::addIntersectionPoint(
188 const std::string & theExternalName)
190 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_IntersectionPoint::ID());
191 return IntersectionPointPtr(new SketchAPI_IntersectionPoint(aFeature, theExternalName));
194 //--------------------------------------------------------------------------------------
195 std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(double theX1, double theY1, double theX2, double theY2)
197 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID());
198 return LinePtr(new SketchAPI_Line(aFeature, theX1, theY1, theX2, theY2));
200 std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(
201 const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
202 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint)
204 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID());
205 return LinePtr(new SketchAPI_Line(aFeature, theStartPoint, theEndPoint));
207 std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(const ModelHighAPI_Selection & theExternal)
209 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID());
210 return LinePtr(new SketchAPI_Line(aFeature, theExternal));
212 std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(const std::string & theExternalName)
214 // TODO(spo): Add constraint SketchConstraintRigid like in PythonAPI. Is it necessary?
215 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID());
216 return LinePtr(new SketchAPI_Line(aFeature, theExternalName));
219 //--------------------------------------------------------------------------------------
220 std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(double theCenterX,
224 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
225 return CirclePtr(new SketchAPI_Circle(aFeature, theCenterX, theCenterY, theRadius));
228 std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
231 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
232 return CirclePtr(new SketchAPI_Circle(aFeature, theCenter, theRadius));
235 std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(double theX1, double theY1,
236 double theX2, double theY2,
237 double theX3, double theY3)
239 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
240 return CirclePtr(new SketchAPI_Circle(aFeature, theX1, theY1, theX2, theY2, theX3, theY3));
243 std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
244 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
245 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
247 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
248 return CirclePtr(new SketchAPI_Circle(aFeature, thePoint1, thePoint2, thePoint3));
251 std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const ModelHighAPI_Selection & theExternal)
253 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
254 return CirclePtr(new SketchAPI_Circle(aFeature, theExternal));
257 std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const std::string & theExternalName)
259 // TODO(spo): Add constraint SketchConstraintRigid like in PythonAPI. Is it necessary?
260 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
261 return CirclePtr(new SketchAPI_Circle(aFeature, theExternalName));
264 //--------------------------------------------------------------------------------------
265 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(double theCenterX, double theCenterY,
266 double theStartX, double theStartY,
267 double theEndX, double theEndY,
270 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
271 return ArcPtr(new SketchAPI_Arc(aFeature,
272 theCenterX, theCenterY,
273 theStartX, theStartY,
278 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
279 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
280 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
283 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
284 return ArcPtr(new SketchAPI_Arc(aFeature, theCenter, theStart, theEnd, theInversed));
287 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(double theStartX, double theStartY,
288 double theEndX, double theEndY,
289 double thePassedX, double thePassedY)
291 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
292 return ArcPtr(new SketchAPI_Arc(aFeature,
293 theStartX, theStartY,
295 thePassedX, thePassedY));
298 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
299 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
300 const std::shared_ptr<GeomAPI_Pnt2d>& thePassed)
302 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
303 return ArcPtr(new SketchAPI_Arc(aFeature, theStart, theEnd, thePassed));
306 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const ModelHighAPI_RefAttr& theTangentPoint,
307 double theEndX, double theEndY,
310 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
311 return ArcPtr(new SketchAPI_Arc(aFeature, theTangentPoint, theEndX, theEndY, theInversed));
314 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const ModelHighAPI_RefAttr& theTangentPoint,
315 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
318 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
319 return ArcPtr(new SketchAPI_Arc(aFeature, theTangentPoint, theEnd, theInversed));
322 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const ModelHighAPI_Selection & theExternal)
324 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
325 return ArcPtr(new SketchAPI_Arc(aFeature, theExternal));
328 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const std::string & theExternalName)
330 // TODO(spo): Add constraint SketchConstraintRigid like in PythonAPI. Is it necessary?
331 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
332 return ArcPtr(new SketchAPI_Arc(aFeature, theExternalName));
335 //--------------------------------------------------------------------------------------
336 std::shared_ptr<SketchAPI_Projection> SketchAPI_Sketch::addProjection(
337 const ModelHighAPI_Selection & theExternalFeature)
339 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Projection::ID());
340 return ProjectionPtr(new SketchAPI_Projection(aFeature, theExternalFeature));
343 //--------------------------------------------------------------------------------------
344 std::shared_ptr<SketchAPI_Mirror> SketchAPI_Sketch::addMirror(
345 const ModelHighAPI_RefAttr & theMirrorLine,
346 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects)
348 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintMirror::ID());
349 return MirrorPtr(new SketchAPI_Mirror(aFeature, theMirrorLine, theObjects));
352 //--------------------------------------------------------------------------------------
353 std::shared_ptr<SketchAPI_Translation> SketchAPI_Sketch::addTranslation(
354 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
355 const ModelHighAPI_RefAttr & thePoint1,
356 const ModelHighAPI_RefAttr & thePoint2,
357 const ModelHighAPI_Integer & theNumberOfObjects,
360 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_MultiTranslation::ID());
361 return TranslationPtr(new SketchAPI_Translation(aFeature, theObjects, thePoint1, thePoint2, theNumberOfObjects, theFullValue));
364 //--------------------------------------------------------------------------------------
365 std::shared_ptr<SketchAPI_Rotation> SketchAPI_Sketch::addRotation(
366 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
367 const ModelHighAPI_RefAttr & theCenter,
368 const ModelHighAPI_Double & theAngle,
369 const ModelHighAPI_Integer & theNumberOfObjects,
372 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_MultiRotation::ID());
373 return RotationPtr(new SketchAPI_Rotation(aFeature, theObjects, theCenter, theAngle, theNumberOfObjects, theFullValue));
376 //--------------------------------------------------------------------------------------
377 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setAngle(
378 const ModelHighAPI_RefAttr & theLine1,
379 const ModelHighAPI_RefAttr & theLine2,
380 const ModelHighAPI_Double & theValue)
382 // TODO(spo): is support of angle type necessary?
383 std::shared_ptr<ModelAPI_Feature> aFeature =
384 compositeFeature()->addFeature(SketchPlugin_ConstraintAngle::ID());
385 fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
386 fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
387 fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE()));
392 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setCoincident(
393 const ModelHighAPI_RefAttr & thePoint1,
394 const ModelHighAPI_RefAttr & thePoint2)
396 std::shared_ptr<ModelAPI_Feature> aFeature =
397 compositeFeature()->addFeature(SketchPlugin_ConstraintCoincidence::ID());
398 fillAttribute(thePoint1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
399 fillAttribute(thePoint2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
404 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setCollinear(
405 const ModelHighAPI_RefAttr & theLine1,
406 const ModelHighAPI_RefAttr & theLine2)
408 std::shared_ptr<ModelAPI_Feature> aFeature =
409 compositeFeature()->addFeature(SketchPlugin_ConstraintCollinear::ID());
410 fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
411 fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
416 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setDistance(
417 const ModelHighAPI_RefAttr & thePoint,
418 const ModelHighAPI_RefAttr & thePointOrLine,
419 const ModelHighAPI_Double & theValue)
421 std::shared_ptr<ModelAPI_Feature> aFeature =
422 compositeFeature()->addFeature(SketchPlugin_ConstraintDistance::ID());
423 fillAttribute(thePoint, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
424 fillAttribute(thePointOrLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
425 fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE()));
430 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setEqual(
431 const ModelHighAPI_RefAttr & theObject1,
432 const ModelHighAPI_RefAttr & theObject2)
434 std::shared_ptr<ModelAPI_Feature> aFeature =
435 compositeFeature()->addFeature(SketchPlugin_ConstraintEqual::ID());
436 fillAttribute(theObject1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
437 fillAttribute(theObject2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
442 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setFillet(
443 const std::list<ModelHighAPI_RefAttr> & thePoints,
444 const ModelHighAPI_Double & theRadius)
446 std::shared_ptr<ModelAPI_Feature> aFeature =
447 compositeFeature()->addFeature(SketchPlugin_ConstraintFillet::ID());
448 fillAttribute(thePoints, aFeature->data()->refattrlist(SketchPlugin_Constraint::ENTITY_A()));
449 fillAttribute(theRadius, aFeature->real(SketchPlugin_Constraint::VALUE()));
454 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setHorizontal(
455 const ModelHighAPI_RefAttr & theLine)
457 std::shared_ptr<ModelAPI_Feature> aFeature =
458 compositeFeature()->addFeature(SketchPlugin_ConstraintHorizontal::ID());
459 fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
464 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setLength(
465 const ModelHighAPI_RefAttr & theLine,
466 const ModelHighAPI_Double & theValue)
468 std::shared_ptr<ModelAPI_Feature> aFeature =
469 compositeFeature()->addFeature(SketchPlugin_ConstraintLength::ID());
470 fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
471 fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE()));
476 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setMiddlePoint(
477 const ModelHighAPI_RefAttr & thePoint,
478 const ModelHighAPI_RefAttr & theLine)
480 std::shared_ptr<ModelAPI_Feature> aFeature =
481 compositeFeature()->addFeature(SketchPlugin_ConstraintMiddle::ID());
482 fillAttribute(thePoint, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
483 fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
488 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setParallel(
489 const ModelHighAPI_RefAttr & theLine1,
490 const ModelHighAPI_RefAttr & theLine2)
492 std::shared_ptr<ModelAPI_Feature> aFeature =
493 compositeFeature()->addFeature(SketchPlugin_ConstraintParallel::ID());
494 fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
495 fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
500 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setPerpendicular(
501 const ModelHighAPI_RefAttr & theLine1,
502 const ModelHighAPI_RefAttr & theLine2)
504 std::shared_ptr<ModelAPI_Feature> aFeature =
505 compositeFeature()->addFeature(SketchPlugin_ConstraintPerpendicular::ID());
506 fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
507 fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
512 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setRadius(
513 const ModelHighAPI_RefAttr & theCircleOrArc,
514 const ModelHighAPI_Double & theValue)
516 std::shared_ptr<ModelAPI_Feature> aFeature =
517 compositeFeature()->addFeature(SketchPlugin_ConstraintRadius::ID());
518 fillAttribute(theCircleOrArc, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
519 fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE()));
524 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setRigid(
525 const ModelHighAPI_RefAttr & theObject)
527 // TODO(spo): should it be renamed to Fixed?
528 std::shared_ptr<ModelAPI_Feature> aFeature =
529 compositeFeature()->addFeature(SketchPlugin_ConstraintRigid::ID());
530 fillAttribute(theObject, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
535 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setTangent(
536 const ModelHighAPI_RefAttr & theLine,
537 const ModelHighAPI_RefAttr & theCircle)
539 std::shared_ptr<ModelAPI_Feature> aFeature =
540 compositeFeature()->addFeature(SketchPlugin_ConstraintTangent::ID());
541 fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
542 fillAttribute(theCircle, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
547 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setVertical(
548 const ModelHighAPI_RefAttr & theLine)
550 std::shared_ptr<ModelAPI_Feature> aFeature =
551 compositeFeature()->addFeature(SketchPlugin_ConstraintVertical::ID());
552 fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
557 //--------------------------------------------------------------------------------------