From 420fd54bbf64687a939752198692d4839ec94ce9 Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 5 Mar 2020 13:41:03 +0300 Subject: [PATCH] Update the ID of the TDF_Attribute while copying. --- src/Model/Model_AttributeSelectionList.cpp | 2 ++ src/Model/Model_Tools.cpp | 4 ++++ 2 files changed, 6 insertions(+) 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); -- 2.39.2