X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchAPI%2FSketchAPI_Arc.cpp;h=628e43238efb0e887ea83ca98c464b6e22934870;hb=9baaa9343a9d1c026a6467ec2a864c2c317ab91b;hp=438c28d9ff094c2e7208ce93e499adfd444228ce;hpb=7f3b57915287757d4f5d7db281c3867ac00f5f6a;p=modules%2Fshaper.git diff --git a/src/SketchAPI/SketchAPI_Arc.cpp b/src/SketchAPI/SketchAPI_Arc.cpp index 438c28d9f..628e43238 100644 --- a/src/SketchAPI/SketchAPI_Arc.cpp +++ b/src/SketchAPI/SketchAPI_Arc.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -232,3 +233,37 @@ void SketchAPI_Arc::setAngle(double theAngle) execute(); } + +//================================================================================================== +void SketchAPI_Arc::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()) { + // arc is external + theDumper << aBase << " = " << aSketchName << ".addArc(" << anExternal << ")" << std::endl; + } else { + AttributeStringPtr aType = arcType(); + if (aType->value() == SketchPlugin_Arc::ARC_TYPE_CENTER_START_END()) { + // arc given by center and start, end points + theDumper << aBase << " = " << aSketchName << ".addArc(" << center() << ", " + << startPoint() << ", " << endPoint() << ", " << inversed() << ")" << std::endl; + } else if (aType->value() == SketchPlugin_Arc::ARC_TYPE_THREE_POINTS()) { + // arc given by three points + theDumper << aBase << " = " << aSketchName << ".addArc(" << startPoint() << ", " + << endPoint() << ", " << passedPoint() << ")" << std::endl; + } else { + // tangent arc + AttributeRefAttrPtr aTangentPoint = tangentPoint(); + theDumper << aBase << " = " << aSketchName << ".addArc(" + << aTangentPoint << ", " << endPoint() << ", " << inversed() << ")" << std::endl; + } + } + // dump "auxiliary" flag if necessary + SketchAPI_SketchEntity::dump(theDumper); +}