-// Copyright (C) 2014-2020 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
void Model_Objects::storeResult(std::shared_ptr<ModelAPI_Data> theFeatureData,
std::shared_ptr<ModelAPI_Result> theResult,
- const int theResultIndex)
+ const int theResultIndex,
+ const std::wstring& theNameShape)
{
theResult->init();
theResult->setDoc(myDoc);
theResult->data()->setName(L"");
} else {
std::wstringstream aName;
- aName << aNewName;
- // if there are several results (issue #899: any number of result),
- // add unique prefix starting from second
- if (theResultIndex > 0 || theResult->groupName() == ModelAPI_ResultBody::group())
- aName << "_" << theResultIndex + 1;
+ if ( theNameShape != L"" ){
+ aName << theNameShape;
+ } else {
+ aName << aNewName;
+ // if there are several results (issue #899: any number of result),
+ // add unique prefix starting from second
+ if (theResultIndex > 0 || theResult->groupName() == ModelAPI_ResultBody::group())
+ aName << "_" << theResultIndex + 1;
+ }
aNewName = aName.str();
}
theResult->data()->setName(aNewName);
}
std::shared_ptr<ModelAPI_ResultBody> Model_Objects::createBody(
- const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData,
+ const int theIndex,
+ const std::wstring& theNameShape)
{
TDF_Label aLab = resultLabel(theFeatureData, theIndex);
TDataStd_Comment::Set(aLab, ModelAPI_ResultBody::group().c_str());
}
if (!aResult.get()) {
aResult = std::shared_ptr<ModelAPI_ResultBody>(new Model_ResultBody);
- storeResult(theFeatureData, aResult, theIndex);
+ storeResult(theFeatureData, aResult, theIndex, theNameShape);
}
return aResult;
}
}
} else if (aGroup->Get() == ModelAPI_ResultConstruction::group().c_str()) {
ResultConstructionPtr aConstr = createConstruction(theFeature->data(), aResIndex);
- if (!aConstr->updateShape())
- theFeature->execute(); // not stored shape in the data structure, execute to have it
- else
- theFeature->setResult(aConstr, aResIndex); // result is ready without execution
+ if (!aConstr->data()->isDeleted()) {
+ if (!aConstr->updateShape())
+ theFeature->execute(); // not stored shape in the data structure, execute to have it
+ else
+ theFeature->setResult(aConstr, aResIndex); // result is ready without execution
+ }
} else if (aGroup->Get() == ModelAPI_ResultGroup::group().c_str()) {
aNewBody = createGroup(theFeature->data(), aResIndex);
} else if (aGroup->Get() == ModelAPI_ResultField::group().c_str()) {