From: azv Date: Thu, 5 Mar 2020 10:41:03 +0000 (+0300) Subject: Update the ID of the TDF_Attribute while copying. X-Git-Tag: V9_5_0a2~54 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Frnv%2Fpv58_2;p=modules%2Fshaper.git Update the ID of the TDF_Attribute while copying. --- diff --git a/src/Model/Model_AttributeSelectionList.cpp b/src/Model/Model_AttributeSelectionList.cpp index 77fb51853..95a17e9d2 100644 --- a/src/Model/Model_AttributeSelectionList.cpp +++ b/src/Model/Model_AttributeSelectionList.cpp @@ -217,6 +217,8 @@ static void copyAttrs(TDF_Label theSource, TDF_Label theDestination) { if (!theDestination.FindAttribute(anAttrIter.Value()->ID(), aTargetAttr)) { // create a new attribute if not yet exists in the destination aTargetAttr = anAttrIter.Value()->NewEmpty(); + if (aTargetAttr->ID() != anAttrIter.Value()->ID()) + aTargetAttr->SetID(anAttrIter.Value()->ID()); theDestination.AddAttribute(aTargetAttr); } // for named shape copy exact shapes (in NamedShape Paste method the CopyTool is used) diff --git a/src/Model/Model_Tools.cpp b/src/Model/Model_Tools.cpp index 48831807a..04f49fb7e 100644 --- a/src/Model/Model_Tools.cpp +++ b/src/Model/Model_Tools.cpp @@ -62,6 +62,8 @@ void Model_Tools::copyAttrs(TDF_Label theSource, TDF_Label theDestination, if (!theDestination.FindAttribute(anAttrIter.Value()->ID(), aTargetAttr)) { // create a new attribute if not yet exists in the destination aTargetAttr = anAttrIter.Value()->NewEmpty(); + if (aTargetAttr->ID() != anAttrIter.Value()->ID()) + aTargetAttr->SetID(anAttrIter.Value()->ID()); theDestination.AddAttribute(aTargetAttr); } // no special relocation, empty map, but self-relocation is on: copy references w/o changes @@ -126,6 +128,8 @@ void Model_Tools::copyAttrsAndKeepRefsToCoordinates( if (!theDestination.FindAttribute(anAttrIter.Value()->ID(), aTargetAttr)) { // create a new attribute if not yet exists in the destination aTargetAttr = anAttrIter.Value()->NewEmpty(); + if (aTargetAttr->ID() != anAttrIter.Value()->ID()) + aTargetAttr->SetID(anAttrIter.Value()->ID()); theDestination.AddAttribute(aTargetAttr); } anAttrIter.Value()->Paste(aTargetAttr, theRelocTable);