// should be the same to identify feature's name as automatically generated.
if (aNbFeatures == anId) {
// name is not user-defined
- aName.clear();
isDefaultName = true;
}
}
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<ResultPtr>& aResults = theFeature->results();
std::list<ResultPtr>::const_iterator aResIt = aResults.begin();
for (int i = 1; aResIt != aResults.end(); ++aResIt, ++i) {
++gCompositeStackDepth;
// dump composite itself
if (!isDumped(theComposite) || isForce)
- dumpFeature(theComposite, isForce);
+ dumpFeature(FeaturePtr(theComposite), isForce);
// sub-part is processed independently, because it provides separate document
if (theComposite->getKind() == PartSetPlugin_Part::ID()) {
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;
}