Salome HOME
Task 2.4. Ability to modify the radius of circles and arcs of circle with the mouse
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintLength.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 #include <SketchSolver_ConstraintLength.h>
4 #include <SketchSolver_Error.h>
5
6 #include <SketchPlugin_Line.h>
7
8
9 void SketchSolver_ConstraintLength::getAttributes(
10     EntityWrapperPtr& theValue,
11     std::vector<EntityWrapperPtr>& theAttributes)
12 {
13   SketchSolver_Constraint::getAttributes(theValue, theAttributes);
14   if (!myErrorMsg.empty() || !theAttributes[2] ||
15       theAttributes[2]->type() != ENTITY_LINE) {
16     theAttributes.clear();
17     return;
18   }
19
20   AttributeRefAttrPtr aRefAttr = myBaseConstraint->refattr(SketchPlugin_Constraint::ENTITY_A());
21   FeaturePtr aLine = ModelAPI_Feature::feature(aRefAttr->object());
22
23   theAttributes[0] = myStorage->entity(aLine->attribute(SketchPlugin_Line::START_ID()));
24   theAttributes[1] = myStorage->entity(aLine->attribute(SketchPlugin_Line::END_ID()));
25
26   myType = CONSTRAINT_PT_PT_DISTANCE;
27 }
28