From 342f686d7becb1fb8a84492e324d34106feae46d Mon Sep 17 00:00:00 2001 From: dbv Date: Tue, 20 Sep 2016 17:24:13 +0300 Subject: [PATCH] Fix for dump SketchAPI_Projection and for FeaturesAPI_Recover --- src/FeaturesAPI/FeaturesAPI_Recover.cpp | 3 ++- src/SketchAPI/SketchAPI_Projection.cpp | 15 +++++++++++++++ src/SketchAPI/SketchAPI_Projection.h | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/FeaturesAPI/FeaturesAPI_Recover.cpp b/src/FeaturesAPI/FeaturesAPI_Recover.cpp index efc80327b..368f54a4d 100644 --- a/src/FeaturesAPI/FeaturesAPI_Recover.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Recover.cpp @@ -37,7 +37,8 @@ FeaturesAPI_Recover::~FeaturesAPI_Recover() //================================================================================================= void FeaturesAPI_Recover::setBaseFeature(const ModelHighAPI_Reference& theBaseFeature) { - fillAttribute(theBaseFeature, mybaseFeature); + + fillAttribute(theBaseFeature.feature(), mybaseFeature); // do not need to execute because on attribute changed it does everything anyway } diff --git a/src/SketchAPI/SketchAPI_Projection.cpp b/src/SketchAPI/SketchAPI_Projection.cpp index 3a2f45702..b0bb46b55 100644 --- a/src/SketchAPI/SketchAPI_Projection.cpp +++ b/src/SketchAPI/SketchAPI_Projection.cpp @@ -58,6 +58,15 @@ void SketchAPI_Projection::setByExternalName(const std::string& theExternalName) execute(); } +//-------------------------------------------------------------------------------------- +std::shared_ptr SketchAPI_Projection::createdFeature() const +{ + AttributeRefAttrPtr aProjectedRefAttr = projectedFeature(); + FeaturePtr aProjectedFeature = ModelAPI_Feature::feature(aProjectedRefAttr->object()); + + return std::shared_ptr(new ModelHighAPI_Interface(aProjectedFeature)); +} + //-------------------------------------------------------------------------------------- void SketchAPI_Projection::dump(ModelHighAPI_Dumper& theDumper) const @@ -69,4 +78,10 @@ void SketchAPI_Projection::dump(ModelHighAPI_Dumper& theDumper) const theDumper << aBase << " = " << aSketchName << ".addProjection(" << anExternal << ")" << std::endl; // dump "auxiliary" flag if necessary SketchAPI_SketchEntity::dump(theDumper); + + // Dump created line feature + AttributeRefAttrPtr aProjectedRefAttr = projectedFeature(); + FeaturePtr aProjectedFeature = ModelAPI_Feature::feature(aProjectedRefAttr->object()); + std::string aProjectedName = theDumper.name(aProjectedFeature, false); + theDumper << aProjectedName << " = " << theDumper.name(aBase) << ".createdFeature()" << std::endl; } diff --git a/src/SketchAPI/SketchAPI_Projection.h b/src/SketchAPI/SketchAPI_Projection.h index 59508e767..4a573843b 100644 --- a/src/SketchAPI/SketchAPI_Projection.h +++ b/src/SketchAPI/SketchAPI_Projection.h @@ -52,6 +52,10 @@ public: SKETCHAPI_EXPORT void setByExternalName(const std::string & theExternalName); + /// Returns created feature + SKETCHAPI_EXPORT + std::shared_ptr createdFeature() const; + /// Dump wrapped feature SKETCHAPI_EXPORT virtual void dump(ModelHighAPI_Dumper& theDumper) const; -- 2.39.2