From: nds Date: Tue, 24 Jun 2014 16:52:03 +0000 (+0400) Subject: refs #80 - Sketch base GUI: create/draw point, circle and arc X-Git-Tag: V_0.4.4~248 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=93fd972ef11ad5c19797b011ce6929a215ddd6ea;p=modules%2Fshaper.git refs #80 - Sketch base GUI: create/draw point, circle and arc Radius constraint initalization of constraint value. --- diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp index b6a32df94..645ecbf69 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp @@ -40,14 +40,20 @@ void SketchPlugin_ConstraintRadius::execute() FeaturePtr aFeature = aRef->feature(); if (aFeature) { double aRadius = 0; + boost::shared_ptr aData = aFeature->data(); if (aFeature->getKind() == SKETCH_CIRCLE_KIND) { AttributeDoublePtr anAttribute = boost::dynamic_pointer_cast - (aFeature->data()->attribute(CIRCLE_ATTR_RADIUS)); + (aData->attribute(CIRCLE_ATTR_RADIUS)); if (anAttribute) aRadius = anAttribute->value(); } else if (aFeature->getKind() == SKETCH_ARC_KIND) { - //aLength = PartSet_FeatureArcPrs::radius(theFeature); + boost::shared_ptr aCenterAttr = + boost::dynamic_pointer_cast(aData->attribute(ARC_ATTR_CENTER)); + boost::shared_ptr aStartAttr = + boost::dynamic_pointer_cast(aData->attribute(ARC_ATTR_START)); + if (aCenterAttr && aStartAttr) + aRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt()); } boost::shared_ptr aValueAttr = boost::dynamic_pointer_cast(data()->attribute(CONSTRAINT_ATTR_VALUE));