From b01079bc3921b46c818b7898b795b286ed04fb4b Mon Sep 17 00:00:00 2001 From: dbv Date: Wed, 10 Aug 2016 17:34:18 +0300 Subject: [PATCH] Issue #1648: Dump Python in the High Level Parameterized Geometry API Fix for dump FeaturesAPI_Extrusion with nested sketch --- src/FeaturesAPI/FeaturesAPI_Extrusion.cpp | 6 ++++-- src/FeaturesAPI/FeaturesAPI_Extrusion.h | 9 ++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/FeaturesAPI/FeaturesAPI_Extrusion.cpp b/src/FeaturesAPI/FeaturesAPI_Extrusion.cpp index 75635c73d..525bddd1c 100644 --- a/src/FeaturesAPI/FeaturesAPI_Extrusion.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Extrusion.cpp @@ -179,10 +179,13 @@ void FeaturesAPI_Extrusion::dump(ModelHighAPI_Dumper& theDumper) const FeaturePtr aBase = feature(); const std::string& aDocName = theDumper.name(aBase->document()); + AttributeReferencePtr anAttrSketch = aBase->reference(FeaturesPlugin_CompositeSketch::SKETCH_ID()); AttributeSelectionListPtr anAttrObjects = aBase->selectionList(FeaturesPlugin_Extrusion::BASE_OBJECTS_ID()); AttributeSelectionPtr anAttrDirection = aBase->selection(FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID()); - theDumper << aBase << " = model.addExtrusion(" << aDocName << ", " << anAttrObjects << ", " << anAttrDirection; + theDumper << aBase << " = model.addExtrusion(" << aDocName << ", "; + anAttrSketch->isInitialized() ? theDumper << "[]" : theDumper << anAttrObjects; + theDumper << ", " << anAttrDirection; std::string aCreationMethod = aBase->string(FeaturesPlugin_Extrusion::CREATION_METHOD())->value(); @@ -202,7 +205,6 @@ void FeaturesAPI_Extrusion::dump(ModelHighAPI_Dumper& theDumper) const theDumper << ")" << std::endl; - AttributeReferencePtr anAttrSketch = aBase->reference(FeaturesPlugin_CompositeSketch::SKETCH_ID()); if(anAttrSketch->isInitialized()) { theDumper << aBase << ".setNestedSketch(" << anAttrSketch << ")"; } diff --git a/src/FeaturesAPI/FeaturesAPI_Extrusion.h b/src/FeaturesAPI/FeaturesAPI_Extrusion.h index e4a31b18c..9350d9817 100644 --- a/src/FeaturesAPI/FeaturesAPI_Extrusion.h +++ b/src/FeaturesAPI/FeaturesAPI_Extrusion.h @@ -78,18 +78,17 @@ public: FEATURESAPI_EXPORT virtual ~FeaturesAPI_Extrusion(); - INTERFACE_11(FeaturesPlugin_Extrusion::ID(), - sketch, FeaturesPlugin_Extrusion::SKETCH_ID(), ModelAPI_AttributeReference, /** Sketch object */, + INTERFACE_10(FeaturesPlugin_Extrusion::ID(), + sketch, FeaturesPlugin_Extrusion::SKETCH_ID(), ModelAPI_AttributeReference, /** Sketch launcher */, baseObjects, FeaturesPlugin_Extrusion::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */, + direction, FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(), ModelAPI_AttributeSelection, /** Direction */, creationMethod, FeaturesPlugin_Extrusion::CREATION_METHOD(), ModelAPI_AttributeString, /** Creation method */, toSize, FeaturesPlugin_Extrusion::TO_SIZE_ID(), ModelAPI_AttributeDouble, /** To size */, fromSize, FeaturesPlugin_Extrusion::FROM_SIZE_ID(), ModelAPI_AttributeDouble, /** From size */, toObject, FeaturesPlugin_Extrusion::TO_OBJECT_ID(), ModelAPI_AttributeSelection, /** To object */, toOffset, FeaturesPlugin_Extrusion::TO_OFFSET_ID(), ModelAPI_AttributeDouble, /** To offset */, fromObject, FeaturesPlugin_Extrusion::FROM_OBJECT_ID(), ModelAPI_AttributeSelection, /** From object */, - fromOffset, FeaturesPlugin_Extrusion::FROM_OFFSET_ID(), ModelAPI_AttributeDouble, /** From offset */, - direction, FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(), ModelAPI_AttributeSelection, /** Direction */, - sketchLauncher, FeaturesPlugin_Extrusion::SKETCH_ID(), ModelAPI_AttributeReference, /** Sketch launcher */) + fromOffset, FeaturesPlugin_Extrusion::FROM_OFFSET_ID(), ModelAPI_AttributeDouble, /** From offset */) /// Modify base attribute of the feature. FEATURESAPI_EXPORT -- 2.39.2