When performing a replace operation on a diagram, or by using API (ExecuteProcedure/ReplaceWith), it is possible to select to merge custom attribute values of the original element with the element that has been selected as replacing element.
•Merge attributes option is available in the "Replace with" dialog when the replacing element has the same element type as the original element
•Merge attributes option is available in the ExecuteProcedure as "MergeAttributes" parameter. Possible values are True | False | 1 | 0. False is the default value. If the element types do not match, this parameter is ignored.