FeaturePtr aConstraint;
// Create coincidence features.
- aConstraint = SketchPlugin_Tools::createConstraint(sketch(),
+ aConstraint = SketchPlugin_Tools::createConstraintAttrAttr(sketch(),
SketchPlugin_ConstraintCoincidence::ID(),
aFilletArc->attribute(SketchPlugin_Arc::START_ID()),
myBaseFeatures[aFeatInd[0]]->attribute(myFeatAttributes[anAttrInd[0]]));
ModelAPI_EventCreator::get()->sendUpdated(aConstraint, anUpdateEvent);
- aConstraint = SketchPlugin_Tools::createConstraint(sketch(),
+ aConstraint = SketchPlugin_Tools::createConstraintAttrAttr(sketch(),
SketchPlugin_ConstraintCoincidence::ID(),
aFilletArc->attribute(SketchPlugin_Arc::END_ID()),
myBaseFeatures[aFeatInd[1]]->attribute(myFeatAttributes[anAttrInd[1]]));
// Create tangent features.
for (int i = 0; i < 2; i++) {
- aConstraint = SketchPlugin_Tools::createConstraint(sketch(),
+ aConstraint = SketchPlugin_Tools::createConstraintObjectObject(sketch(),
SketchPlugin_ConstraintTangent::ID(),
aFilletArc->lastResult(),
myBaseFeatures[i]->lastResult());
static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
FeaturePtr aConstraint;
for (int i = 0; i < 2; i++) {
- aConstraint = SketchPlugin_Tools::createConstraint(sketch(),
+ aConstraint = SketchPlugin_Tools::createConstraintAttrObject(sketch(),
SketchPlugin_ConstraintCoincidence::ID(),
aCoord,
myBaseFeatures[i]->lastResult());
FeaturePtr aConstraint;
std::list<Length>::iterator anIt = aLengthToDistance.begin();
for (; anIt != aLengthToDistance.end(); ++anIt) {
- aConstraint = SketchPlugin_Tools::createConstraint(sketch(),
+ aConstraint = SketchPlugin_Tools::createConstraintAttrAttr(sketch(),
SketchPlugin_ConstraintDistance::ID(), anIt->myPoints[0], anIt->myPoints[1]);
// set value
AttributeDoublePtr aValue = aConstraint->real(SketchPlugin_Constraint::VALUE());
}
if (aFeaturePointAttribute.get()) {
// create new constraint and remove the current
- aCoincFeature = SketchPlugin_Tools::createConstraint(sketch(),
+ aCoincFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(),
SketchPlugin_ConstraintCoincidence::ID(),
aFeaturePointAttribute, aCoincFeature->refattr(aSecondAttribute)->attr());
theFeaturesToDelete.insert(aCIt->first);
for (; aSFIt != aSFLast; aSFIt++) {
AttributePoint2DPtr aSFAttribute = *aSFIt;
if (aCoincPnt->isEqual(aSFAttribute->pnt())) {
- SketchPlugin_Tools::createConstraint(sketch(), SketchPlugin_ConstraintCoincidence::ID(),
+ SketchPlugin_Tools::createConstraintAttrAttr(sketch(),
+ SketchPlugin_ConstraintCoincidence::ID(),
aSFAttribute, aCoincFeature->refattr(aSecondAttribute)->attr());
}
}
aFeature->attribute(SketchPlugin_Line::END_ID())));
anNewFeature = aFeature;
}
- aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(),
+ aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(),
SketchPlugin_ConstraintCoincidence::ID(),
theSplitFeature->attribute(SketchPlugin_Line::END_ID()),
aFeature->attribute(SketchPlugin_Line::START_ID()));
fillAttribute(theBaseFeatureModified->attribute(SketchPlugin_Line::END_ID()),
aFirstPointAttrOfSplit);
theBaseFeatureModified->execute(); // to update result
- aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(),
+ aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(),
SketchPlugin_ConstraintCoincidence::ID(),
theBaseFeatureModified->attribute(SketchPlugin_Line::END_ID()),
theSplitFeature->attribute(SketchPlugin_Line::START_ID()));
aFeature->attribute(SketchPlugin_Arc::END_ID())));
anNewFeature = aFeature;
}
- aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(),
+ aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(),
SketchPlugin_ConstraintCoincidence::ID(),
theSplitFeature->attribute(SketchPlugin_Arc::END_ID()),
aFeature->attribute(SketchPlugin_Arc::START_ID()));
fillAttribute(theBaseFeatureModified->attribute(SketchPlugin_Arc::END_ID()),
aFirstPointAttrOfSplit);
theBaseFeatureModified->execute(); // to update result
- aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(),
+ aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(),
SketchPlugin_ConstraintCoincidence::ID(),
theBaseFeatureModified->attribute(SketchPlugin_Arc::END_ID()),
theSplitFeature->attribute(SketchPlugin_Arc::START_ID()));
(theBaseFeatureModified->attribute(SketchPlugin_Arc::END_ID())));
// additional constraints between split and base features
- aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(),
+ aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(),
SketchPlugin_ConstraintCoincidence::ID(),
theBaseFeatureModified->attribute(SketchPlugin_Arc::END_ID()),
theSplitFeature->attribute(SketchPlugin_Arc::END_ID()));
theCreatedFeatures.insert(aConstraintFeature);
- aConstraintFeature = SketchPlugin_Tools::createConstraint(sketch(),
+ aConstraintFeature = SketchPlugin_Tools::createConstraintAttrAttr(sketch(),
SketchPlugin_ConstraintCoincidence::ID(),
theBaseFeatureModified->attribute(SketchPlugin_Arc::START_ID()),
theSplitFeature->attribute(SketchPlugin_Arc::START_ID()));
}
-FeaturePtr createConstraint(SketchPlugin_Sketch* theSketch,
- const std::string& theConstraintId,
- const AttributePtr& theFirstAttribute,
- const AttributePtr& theSecondAttribute)
+FeaturePtr createConstraintAttrAttr(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>(
return aConstraint;
}
-FeaturePtr createConstraint(SketchPlugin_Sketch* theSketch,
- const std::string& theConstraintId,
- const AttributePtr& theFirstAttribute,
- const ObjectPtr& theSecondObject)
+FeaturePtr createConstraintAttrObject(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>(
return aConstraint;
}
-FeaturePtr createConstraint(SketchPlugin_Sketch* theSketch,
- const std::string& theConstraintId,
- const ObjectPtr& theFirstObject,
- const ObjectPtr& theSecondObject)
+FeaturePtr createConstraintObjectObject(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>(
/// \param[in] theConstraintId a constraint identifier
/// \param[in] theFirstAttribute an attribute of further constraint
/// \param[in] theSecondAttribute an attribute of further constraint
-FeaturePtr createConstraint(SketchPlugin_Sketch* theSketch,
- const std::string& theConstraintId,
- const AttributePtr& theFirstAttribute,
- const AttributePtr& theSecondAttribute);
+FeaturePtr createConstraintAttrAttr(SketchPlugin_Sketch* theSketch,
+ const std::string& theConstraintId,
+ const AttributePtr& theFirstAttribute,
+ const AttributePtr& theSecondAttribute);
/// Create new constraint between given attribute and object
/// \param[in] theSketch a sketch where the constraint will be created
/// \param[in] theConstraintId a constraint identifier
/// \param[in] theFirstAttribute an attribute of further constraint
/// \param[in] theSecondObject an attribute of further constraint
-FeaturePtr createConstraint(SketchPlugin_Sketch* theSketch,
- const std::string& theConstraintId,
- const AttributePtr& theFirstAttribute,
- const ObjectPtr& theSecondObject);
+FeaturePtr createConstraintAttrObject(SketchPlugin_Sketch* theSketch,
+ const std::string& theConstraintId,
+ const AttributePtr& theFirstAttribute,
+ const ObjectPtr& theSecondObject);
/// Create new constraint between given objects
/// \param[in] theSketch a sketch where the constraint will be created
/// \param[in] theConstraintId a constraint identifier
/// \param[in] theFirstObject an attribute of further constraint
/// \param[in] theSecondObject an attribute of further constraint
-FeaturePtr createConstraint(SketchPlugin_Sketch* theSketch,
- const std::string& theConstraintId,
- const ObjectPtr& theFirstObject,
- const ObjectPtr& theSecondObject);
+FeaturePtr createConstraintObjectObject(SketchPlugin_Sketch* theSketch,
+ const std::string& theConstraintId,
+ const ObjectPtr& theFirstObject,
+ const ObjectPtr& theSecondObject);
/// Creates coincidence or tangent constraint.
/// \param[in] theFeature to get selected attribute or object
const std::list<ObjectPtr>& anObjects = anInfo.second;
for (std::list<ObjectPtr>::const_iterator anObjectIt = anObjects.begin();
anObjectIt != anObjects.end(); anObjectIt++) {
- SketchPlugin_Tools::createConstraint(sketch(), SketchPlugin_ConstraintCoincidence::ID(),
- aPointAttribute, *anObjectIt);
+ SketchPlugin_Tools::createConstraintAttrObject(sketch(),
+ SketchPlugin_ConstraintCoincidence::ID(),
+ aPointAttribute, *anObjectIt);
}
}
std::shared_ptr<GeomAPI_Pnt2d> aPoint2d = aPointAttribute->pnt();
if (aPoint2d->isEqual(aRefPnt2d)) {
// create new coincidence and then remove the old one
- SketchPlugin_Tools::createConstraint(sketch(), SketchPlugin_ConstraintCoincidence::ID(),
- aRefPointAttr, aPointAttribute);
+ SketchPlugin_Tools::createConstraintAttrAttr(sketch(),
+ SketchPlugin_ConstraintCoincidence::ID(),
+ aRefPointAttr, aPointAttribute);
theFeaturesToDelete.insert(aFeature);
}
}
(aBaseFeature->attribute(aModifiedAttribute)));
// Collinear constraint for lines
- SketchPlugin_Tools::createConstraint(sketch(), SketchPlugin_ConstraintCollinear::ID(),
+ SketchPlugin_Tools::createConstraintObjectObject(sketch(),
+ SketchPlugin_ConstraintCollinear::ID(),
getFeatureResult(aBaseFeature),
getFeatureResult(anNewFeature));
}
(aBaseFeature->attribute(aModifiedAttribute)));
// equal Radius constraint for arcs
- SketchPlugin_Tools::createConstraint(sketch(), SketchPlugin_ConstraintEqual::ID(),
+ SketchPlugin_Tools::createConstraintObjectObject(sketch(),
+ SketchPlugin_ConstraintEqual::ID(),
getFeatureResult(aBaseFeature),
getFeatureResult(anNewFeature));
// coincident centers constraint
- SketchPlugin_Tools::createConstraint(sketch(), SketchPlugin_ConstraintCoincidence::ID(),
+ SketchPlugin_Tools::createConstraintAttrAttr(sketch(),
+ SketchPlugin_ConstraintCoincidence::ID(),
aBaseFeature->attribute(SketchPlugin_Arc::CENTER_ID()),
anNewFeature->attribute(SketchPlugin_Arc::CENTER_ID()));