X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelHighAPI%2FModelHighAPI_Dumper.cpp;h=c2ae64971f3a46d898f999a93937f4de45c5a959;hb=b0e217e6399717e35fcfe2ada28dd6c5213d3721;hp=fe2875f8c32430df114982c5479d935c664b8ab8;hpb=268de14fe8b857dd33fafb349386be6e3fb4caf5;p=modules%2Fshaper.git diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp index fe2875f8c..c2ae64971 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp @@ -111,7 +111,6 @@ const std::string& ModelHighAPI_Dumper::name(const EntityPtr& theEntity, // should be the same to identify feature's name as automatically generated. if (aNbFeatures == anId) { // name is not user-defined - aName.clear(); isDefaultName = true; } } @@ -159,7 +158,15 @@ const std::string& ModelHighAPI_Dumper::parentName(const FeaturePtr& theEntity) void ModelHighAPI_Dumper::saveResultNames(const FeaturePtr& theFeature) { - const std::string& aFeatureName = myNames[theFeature].myCurrentName; + // Default name of the feature + const std::string& aKind = theFeature->getKind(); + DocumentPtr aDoc = theFeature->document(); + int aNbFeatures = myFeatureCount[aDoc][aKind]; + std::ostringstream aNameStream; + aNameStream << aKind << "_" << aNbFeatures; + std::string aFeatureName = aNameStream.str(); + + // Save only names of results which is not correspond to default feature name const std::list& aResults = theFeature->results(); std::list::const_iterator aResIt = aResults.begin(); for (int i = 1; aResIt != aResults.end(); ++aResIt, ++i) { @@ -218,7 +225,7 @@ bool ModelHighAPI_Dumper::process(const std::shared_ptrgetKind() == PartSetPlugin_Part::ID()) { @@ -603,7 +610,19 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const ObjectPtr& theObject) ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const AttributePtr& theAttr) { FeaturePtr anOwner = ModelAPI_Feature::feature(theAttr->owner()); - myDumpBuffer << name(anOwner) << "." << attributeGetter(anOwner, theAttr->id()) << "()"; + + std::string aWrapperPrefix, aWrapperSuffix; + // Check the attribute belongs to copied (in multi-translation or multi-rotation) feature. + // In this case we need to cast explicitly feature to appropriate type. + AttributeBooleanPtr isCopy = anOwner->boolean("Copy"); + if (isCopy.get() && isCopy->value()) { + aWrapperPrefix = featureWrapper(anOwner) + "("; + aWrapperSuffix = ")"; + importModule("SketchAPI"); + } + + myDumpBuffer << aWrapperPrefix << name(anOwner) << aWrapperSuffix + << "." << attributeGetter(anOwner, theAttr->id()) << "()"; return *this; }