X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FSketchPlugin%2FSketchPlugin_ConstraintRigid.cpp;h=8867e16d55932720530b9e6e0ea9dde72eeb88b6;hb=d4ec34025812615d1aa16679db0c5a151b2a2abe;hp=6695a8813dd8f0b0b7b1be6929734e6e05d8be75;hpb=0f0ed262e58309bcd9e5a1cb8415523821051d8d;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp b/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp index 6695a8813..8867e16d5 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp @@ -6,6 +6,7 @@ #include "SketchPlugin_ConstraintRigid.h" #include "SketchPlugin_ConstraintParallel.h" +#include "SketchPlugin_Feature.h" #include @@ -21,7 +22,7 @@ SketchPlugin_ConstraintRigid::SketchPlugin_ConstraintRigid() void SketchPlugin_ConstraintRigid::initAttributes() { - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::type()); + data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); } void SketchPlugin_ConstraintRigid::execute() @@ -34,8 +35,18 @@ AISObjectPtr SketchPlugin_ConstraintRigid::getAISObject(AISObjectPtr thePrevious return thePrevious; AISObjectPtr anAIS = thePrevious; - if (!anAIS) { - anAIS = SketcherPrs_Factory::rigidConstraint(this, sketch()->coordinatePlane()); + if (anAIS.get() == NULL) { + std::shared_ptr aData = data(); + std::shared_ptr anAttr = + std::dynamic_pointer_cast(aData->attribute(SketchPlugin_Constraint::ENTITY_A())); + ObjectPtr aObj = anAttr->object(); + if (aObj.get() != NULL) { + FeaturePtr aFeature = ModelAPI_Feature::feature(aObj); + std::shared_ptr aSkFea = + std::dynamic_pointer_cast(aFeature); + if (!aSkFea->isExternal()) + anAIS = SketcherPrs_Factory::rigidConstraint(this, sketch()->coordinatePlane()); + } } return anAIS;