From: nds Date: Fri, 31 Oct 2014 08:25:12 +0000 (+0300) Subject: refs #221: constraint defining fixed object - selection of object is wrong X-Git-Tag: V_0.5~54 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=40b0af1c45bd2633880349a5773469b399a5655a;p=modules%2Fshaper.git refs #221: constraint defining fixed object - selection of object is wrong --- diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp b/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp index c9763327e..1b02335df 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp @@ -6,6 +6,9 @@ #include +#include +#include + SketchPlugin_ConstraintRigid::SketchPlugin_ConstraintRigid() { } @@ -27,16 +30,27 @@ AISObjectPtr SketchPlugin_ConstraintRigid::getAISObject(AISObjectPtr thePrevious boost::shared_ptr aData = data(); boost::shared_ptr anAttr = boost::dynamic_pointer_cast< ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A())); - if (!anAttr || !anAttr->isObject()) - return thePrevious; - - boost::shared_ptr aConst = - boost::dynamic_pointer_cast(anAttr->object()); - if (!aConst) + if (!anAttr /*|| !anAttr->isObject()*/) return thePrevious; boost::shared_ptr aShape; - aShape = aConst->shape(); + + if (anAttr->isObject()) { + boost::shared_ptr aConst; + aConst = boost::dynamic_pointer_cast(anAttr->object()); + + if (!aConst) + return thePrevious; + aShape = aConst->shape(); + } + else { + boost::shared_ptr aPointAttr = + boost::dynamic_pointer_cast(anAttr->attr()); + if (!aPointAttr) + return thePrevious; + boost::shared_ptr aPoint(sketch()->to3D(aPointAttr->x(), aPointAttr->y())); + aShape = GeomAlgoAPI_PointBuilder::point(aPoint); + } AISObjectPtr anAIS = thePrevious; if (!anAIS) diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index 9e212a4fa..14deb7083 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -94,11 +94,11 @@ - + - +