X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchAPI%2FSketchAPI_Circle.cpp;h=9cac0bd31cbf58bee789d7d87dd9fe9d78f92ba7;hb=42de443bf267cba7278df5dd4ae8a5f19612bd25;hp=e05e767082e6a8dd360acb1438e296e651964f17;hpb=6818377f7ba4581d1c5bca434ac59b0ada3853d6;p=modules%2Fshaper.git diff --git a/src/SketchAPI/SketchAPI_Circle.cpp b/src/SketchAPI/SketchAPI_Circle.cpp index e05e76708..9cac0bd31 100644 --- a/src/SketchAPI/SketchAPI_Circle.cpp +++ b/src/SketchAPI/SketchAPI_Circle.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -97,7 +98,7 @@ void SketchAPI_Circle::setByCenterAndRadius(double theCenterX, double theCenterY { fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType); fillAttribute(center(), theCenterX, theCenterY); - fillAttribute(ModelHighAPI_Double(theRadius), myradius); + fillAttribute(theRadius, myradius); execute(); } @@ -108,7 +109,7 @@ void SketchAPI_Circle::setByCenterAndRadius(const std::shared_ptr { fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType); fillAttribute(theCenter, mycenter); - fillAttribute(ModelHighAPI_Double(theRadius), myradius); + fillAttribute(theRadius, myradius); execute(); } @@ -235,3 +236,32 @@ void SketchAPI_Circle::setThirdPoint(const std::shared_ptr& thePo execute(); } + +//================================================================================================== +void SketchAPI_Circle::dump(ModelHighAPI_Dumper& theDumper) const +{ + if (isCopy()) + return; // no need to dump copied feature + + FeaturePtr aBase = feature(); + const std::string& aSketchName = theDumper.parentName(aBase); + + AttributeSelectionPtr anExternal = aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + if (anExternal->context()) { + // circle is external + theDumper << aBase << " = " << aSketchName << ".addCircle(" << anExternal << ")" << std::endl; + } else { + AttributeStringPtr aType = circleType(); + if (aType->value() == SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS()) { + // circle given by center and radius + theDumper << aBase << " = " << aSketchName << ".addCircle(" + << center() << ", " << radius() << ")" << std::endl; + } else { + // circle given by three points + theDumper << aBase << " = " << aSketchName << ".addCircle(" << firstPoint() << ", " + << secondPoint() << ", " << thirdPoint() << ")" << std::endl; + } + } + // dump "auxiliary" flag if necessary + SketchAPI_SketchEntity::dump(theDumper); +}