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_Line.h"
37 #include "SketchAPI_Mirror.h"
38 #include "SketchAPI_Point.h"
39 #include "SketchAPI_Rotation.h"
40 #include "SketchAPI_Translation.h"
41 //--------------------------------------------------------------------------------------
42 SketchAPI_Sketch::SketchAPI_Sketch(
43 const std::shared_ptr<ModelAPI_Feature> & theFeature)
44 : ModelHighAPI_Interface(theFeature)
49 SketchAPI_Sketch::SketchAPI_Sketch(
50 const std::shared_ptr<ModelAPI_Feature> & theFeature,
51 const std::shared_ptr<GeomAPI_Ax3> & thePlane)
52 : ModelHighAPI_Interface(theFeature)
59 SketchAPI_Sketch::SketchAPI_Sketch(
60 const std::shared_ptr<ModelAPI_Feature> & theFeature,
61 const ModelHighAPI_Selection & theExternal)
62 : ModelHighAPI_Interface(theFeature)
65 setExternal(theExternal);
69 SketchAPI_Sketch::~SketchAPI_Sketch()
74 //--------------------------------------------------------------------------------------
75 std::shared_ptr<ModelAPI_CompositeFeature> SketchAPI_Sketch::compositeFeature() const
77 return std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(feature());
80 //--------------------------------------------------------------------------------------
81 void SketchAPI_Sketch::setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane)
83 fillAttribute(thePlane->origin(), myorigin);
84 fillAttribute(thePlane->dirX(), mydirX);
85 fillAttribute(thePlane->normal(), mynormal);
90 void SketchAPI_Sketch::setExternal(const ModelHighAPI_Selection & theExternal)
92 fillAttribute(theExternal, myexternal);
97 //--------------------------------------------------------------------------------------
98 void SketchAPI_Sketch::setValue(
99 const std::shared_ptr<ModelAPI_Feature> & theConstraint,
100 const ModelHighAPI_Double & theValue)
102 // TODO(spo): check somehow that the feature is a constraint or eliminate crash if the feature have no real attribute VALUE
103 fillAttribute(theValue, theConstraint->real(SketchPlugin_Constraint::VALUE()));
105 // theConstraint->execute();
108 //--------------------------------------------------------------------------------------
109 std::list<ModelHighAPI_Selection> SketchAPI_Sketch::selectFace() const
111 const_cast<SketchAPI_Sketch*>(this)->execute();
113 std::list<ModelHighAPI_Selection> aSelectionList;
115 ResultConstructionPtr aResultConstruction =
116 std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(feature()->firstResult());
117 if (aResultConstruction.get() == NULL)
118 return aSelectionList;
120 for (int anIndex = 0; anIndex < aResultConstruction->facesNum(); ++anIndex) {
121 aSelectionList.push_back(
122 ModelHighAPI_Selection(aResultConstruction,
123 aResultConstruction->face(anIndex)));
126 return aSelectionList;
129 //--------------------------------------------------------------------------------------
130 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
131 const std::shared_ptr<GeomAPI_Ax3> & thePlane)
133 // TODO(spo): check that thePart is not empty
134 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
135 return SketchPtr(new SketchAPI_Sketch(aFeature, thePlane));
138 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
139 const ModelHighAPI_Selection & theExternal)
141 // TODO(spo): check that thePart is not empty
142 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
143 return SketchPtr(new SketchAPI_Sketch(aFeature, theExternal));
146 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
147 const std::string & theExternalName)
149 // TODO(spo): check that thePart is not empty
150 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
151 return SketchPtr(new SketchAPI_Sketch(aFeature, ModelHighAPI_Selection("FACE", theExternalName)));
154 //--------------------------------------------------------------------------------------
155 std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(
156 double theX, double theY)
158 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID());
159 return PointPtr(new SketchAPI_Point(aFeature, theX, theY));
161 std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(
162 const std::shared_ptr<GeomAPI_Pnt2d> & thePoint)
164 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID());
165 return PointPtr(new SketchAPI_Point(aFeature, thePoint));
167 std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(const ModelHighAPI_Selection & theExternal)
169 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID());
170 return PointPtr(new SketchAPI_Point(aFeature, theExternal));
172 std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(const std::string & theExternalName)
174 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID());
175 return PointPtr(new SketchAPI_Point(aFeature, theExternalName));
178 //--------------------------------------------------------------------------------------
179 std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(double theX1, double theY1, double theX2, double theY2)
181 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID());
182 return LinePtr(new SketchAPI_Line(aFeature, theX1, theY1, theX2, theY2));
184 std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(
185 const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
186 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint)
188 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID());
189 return LinePtr(new SketchAPI_Line(aFeature, theStartPoint, theEndPoint));
191 std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(const ModelHighAPI_Selection & theExternal)
193 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID());
194 return LinePtr(new SketchAPI_Line(aFeature, theExternal));
196 std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(const std::string & theExternalName)
198 // TODO(spo): Add constraint SketchConstraintRigid like in PythonAPI. Is it necessary?
199 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID());
200 return LinePtr(new SketchAPI_Line(aFeature, theExternalName));
203 //--------------------------------------------------------------------------------------
204 std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(double theCenterX,
208 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
209 return CirclePtr(new SketchAPI_Circle(aFeature, theCenterX, theCenterY, theRadius));
212 std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
215 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
216 return CirclePtr(new SketchAPI_Circle(aFeature, theCenter, theRadius));
219 std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(double theX1, double theY1,
220 double theX2, double theY2,
221 double theX3, double theY3)
223 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
224 return CirclePtr(new SketchAPI_Circle(aFeature, theX1, theY1, theX2, theY2, theX3, theY3));
227 std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
228 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
229 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
231 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
232 return CirclePtr(new SketchAPI_Circle(aFeature, thePoint1, thePoint2, thePoint3));
235 std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const ModelHighAPI_Selection & theExternal)
237 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
238 return CirclePtr(new SketchAPI_Circle(aFeature, theExternal));
241 std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const std::string & theExternalName)
243 // TODO(spo): Add constraint SketchConstraintRigid like in PythonAPI. Is it necessary?
244 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
245 return CirclePtr(new SketchAPI_Circle(aFeature, theExternalName));
248 //--------------------------------------------------------------------------------------
249 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(double theCenterX, double theCenterY,
250 double theStartX, double theStartY,
251 double theEndX, double theEndY,
254 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
255 return ArcPtr(new SketchAPI_Arc(aFeature,
256 theCenterX, theCenterY,
257 theStartX, theStartY,
262 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
263 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
264 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
267 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
268 return ArcPtr(new SketchAPI_Arc(aFeature, theCenter, theStart, theEnd, theInversed));
271 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(double theStartX, double theStartY,
272 double theEndX, double theEndY,
273 double thePassedX, double thePassedY)
275 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
276 return ArcPtr(new SketchAPI_Arc(aFeature,
277 theStartX, theStartY,
279 thePassedX, thePassedY));
282 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
283 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
284 const std::shared_ptr<GeomAPI_Pnt2d>& thePassed)
286 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
287 return ArcPtr(new SketchAPI_Arc(aFeature, theStart, theEnd, thePassed));
290 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const ModelHighAPI_RefAttr& theTangentPoint,
291 double theEndX, double theEndY,
294 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
295 return ArcPtr(new SketchAPI_Arc(aFeature, theTangentPoint, theEndX, theEndY, theInversed));
298 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const ModelHighAPI_RefAttr& theTangentPoint,
299 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
302 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
303 return ArcPtr(new SketchAPI_Arc(aFeature, theTangentPoint, theEnd, theInversed));
306 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const ModelHighAPI_Selection & theExternal)
308 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
309 return ArcPtr(new SketchAPI_Arc(aFeature, theExternal));
312 std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const std::string & theExternalName)
314 // TODO(spo): Add constraint SketchConstraintRigid like in PythonAPI. Is it necessary?
315 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
316 return ArcPtr(new SketchAPI_Arc(aFeature, theExternalName));
319 //--------------------------------------------------------------------------------------
320 std::shared_ptr<SketchAPI_Mirror> SketchAPI_Sketch::addMirror(
321 const ModelHighAPI_RefAttr & theMirrorLine,
322 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects)
324 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintMirror::ID());
325 return MirrorPtr(new SketchAPI_Mirror(aFeature, theMirrorLine, theObjects));
328 //--------------------------------------------------------------------------------------
329 std::shared_ptr<SketchAPI_Translation> SketchAPI_Sketch::addTranslation(
330 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
331 const ModelHighAPI_RefAttr & thePoint1,
332 const ModelHighAPI_RefAttr & thePoint2,
333 const ModelHighAPI_Integer & theNumberOfObjects,
336 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_MultiTranslation::ID());
337 return TranslationPtr(new SketchAPI_Translation(aFeature, theObjects, thePoint1, thePoint2, theNumberOfObjects, theFullValue));
340 //--------------------------------------------------------------------------------------
341 std::shared_ptr<SketchAPI_Rotation> SketchAPI_Sketch::addRotation(
342 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
343 const ModelHighAPI_RefAttr & theCenter,
344 const ModelHighAPI_Double & theAngle,
345 const ModelHighAPI_Integer & theNumberOfObjects,
348 std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_MultiRotation::ID());
349 return RotationPtr(new SketchAPI_Rotation(aFeature, theObjects, theCenter, theAngle, theNumberOfObjects, theFullValue));
352 //--------------------------------------------------------------------------------------
353 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setAngle(
354 const ModelHighAPI_RefAttr & theLine1,
355 const ModelHighAPI_RefAttr & theLine2,
356 const ModelHighAPI_Double & theValue)
358 // TODO(spo): is support of angle type necessary?
359 std::shared_ptr<ModelAPI_Feature> aFeature =
360 compositeFeature()->addFeature(SketchPlugin_ConstraintAngle::ID());
361 fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
362 fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
363 fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE()));
368 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setCoincident(
369 const ModelHighAPI_RefAttr & thePoint1,
370 const ModelHighAPI_RefAttr & thePoint2)
372 std::shared_ptr<ModelAPI_Feature> aFeature =
373 compositeFeature()->addFeature(SketchPlugin_ConstraintCoincidence::ID());
374 fillAttribute(thePoint1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
375 fillAttribute(thePoint2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
380 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setCollinear(
381 const ModelHighAPI_RefAttr & theLine1,
382 const ModelHighAPI_RefAttr & theLine2)
384 std::shared_ptr<ModelAPI_Feature> aFeature =
385 compositeFeature()->addFeature(SketchPlugin_ConstraintCollinear::ID());
386 fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
387 fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
392 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setDistance(
393 const ModelHighAPI_RefAttr & thePoint,
394 const ModelHighAPI_RefAttr & thePointOrLine,
395 const ModelHighAPI_Double & theValue)
397 std::shared_ptr<ModelAPI_Feature> aFeature =
398 compositeFeature()->addFeature(SketchPlugin_ConstraintDistance::ID());
399 fillAttribute(thePoint, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
400 fillAttribute(thePointOrLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
401 fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE()));
406 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setEqual(
407 const ModelHighAPI_RefAttr & theObject1,
408 const ModelHighAPI_RefAttr & theObject2)
410 std::shared_ptr<ModelAPI_Feature> aFeature =
411 compositeFeature()->addFeature(SketchPlugin_ConstraintEqual::ID());
412 fillAttribute(theObject1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
413 fillAttribute(theObject2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
418 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setFillet(
419 const std::list<ModelHighAPI_RefAttr> & thePoints,
420 const ModelHighAPI_Double & theRadius)
422 std::shared_ptr<ModelAPI_Feature> aFeature =
423 compositeFeature()->addFeature(SketchPlugin_ConstraintFillet::ID());
424 fillAttribute(thePoints, aFeature->data()->refattrlist(SketchPlugin_Constraint::ENTITY_A()));
425 fillAttribute(theRadius, aFeature->real(SketchPlugin_Constraint::VALUE()));
430 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setHorizontal(
431 const ModelHighAPI_RefAttr & theLine)
433 std::shared_ptr<ModelAPI_Feature> aFeature =
434 compositeFeature()->addFeature(SketchPlugin_ConstraintHorizontal::ID());
435 fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
440 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setLength(
441 const ModelHighAPI_RefAttr & theLine,
442 const ModelHighAPI_Double & theValue)
444 std::shared_ptr<ModelAPI_Feature> aFeature =
445 compositeFeature()->addFeature(SketchPlugin_ConstraintLength::ID());
446 fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
447 fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE()));
452 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setMiddlePoint(
453 const ModelHighAPI_RefAttr & thePoint,
454 const ModelHighAPI_RefAttr & theLine)
456 std::shared_ptr<ModelAPI_Feature> aFeature =
457 compositeFeature()->addFeature(SketchPlugin_ConstraintMiddle::ID());
458 fillAttribute(thePoint, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
459 fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
464 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setParallel(
465 const ModelHighAPI_RefAttr & theLine1,
466 const ModelHighAPI_RefAttr & theLine2)
468 std::shared_ptr<ModelAPI_Feature> aFeature =
469 compositeFeature()->addFeature(SketchPlugin_ConstraintParallel::ID());
470 fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
471 fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
476 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setPerpendicular(
477 const ModelHighAPI_RefAttr & theLine1,
478 const ModelHighAPI_RefAttr & theLine2)
480 std::shared_ptr<ModelAPI_Feature> aFeature =
481 compositeFeature()->addFeature(SketchPlugin_ConstraintPerpendicular::ID());
482 fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
483 fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
488 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setRadius(
489 const ModelHighAPI_RefAttr & theCircleOrArc,
490 const ModelHighAPI_Double & theValue)
492 std::shared_ptr<ModelAPI_Feature> aFeature =
493 compositeFeature()->addFeature(SketchPlugin_ConstraintRadius::ID());
494 fillAttribute(theCircleOrArc, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
495 fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE()));
500 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setRigid(
501 const ModelHighAPI_RefAttr & theObject)
503 // TODO(spo): should it be renamed to Fixed?
504 std::shared_ptr<ModelAPI_Feature> aFeature =
505 compositeFeature()->addFeature(SketchPlugin_ConstraintRigid::ID());
506 fillAttribute(theObject, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
511 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setTangent(
512 const ModelHighAPI_RefAttr & theLine,
513 const ModelHighAPI_RefAttr & theCircle)
515 std::shared_ptr<ModelAPI_Feature> aFeature =
516 compositeFeature()->addFeature(SketchPlugin_ConstraintTangent::ID());
517 fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
518 fillAttribute(theCircle, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
523 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setVertical(
524 const ModelHighAPI_RefAttr & theLine)
526 std::shared_ptr<ModelAPI_Feature> aFeature =
527 compositeFeature()->addFeature(SketchPlugin_ConstraintVertical::ID());
528 fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
533 //--------------------------------------------------------------------------------------