Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / SketchSolver / SketchSolver_Group.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    SketchSolver_Group.cpp
4 // Created: 27 May 2014
5 // Author:  Artem ZHIDKOV
6
7 #include "SketchSolver_Group.h"
8
9 #include <SketchSolver_Builder.h>
10 #include <SketchSolver_Constraint.h>
11 #include <SketchSolver_ConstraintCoincidence.h>
12 #include <SketchSolver_Error.h>
13
14 #include <Events_Error.h>
15 #include <Events_Loop.h>
16 #include <GeomAPI_XY.h>
17 #include <GeomAPI_Dir2d.h>
18 #include <GeomAPI_Pnt2d.h>
19 #include <GeomDataAPI_Dir.h>
20 #include <GeomDataAPI_Point.h>
21 #include <GeomDataAPI_Point2D.h>
22 #include <ModelAPI_AttributeDouble.h>
23 #include <ModelAPI_Document.h>
24 #include <ModelAPI_Events.h>
25 #include <ModelAPI_ResultConstruction.h>
26
27 #include <SketchPlugin_Constraint.h>
28 #include <SketchPlugin_ConstraintFillet.h>
29 #include <SketchPlugin_ConstraintLength.h>
30 #include <SketchPlugin_ConstraintCoincidence.h>
31 #include <SketchPlugin_ConstraintMirror.h>
32 #include <SketchPlugin_ConstraintRigid.h>
33 #include <SketchPlugin_ConstraintTangent.h>
34 #include <SketchPlugin_Feature.h>
35
36 #include <SketchPlugin_Arc.h>
37 #include <SketchPlugin_Circle.h>
38 #include <SketchPlugin_Line.h>
39 #include <SketchPlugin_Point.h>
40 #include <SketchPlugin_Sketch.h>
41
42 #include <math.h>
43 #include <assert.h>
44
45
46 /// \brief This class is used to give unique index to the groups
47 class GroupIndexer
48 {
49 public:
50   /// \brief Return vacant index
51   static Slvs_hGroup NEW_GROUP() { return ++myGroupIndex; }
52   /// \brief Removes the index
53   static void REMOVE_GROUP(const Slvs_hGroup& theIndex) {
54     if (myGroupIndex == theIndex)
55       myGroupIndex--;
56   }
57
58 private:
59   GroupIndexer() {};
60
61   static Slvs_hGroup myGroupIndex; ///< index of the group
62 };
63
64 Slvs_hGroup GroupIndexer::myGroupIndex = 0;
65
66
67
68 // ========================================================
69 // =========  SketchSolver_Group  ===============
70 // ========================================================
71
72 SketchSolver_Group::SketchSolver_Group(
73     std::shared_ptr<ModelAPI_CompositeFeature> theWorkplane)
74     : myID(GroupIndexer::NEW_GROUP())
75 {
76   // Initialize workplane
77   myWorkplaneID = SLVS_E_UNKNOWN;
78 #ifndef NDEBUG
79   assert(addWorkplane(theWorkplane));
80 #else
81   addWorkplane(theWorkplane);
82 #endif
83 }
84
85 SketchSolver_Group::~SketchSolver_Group()
86 {
87   myConstraints.clear();
88   GroupIndexer::REMOVE_GROUP(myID);
89 }
90
91 // ============================================================================
92 //  Function: isBaseWorkplane
93 //  Class:    SketchSolver_Group
94 //  Purpose:  verify the group is based on the given workplane
95 // ============================================================================
96 bool SketchSolver_Group::isBaseWorkplane(CompositeFeaturePtr theWorkplane) const
97 {
98   return theWorkplane == mySketch;
99 }
100
101 // ============================================================================
102 //  Function: isInteract
103 //  Class:    SketchSolver_Group
104 //  Purpose:  verify are there any entities in the group used by given constraint
105 // ============================================================================
106 bool SketchSolver_Group::isInteract(
107     std::shared_ptr<SketchPlugin_Feature> theFeature) const
108 {
109   // Empty group interacts with everything
110   if (isEmpty()) return true;
111   ConstraintPtr aConstraint = std::dynamic_pointer_cast<SketchPlugin_Constraint>(theFeature);
112   if (aConstraint)
113     return myFeatureStorage->isInteract(aConstraint);
114   return myFeatureStorage->isInteract(std::dynamic_pointer_cast<ModelAPI_Feature>(theFeature));
115 }
116
117 // ============================================================================
118 //  Function: getFeatureId
119 //  Class:    SketchSolver_Group
120 //  Purpose:  Find the identifier of the feature, if it already exists in the group
121 // ============================================================================
122 Slvs_hEntity SketchSolver_Group::getFeatureId(FeaturePtr theFeature) const
123 {
124   Slvs_hEntity aResult = SLVS_E_UNKNOWN;
125   if (!myFeatureStorage)
126     return aResult;
127   std::set<ConstraintPtr> aConstraints = myFeatureStorage->getConstraints(theFeature);
128   if (aConstraints.empty())
129     return aResult;
130   std::set<ConstraintPtr>::iterator aConstrIter = aConstraints.begin();
131   for (; aConstrIter != aConstraints.end(); aConstrIter++) {
132     ConstraintConstraintMap::const_iterator aCIter = myConstraints.find(*aConstrIter);
133     if (aCIter == myConstraints.end())
134       continue;
135     aResult = aCIter->second->getId(theFeature);
136     if (aResult != SLVS_E_UNKNOWN)
137       return aResult;
138   }
139   return SLVS_E_UNKNOWN;
140 }
141
142 // ============================================================================
143 //  Function: getAttributeId
144 //  Class:    SketchSolver_Group
145 //  Purpose:  Find the identifier of the attribute, if it already exists in the group
146 // ============================================================================
147 Slvs_hEntity SketchSolver_Group::getAttributeId(AttributePtr theAttribute) const
148 {
149   Slvs_hEntity aResult = SLVS_E_UNKNOWN;
150   if (!myFeatureStorage)
151     return aResult;
152   std::set<ConstraintPtr> aConstraints = myFeatureStorage->getConstraints(theAttribute);
153   if (aConstraints.empty())
154     return aResult;
155   std::set<ConstraintPtr>::iterator aConstrIter = aConstraints.begin();
156   for (; aConstrIter != aConstraints.end(); aConstrIter++) {
157     ConstraintConstraintMap::const_iterator aCIter = myConstraints.find(*aConstrIter);
158     if (aCIter == myConstraints.end())
159       continue;
160     aResult = aCIter->second->getId(theAttribute);
161     if (aResult != SLVS_E_UNKNOWN)
162       return aResult;
163   }
164   return SLVS_E_UNKNOWN;
165 }
166
167 // ============================================================================
168 //  Function: changeConstraint
169 //  Class:    SketchSolver_Group
170 //  Purpose:  create/update the constraint in the group
171 // ============================================================================
172 bool SketchSolver_Group::changeConstraint(
173     std::shared_ptr<SketchPlugin_Constraint> theConstraint)
174 {
175   // There is no workplane yet, something wrong
176   if (myWorkplaneID == SLVS_E_UNKNOWN)
177     return false;
178
179   if (!theConstraint)
180     return false;
181
182   if (myConstraints.find(theConstraint) == myConstraints.end()) {
183     // Add constraint to the current group
184     SolverConstraintPtr aConstraint =
185         SketchSolver_Builder::getInstance()->createConstraint(theConstraint);
186     if (!aConstraint)
187       return false;
188     aConstraint->setGroup(this);
189     aConstraint->setStorage(myStorage);
190     if (!aConstraint->error().empty()) {
191       if (aConstraint->error() == SketchSolver_Error::NOT_INITIALIZED())
192         return false; // some attribute are not initialized yet, don't show message
193       Events_Error::send(aConstraint->error(), this);
194     }
195
196     // Additional verification of coincidence of several points
197     if (theConstraint->getKind() == SketchPlugin_ConstraintCoincidence::ID()) {
198       ConstraintConstraintMap::iterator aCIter = myConstraints.begin();
199       for (; aCIter != myConstraints.end(); aCIter++) {
200         std::shared_ptr<SketchSolver_ConstraintCoincidence> aCoincidence =
201           std::dynamic_pointer_cast<SketchSolver_ConstraintCoincidence>(aCIter->second);
202         if (!aCoincidence)
203           continue;
204         std::shared_ptr<SketchSolver_ConstraintCoincidence> aCoinc2 =
205           std::dynamic_pointer_cast<SketchSolver_ConstraintCoincidence>(aConstraint);
206         if (aCoincidence != aCoinc2 && aCoincidence->isCoincide(aCoinc2)) {
207           aCoincidence->attach(aCoinc2);
208           aConstraint = aCoincidence;
209         }
210       }
211     }
212     myConstraints[theConstraint] = aConstraint;
213   }
214   else
215     myConstraints[theConstraint]->update();
216
217   // Fix base features for fillet
218   if (theConstraint->getKind() == SketchPlugin_ConstraintFillet::ID()) {
219     std::list<AttributePtr> anAttrList =
220         theConstraint->data()->attributes(ModelAPI_AttributeRefAttr::typeId());
221     std::list<AttributePtr>::iterator anAttrIter = anAttrList.begin();
222     for (; anAttrIter != anAttrList.end(); anAttrIter++) {
223       AttributeRefAttrPtr aRefAttr =
224           std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttrIter);
225       if (!aRefAttr || !aRefAttr->isObject())
226         continue;
227       FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object());
228       SolverConstraintPtr aConstraint =
229           SketchSolver_Builder::getInstance()->createRigidConstraint(aFeature);
230       if (!aConstraint)
231         continue;
232       aConstraint->setGroup(this);
233       aConstraint->setStorage(myStorage);
234       setTemporary(aConstraint);
235     }
236   }
237   // Fix base features for mirror
238   if (theConstraint->getKind() == SketchPlugin_ConstraintMirror::ID()) {
239     AttributeRefListPtr aRefList = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
240         theConstraint->attribute(SketchPlugin_ConstraintMirror::ENTITY_B()));
241     fixFeaturesList(aRefList);
242   }
243
244   if (!myFeatureStorage)
245     myFeatureStorage = FeatureStoragePtr(new SketchSolver_FeatureStorage);
246   myFeatureStorage->changeConstraint(theConstraint);
247
248   return true;
249 }
250
251
252 bool SketchSolver_Group::updateFeature(std::shared_ptr<SketchPlugin_Feature> theFeature)
253 {
254   std::set<ConstraintPtr> aConstraints =
255       myFeatureStorage->getConstraints(std::dynamic_pointer_cast<ModelAPI_Feature>(theFeature));
256   if (aConstraints.empty())
257     return false;
258   std::set<ConstraintPtr>::iterator aCIter = aConstraints.begin();
259   for (; aCIter != aConstraints.end(); aCIter++) {
260     ConstraintConstraintMap::iterator aSolConIter = myConstraints.find(*aCIter);
261     if (aSolConIter == myConstraints.end())
262       continue;
263     myFeatureStorage->changeFeature(theFeature, aSolConIter->first);
264     aSolConIter->second->addFeature(theFeature);
265     aSolConIter->second->update();
266   }
267   return true;
268 }
269
270 void SketchSolver_Group::moveFeature(std::shared_ptr<SketchPlugin_Feature> theFeature)
271 {
272   updateFeature(theFeature);
273   // Temporary rigid constraint
274   SolverConstraintPtr aConstraint =
275       SketchSolver_Builder::getInstance()->createRigidConstraint(theFeature);
276   if (!aConstraint)
277     return;
278   aConstraint->setGroup(this);
279   aConstraint->setStorage(myStorage);
280   setTemporary(aConstraint);
281 }
282
283 // ============================================================================
284 //  Function: fixFeaturesList
285 //  Class:    SketchSolver_Group
286 //  Purpose:  Apply temporary rigid constraints for the list of features
287 // ============================================================================
288 void SketchSolver_Group::fixFeaturesList(AttributeRefListPtr theList)
289 {
290   std::list<ObjectPtr> aList = theList->list();
291   std::list<ObjectPtr>::iterator anIt = aList.begin();
292   for (; anIt != aList.end(); anIt++) {
293     if (!(*anIt))
294       continue;
295     FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt);
296     SolverConstraintPtr aConstraint =
297         SketchSolver_Builder::getInstance()->createRigidConstraint(aFeature);
298     if (!aConstraint)
299       continue;
300     aConstraint->setGroup(this);
301     aConstraint->setStorage(myStorage);
302     setTemporary(aConstraint);
303   }
304 }
305
306 // ============================================================================
307 //  Function: addWorkplane
308 //  Class:    SketchSolver_Group
309 //  Purpose:  create workplane for the group
310 // ============================================================================
311 bool SketchSolver_Group::addWorkplane(CompositeFeaturePtr theSketch)
312 {
313   if (myWorkplaneID != SLVS_E_UNKNOWN || theSketch->getKind() != SketchPlugin_Sketch::ID())
314     return false;  // the workplane already exists or the function parameter is not Sketch
315
316   mySketch = theSketch;
317   updateWorkplane();
318   return true;
319 }
320
321 // ============================================================================
322 //  Function: updateWorkplane
323 //  Class:    SketchSolver_Group
324 //  Purpose:  update parameters of workplane
325 // ============================================================================
326 bool SketchSolver_Group::updateWorkplane()
327 {
328   if (!myStorage) // Create storage if not exists
329     myStorage = StoragePtr(new SketchSolver_Storage);
330   SketchSolver_Builder* aBuilder = SketchSolver_Builder::getInstance();
331
332   std::vector<Slvs_Entity> anEntities;
333   std::vector<Slvs_Param> aParams;
334   if (!aBuilder->createWorkplane(mySketch, anEntities, aParams))
335     return false;
336
337   if (myWorkplaneID == SLVS_E_UNKNOWN) {
338     myWorkplaneID = anEntities.back().h;
339     // Add new workplane elements
340     std::vector<Slvs_Param>::iterator aParIter = aParams.begin();
341     for (; aParIter != aParams.end(); aParIter++) {
342       aParIter->h = SLVS_E_UNKNOWN; // the ID should be generated by storage
343       aParIter->group = myID;
344       aParIter->h = myStorage->addParameter(*aParIter);
345     }
346     std::vector<Slvs_Entity>::iterator anEntIter = anEntities.begin();
347     for (; anEntIter != anEntities.end(); anEntIter++) {
348       anEntIter->h = SLVS_E_UNKNOWN; // the ID should be generated by storage
349       anEntIter->group = myID;
350       anEntIter->wrkpl = myWorkplaneID;
351       for (int i = 0; i < 4; i++)
352         if (anEntIter->param[i] != SLVS_E_UNKNOWN)
353           anEntIter->param[i] = aParams[anEntIter->param[i]-1].h;
354       for (int i = 0; i < 4; i++)
355         if (anEntIter->point[i] != SLVS_E_UNKNOWN)
356           anEntIter->point[i] = anEntities[anEntIter->point[i]-1].h;
357       anEntIter->h = myStorage->addEntity(*anEntIter);
358     }
359   } else {
360     // Update existent workplane
361     const Slvs_Entity& aWP = myStorage->getEntity(myWorkplaneID);
362     const Slvs_Entity& anOrigin = myStorage->getEntity(aWP.point[0]);
363     const Slvs_Entity& aNormal = myStorage->getEntity(aWP.normal);
364     // Get parameters and update them
365     Slvs_hParam aWPParams[7] = {
366         anOrigin.param[0], anOrigin.param[1], anOrigin.param[2],
367         aNormal.param[0], aNormal.param[1], aNormal.param[2], aNormal.param[3]
368       };
369     std::vector<Slvs_Param>::iterator aParIter = aParams.begin();
370     for (int i = 0; aParIter != aParams.end(); aParIter++, i++) {
371       Slvs_Param aParam = myStorage->getParameter(aWPParams[i]);
372       aParam.val = aParIter->val;
373       myStorage->updateParameter(aParam);
374     }
375   }
376   return myWorkplaneID > 0;
377 }
378
379 // ============================================================================
380 //  Function: resolveConstraints
381 //  Class:    SketchSolver_Group
382 //  Purpose:  solve the set of constraints for the current group
383 // ============================================================================
384 bool SketchSolver_Group::resolveConstraints()
385 {
386   bool aResolved = false;
387   if (myStorage->isNeedToResolve() && !isEmpty()) {
388     myConstrSolver.setGroupID(myID);
389     myStorage->initializeSolver(myConstrSolver);
390
391     int aResult = SLVS_RESULT_OKAY;
392     try {
393       aResult = myConstrSolver.solve();
394     } catch (...) {
395       Events_Error::send(SketchSolver_Error::SOLVESPACE_CRASH(), this);
396       return false;
397     }
398     if (aResult == SLVS_RESULT_OKAY) {  // solution succeeded, store results into correspondent attributes
399       myFeatureStorage->blockEvents(true);
400       ConstraintConstraintMap::iterator aConstrIter = myConstraints.begin();
401       for (; aConstrIter != myConstraints.end(); aConstrIter++)
402         aConstrIter->second->refresh();
403       myFeatureStorage->blockEvents(false);
404     } else if (!myConstraints.empty())
405       Events_Error::send(SketchSolver_Error::CONSTRAINTS(), this);
406
407     aResolved = true;
408   }
409   removeTemporaryConstraints();
410   myStorage->setNeedToResolve(false);
411   return aResolved;
412 }
413
414 // ============================================================================
415 //  Function: mergeGroups
416 //  Class:    SketchSolver_Group
417 //  Purpose:  append specified group to the current group
418 // ============================================================================
419 void SketchSolver_Group::mergeGroups(const SketchSolver_Group& theGroup)
420 {
421   // If specified group is empty, no need to merge
422   if (theGroup.isEmpty())
423     return;
424   if (!myFeatureStorage)
425     myFeatureStorage = FeatureStoragePtr(new SketchSolver_FeatureStorage);
426
427   std::vector<ConstraintPtr> aComplexConstraints;
428   ConstraintConstraintMap::const_iterator aConstrIter = theGroup.myConstraints.begin();
429   // append simple constraints
430   for (; aConstrIter != theGroup.myConstraints.end(); aConstrIter++)
431     if (isComplexConstraint(aConstrIter->first))
432       aComplexConstraints.push_back(aConstrIter->first);
433     else
434       changeConstraint(aConstrIter->first);
435   // append complex constraints
436   std::vector<ConstraintPtr>::iterator aComplexIter = aComplexConstraints.begin();
437   for (; aComplexIter != aComplexConstraints.end(); aComplexIter++)
438       changeConstraint(*aComplexIter);
439 }
440
441 // ============================================================================
442 //  Function: splitGroup
443 //  Class:    SketchSolver_Group
444 //  Purpose:  divide the group into several subgroups
445 // ============================================================================
446 void SketchSolver_Group::splitGroup(std::vector<SketchSolver_Group*>& theCuts)
447 {
448   // Obtain constraints, which should be separated
449   FeatureStoragePtr aNewFeatStorage(new SketchSolver_FeatureStorage);
450   std::vector<ConstraintPtr> anUnusedConstraints;
451   ConstraintConstraintMap::iterator aCIter = myConstraints.begin();
452   for ( ; aCIter != myConstraints.end(); aCIter++) {
453     std::list<ConstraintPtr> aBaseConstraints = aCIter->second->constraints();
454     std::list<ConstraintPtr>::iterator anIter = aBaseConstraints.begin();
455     for (; anIter != aBaseConstraints.end(); anIter++)
456       if (aNewFeatStorage->isInteract(*anIter)) {
457         aNewFeatStorage->changeConstraint(*anIter);
458       } else
459         anUnusedConstraints.push_back(*anIter);
460   }
461
462   // Check the unused constraints once again, because they may become interacted with new storage since adding constraints
463   std::vector<ConstraintPtr>::iterator aUnuseIt = anUnusedConstraints.begin();
464   while (aUnuseIt != anUnusedConstraints.end()) {
465     if (aNewFeatStorage->isInteract(*aUnuseIt)) {
466       size_t aShift = aUnuseIt - anUnusedConstraints.begin();
467       anUnusedConstraints.erase(aUnuseIt);
468       aUnuseIt = anUnusedConstraints.begin() + aShift;
469       continue;
470     }
471     aUnuseIt++;
472   }
473
474   std::vector<SketchSolver_Group*>::iterator aCutsIter;
475   aUnuseIt = anUnusedConstraints.begin();
476   for ( ; aUnuseIt != anUnusedConstraints.end(); aUnuseIt++) {
477     // Remove unused constraints
478     removeConstraint(*aUnuseIt);
479     // Try to append constraint to already existent group
480     for (aCutsIter = theCuts.begin(); aCutsIter != theCuts.end(); aCutsIter++)
481       if ((*aCutsIter)->isInteract(*aUnuseIt)) {
482         (*aCutsIter)->changeConstraint(*aUnuseIt);
483         break;
484       }
485     if (aCutsIter == theCuts.end()) {
486       // Add new group
487       SketchSolver_Group* aGroup = new SketchSolver_Group(mySketch);
488       aGroup->changeConstraint(*aUnuseIt);
489       theCuts.push_back(aGroup);
490     }
491   }
492 }
493
494 // ============================================================================
495 //  Function: isConsistent
496 //  Class:    SketchSolver_Group
497 //  Purpose:  search removed entities and constraints
498 // ============================================================================
499 bool SketchSolver_Group::isConsistent()
500 {
501   if (!myFeatureStorage) // no one constraint is initialized yet
502     return true;
503
504   bool aResult = myFeatureStorage->isConsistent();
505   if (!aResult) {
506     // remove invalid entities
507     ConstraintConstraintMap::iterator aCIter = myConstraints.begin();
508     while (aCIter != myConstraints.end()) {
509       std::list<ConstraintPtr> aConstraints = aCIter->second->constraints();
510       std::list<ConstraintPtr>::iterator anIt = aConstraints.begin();
511       for (; anIt != aConstraints.end(); anIt++)
512         if (!(*anIt)->data() || !(*anIt)->data()->isValid())
513           if (aCIter->second->remove(*anIt)) {
514             // the constraint is fully removed, detach it from the list
515             ConstraintConstraintMap::iterator aTmpIt = aCIter++;
516             myFeatureStorage->removeConstraint(aTmpIt->first);
517             myConstraints.erase(aTmpIt);
518             break;
519           }
520       if (anIt == aConstraints.end())
521         aCIter++;
522     }
523   }
524   return aResult;
525 }
526
527 // ============================================================================
528 //  Function: removeTemporaryConstraints
529 //  Class:    SketchSolver_Group
530 //  Purpose:  remove all transient SLVS_C_WHERE_DRAGGED constraints after
531 //            resolving the set of constraints
532 // ============================================================================
533 void SketchSolver_Group::removeTemporaryConstraints()
534 {
535   myTempConstraints.clear();
536   myStorage->removeTemporaryConstraints();
537   // Clean lists of removed entities in the storage
538   std::set<Slvs_hParam> aRemPar;
539   std::set<Slvs_hEntity> aRemEnt;
540   std::set<Slvs_hConstraint> aRemCon;
541   myStorage->getRemoved(aRemPar, aRemEnt, aRemCon);
542   myStorage->setNeedToResolve(false);
543 }
544
545 // ============================================================================
546 //  Function: removeConstraint
547 //  Class:    SketchSolver_Group
548 //  Purpose:  remove constraint and all unused entities
549 // ============================================================================
550 void SketchSolver_Group::removeConstraint(ConstraintPtr theConstraint)
551 {
552   myFeatureStorage->removeConstraint(theConstraint);
553   ConstraintConstraintMap::iterator aCIter = myConstraints.begin();
554   for (; aCIter != myConstraints.end(); aCIter++)
555     if (aCIter->second->hasConstraint(theConstraint)) {
556       if (!aCIter->second->remove(theConstraint)) // the constraint is not fully removed
557         aCIter = myConstraints.end();
558       break;
559     }
560   if (aCIter != myConstraints.end())
561     myConstraints.erase(aCIter);
562 }
563
564 // ============================================================================
565 //  Function: isComplexConstraint
566 //  Class:    SketchSolver_Group
567 //  Purpose:  verifies the constraint is complex, i.e. it needs another constraints to be created before
568 // ============================================================================
569 bool SketchSolver_Group::isComplexConstraint(FeaturePtr theConstraint)
570 {
571   return theConstraint->getKind() == SketchPlugin_ConstraintFillet::ID() ||
572          theConstraint->getKind() == SketchPlugin_ConstraintMirror::ID() ||
573          theConstraint->getKind() == SketchPlugin_ConstraintTangent::ID();
574 }
575
576 // ============================================================================
577 //  Function: setTemporary
578 //  Class:    SketchSolver_Group
579 //  Purpose:  append given constraint to th group of temporary constraints
580 // ============================================================================
581 void SketchSolver_Group::setTemporary(SolverConstraintPtr theConstraint)
582 {
583   theConstraint->makeTemporary();
584   myTempConstraints.insert(theConstraint);
585 }
586