+
+FeaturePtr createConstraint(SketchPlugin_Sketch* theSketch,
+ const std::string& theConstraintId,
+ const AttributePtr& theFirstAttribute,
+ const AttributePtr& theSecondAttribute)
+{
+ FeaturePtr aConstraint = theSketch->addFeature(theConstraintId);
+ AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
+ aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A()));
+ aRefAttr->setAttr(theFirstAttribute);
+
+ aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
+ aConstraint->attribute(SketchPlugin_Constraint::ENTITY_B()));
+ aRefAttr->setAttr(theSecondAttribute);
+
+#if defined(DEBUG_TRIM) || defined(DEBUG_SPLIT)
+ std::cout << "<createConstraint to attribute> :"
+ << " first attribute - " << theFirstAttribute->id()
+ << " second attribute - " << theSecondAttribute->id()
+ << std::endl;
+#endif
+
+ return aConstraint;
+}
+
+FeaturePtr createConstraint(SketchPlugin_Sketch* theSketch,
+ const std::string& theConstraintId,
+ const AttributePtr& theFirstAttribute,
+ const ObjectPtr& theSecondObject)
+{
+ FeaturePtr aConstraint = theSketch->addFeature(theConstraintId);
+ AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
+ aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A()));
+ aRefAttr->setAttr(theFirstAttribute);
+
+ aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
+ aConstraint->attribute(SketchPlugin_Constraint::ENTITY_B()));
+ aRefAttr->setObject(theSecondObject);
+
+#if defined(DEBUG_TRIM) || defined(DEBUG_SPLIT)
+ std::cout << "<createConstraint to attribute> :"
+ << " first attribute - " << theFirstAttribute->id()
+ << " second object - " << ModelAPI_Feature::feature(theSecondObject)->getKind()
+ << std::endl;
+#endif
+
+ return aConstraint;
+}
+
+FeaturePtr createConstraint(SketchPlugin_Sketch* theSketch,
+ const std::string& theConstraintId,
+ const ObjectPtr& theFirstObject,
+ const ObjectPtr& theSecondObject)
+{
+ FeaturePtr aConstraint = theSketch->addFeature(theConstraintId);
+ AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
+ aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A()));
+ aRefAttr->setObject(theFirstObject);
+
+ aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
+ aConstraint->attribute(SketchPlugin_Constraint::ENTITY_B()));
+ aRefAttr->setObject(theSecondObject);
+
+#if defined(DEBUG_TRIM) || defined(DEBUG_SPLIT)
+ std::cout << "<createConstraint to attribute> :"
+ << " first object - " << ModelAPI_Feature::feature(theFirstObject)->getKind()
+ << " second object - " << ModelAPI_Feature::feature(theSecondObject)->getKind()
+ << std::endl;
+#endif
+
+ return aConstraint;
+}
+