1 #include <SketchSolver_ConstraintLength.h>
2 #include <SketchSolver_Group.h>
3 #include <SketchSolver_Error.h>
6 void SketchSolver_ConstraintLength::process()
9 if (!myBaseConstraint || !myStorage || myGroup == 0) {
10 /// TODO: Put error message here
13 if (!mySlvsConstraints.empty()) // some data is changed, update constraint
14 update(myBaseConstraint);
17 std::vector<Slvs_hEntity> anEntities;
18 getAttributes(aValue, anEntities);
19 if (!myErrorMsg.empty())
22 // Check the entity is a line
23 Slvs_Entity aLine = myStorage->getEntity(anEntities[2]);
24 if (aLine.type != SLVS_E_LINE_SEGMENT){
25 myErrorMsg = SketchSolver_Error::INCORRECT_ATTRIBUTE();
29 Slvs_Constraint aConstraint = Slvs_MakeConstraint(SLVS_C_UNKNOWN, myGroup->getId(),
30 getType(), myGroup->getWorkplaneId(), aValue,
31 aLine.point[0], aLine.point[1], SLVS_E_UNKNOWN, SLVS_E_UNKNOWN);
32 aConstraint.h = myStorage->addConstraint(aConstraint);
33 mySlvsConstraints.push_back(aConstraint.h);
37 void SketchSolver_ConstraintLength::adjustConstraint()
39 // No need to store the line, which length is constrained
40 // Upd: The line need to be stored to check that constraint
41 // is changed/unchanged during modifications in GUI
42 //myFeatureMap.clear();