From: mpv Date: Thu, 9 Apr 2015 09:30:52 +0000 (+0300) Subject: Make external arc possible to create and manipulate X-Git-Tag: V_1.1.0~52^2~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b67c6daf990a0edffeb41739fcd59da49136b39d;p=modules%2Fshaper.git Make external arc possible to create and manipulate --- diff --git a/src/SketchPlugin/SketchPlugin_Arc.cpp b/src/SketchPlugin/SketchPlugin_Arc.cpp index 026266a30..5599f3b0b 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.cpp +++ b/src/SketchPlugin/SketchPlugin_Arc.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -209,14 +210,28 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID) { std::shared_ptr aCenterAttr = std::dynamic_pointer_cast< GeomDataAPI_Point2D>(data()->attribute(CENTER_ID())); - if (!aCenterAttr->isInitialized()) - return; std::shared_ptr aStartAttr = std::dynamic_pointer_cast< GeomDataAPI_Point2D>(data()->attribute(START_ID())); - if (!aStartAttr->isInitialized()) - return; std::shared_ptr anEndAttr = std::dynamic_pointer_cast< GeomDataAPI_Point2D>(data()->attribute(END_ID())); + if (theID == EXTERNAL_ID()) { + std::shared_ptr aSelection = data()->selection(EXTERNAL_ID())->value(); + // update arguments due to the selection value + if (aSelection && !aSelection->isNull() && aSelection->isEdge()) { + std::shared_ptr anEdge( new GeomAPI_Edge(aSelection)); + std::shared_ptr aCirc = anEdge->circle(); + if (aCirc.get()) { + aStartAttr->setValue(sketch()->to2D(anEdge->firstPoint())); + anEndAttr->setValue(sketch()->to2D(anEdge->lastPoint())); + aCenterAttr->setValue(sketch()->to2D(aCirc->center())); + } + } + return; + } + if (!aCenterAttr->isInitialized()) + return; + if (!aStartAttr->isInitialized()) + return; if (!anEndAttr->isInitialized()) return;