Does the ElementTransformUtils class keep the source parameters?

Hi, attached a partial copy of the script, it seems that the parameters are not kept between the source and destination copy (ElementTransformUtils class)
Id number different from the parameter
Source Id : 458851
Copy Id:458855

Does this come from the python script?

import clr
import sys
import System

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

from System.Collections.Generic import List

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument

vec=IN[1]
stock=[]
element_select=UnwrapElement(IN[0])

setids=List[ElementId]()

for e in element_select:
    a=e.Id
    setids.Add(a)

TransactionManager.Instance.EnsureInTransaction(doc)
for v in vec:
    c=ElementTransformUtils.CopyElements(doc,setids,v.ToRevitType())
    stock.append(c)
TransactionManager.Instance.TransactionTaskDone()

OUT = stock

I sincerely thank you in advance
christian.stan

I think that phase data may be an exception to the rule. Is that perhaps the last phase of the project?

hi, thank you for the hypothesis, no on other parameters of the family, I have the same different results (default value, data not transmitted), and the phase was not the last of the project
Sincerely
christian.stan

Hmmm… do you have a simple reproducible case?

hi, here is the link with file (I tried to keep it as small as possible, I think I have work to do on this aspect) and script
edit: I am using Revit 2023 try launching it from the player, you should have a pick point of 3 points
filesender.renater.fr/?s=download&token=84a45361-1a29-44e2-b2e3-5b4ffcc41469
cordially
christian.stan

Hi,
instead, you can set the PHASE parameters in the same python node

import clr
import sys
import System

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

from System.Collections.Generic import List

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument

vec=IN[1]
stock=[]
element_select=UnwrapElement(IN[0])

setids=List[ElementId]()

for e in element_select:
    a=e.Id
    setids.Add(a)


TransactionManager.Instance.EnsureInTransaction(doc)
for v in vec:
    lst_copyIds=ElementTransformUtils.CopyElements(doc,setids,v.ToRevitType())
    doc.Regenerate()
    for copyId, sourceElem in zip(lst_copyIds, element_select):
        copyElem = doc.GetElement(copyId)
        copyElem.get_Parameter(BuiltInParameter.PHASE_CREATED).Set(sourceElem.get_Parameter(BuiltInParameter.PHASE_CREATED).AsElementId())
        copyElem.get_Parameter(BuiltInParameter.PHASE_DEMOLISHED).Set(sourceElem.get_Parameter(BuiltInParameter.PHASE_DEMOLISHED).AsElementId())

    stock.append(lst_copyIds)
TransactionManager.Instance.TransactionTaskDone()

OUT = stock

Hi,

By using the copy natively
image
the phases do not follow so the result remains normal thank you for your feedback
a get from the source and set to the copy.
Why the doc.Regenerate()?
It seems that copying elements with the assignment of certain parameters specific to the family is a little chaotic too (see image)

I might put it down to the family, I don’t really know, I’m still perplexed.

thank you, I validate your answer as a solution
thank M. Jacob too

Sincerely
christian.stan

I don’t think it’s mandatory here, but on certain types of elements, I had to regenerate the document to be able to modify them in the rest of the code.