public static void CopyTaggedValues(EA.Repository rep) { // over all selected elements EaDiagram curDiagram = new EaDiagram(rep); if (curDiagram.Dia == null) { return; } int indexLast = curDiagram.SelElements.Count - 1; // only synchronize TaggedValues if (indexLast == 0) { EaService.SynchronizeTaggedValues(rep); } if (indexLast < 1) { return; } EA.Element elLast = curDiagram.SelElements[0]; string stereoEx = elLast.StereotypeEx; ElTagValue elTagValues = new ElTagValue(elLast, stereoEx); // over all elements, skip first element because that is the property template for (int i = 1; i <= indexLast; i++) { // Set stereotypes if changed if (curDiagram.SelElements[i].StereotypeEx != stereoEx) { curDiagram.SelElements[i].StereotypeEx = stereoEx; } var error = rep.GetLastError(); curDiagram.SelElements[i].Update(); elTagValues.Copy(curDiagram.SelElements[i]); curDiagram.SelElements[i].Update(); } // synchronize all stereotypes elTagValues.SyncTaggedValues(rep, elLast); }