]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for dump SketchAPI_Projection and for FeaturesAPI_Recover
authordbv <dbv@opencascade.com>
Tue, 20 Sep 2016 14:24:13 +0000 (17:24 +0300)
committerdbv <dbv@opencascade.com>
Tue, 20 Sep 2016 14:24:13 +0000 (17:24 +0300)
src/FeaturesAPI/FeaturesAPI_Recover.cpp
src/SketchAPI/SketchAPI_Projection.cpp
src/SketchAPI/SketchAPI_Projection.h

index efc80327bd5a25daba989a2bed38fbb88546f77d..368f54a4d82170b16530ccabd414f6e00e307500 100644 (file)
@@ -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
 }
 
index 3a2f457025483a0150cd9e878d5f30b14a492655..b0bb46b5593b07999dd6cf8ca3a4c2651b19c892 100644 (file)
@@ -58,6 +58,15 @@ void SketchAPI_Projection::setByExternalName(const std::string& theExternalName)
   execute();
 }
 
+//--------------------------------------------------------------------------------------
+std::shared_ptr<ModelHighAPI_Interface> SketchAPI_Projection::createdFeature() const
+{
+  AttributeRefAttrPtr aProjectedRefAttr = projectedFeature();
+  FeaturePtr aProjectedFeature = ModelAPI_Feature::feature(aProjectedRefAttr->object());
+
+  return std::shared_ptr<ModelHighAPI_Interface>(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;
 }
index 59508e767a1fea46bf378ffd159d97264777a9d1..4a573843b0d74d712d125b3a63669fc5256cc8b6 100644 (file)
@@ -52,6 +52,10 @@ public:
   SKETCHAPI_EXPORT
   void setByExternalName(const std::string & theExternalName);
 
+  /// Returns created feature
+  SKETCHAPI_EXPORT
+  std::shared_ptr<ModelHighAPI_Interface> createdFeature() const;
+
   /// Dump wrapped feature
   SKETCHAPI_EXPORT
   virtual void dump(ModelHighAPI_Dumper& theDumper) const;