#include <TDataStd_Integer.hxx>
#include <TDataStd_Comment.hxx>
+#include <TDataStd_UAttribute.hxx>
#include <TDF_ChildIDIterator.hxx>
#include <TDataStd_ReferenceArray.hxx>
#include <TDataStd_HLabelArray1.hxx>
}
}
+static const Standard_GUID ID_CONSTRUCTION("b59fa408-8ab1-42b8-980c-af5adeebe7e4");
+static const Standard_GUID ID_BODY("c1148e9a-9b17-4e9c-9160-18e918fd0013");
+static const Standard_GUID ID_PART("1b3319b9-3e0a-4298-a1dc-3fb5aaf9be59");
+
boost::shared_ptr<ModelAPI_ResultConstruction> Model_Document::createConstruction(
const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
{
- ObjectPtr anOldObject = object(resultLabel(theFeatureData, theIndex));
+ TDF_Label aLab = resultLabel(theFeatureData, theIndex);
+ TDataStd_UAttribute::Set(aLab, ID_CONSTRUCTION);
+ ObjectPtr anOldObject = object(aLab);
boost::shared_ptr<ModelAPI_ResultConstruction> aResult;
if (anOldObject) {
aResult = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(anOldObject);
boost::shared_ptr<ModelAPI_ResultBody> Model_Document::createBody(
const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
{
- ObjectPtr anOldObject = object(resultLabel(theFeatureData, theIndex));
+ TDF_Label aLab = resultLabel(theFeatureData, theIndex);
+ TDataStd_UAttribute::Set(aLab, ID_BODY);
+ ObjectPtr anOldObject = object(aLab);
boost::shared_ptr<ModelAPI_ResultBody> aResult;
if (anOldObject) {
aResult = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(anOldObject);
boost::shared_ptr<ModelAPI_ResultPart> Model_Document::createPart(
const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
{
- ObjectPtr anOldObject = object(resultLabel(theFeatureData, theIndex));
+ TDF_Label aLab = resultLabel(theFeatureData, theIndex);
+ TDataStd_UAttribute::Set(aLab, ID_PART);
+ ObjectPtr anOldObject = object(aLab);
boost::shared_ptr<ModelAPI_ResultPart> aResult;
if (anOldObject) {
aResult = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(anOldObject);
int aResSize = theFeature->results().size();
TDF_ChildIterator aLabIter(resultLabel(theFeature->data(), 0).Father());
for(; aLabIter.More(); aLabIter.Next()) {
- // here must be at least Name
+ // here must be GUID of the feature
int aResIndex = aLabIter.Value().Tag() - 1;
- if (aLabIter.Value().FindChild(TAG_FEATURE_ARGUMENTS).HasAttribute() &&
- aResSize <= aResIndex)
- {
- ResultBodyPtr aNewBody = createBody(theFeature->data(), aResIndex);
- theFeature->setResult(aNewBody, aResIndex);
+ ResultPtr aNewBody;
+ if (aResSize <= aResIndex) {
+ TDF_Label anArgLab = aLabIter.Value();
+ if (anArgLab.IsAttribute(ID_BODY)) {
+ aNewBody = createBody(theFeature->data(), aResIndex);
+ } else if (anArgLab.IsAttribute(ID_PART)) {
+ aNewBody = createPart(theFeature->data(), aResIndex);
+ } else if (!anArgLab.IsAttribute(ID_CONSTRUCTION)) {
+ Events_Error::send("Unknown type of result if found in the document");
+ }
+ if (aNewBody) {
+ theFeature->setResult(aNewBody, aResIndex);
+ }
}
}
}