# Does the ElementTransformUtils class keep the source parameters?

**URL:** <https://forum.dynamobim.com/t/does-the-elementtransformutils-class-keep-the-source-parameters/101902>\
**Category:** Revit\
**Tags:** python\
**Created:** [June 14, 2024, 3:23pm UTC](https://forum.dynamobim.com/t/does-the-elementtransformutils-class-keep-the-source-parameters/101902 "2024-06-14T15:23:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [June 14, 2024, 3:23pm UTC](https://forum.dynamobim.com/t/does-the-elementtransformutils-class-keep-the-source-parameters/101902/1 "2024-06-14T15:23:08Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/d/cd2aee9f0a8f1c731cea9beed3b33ff7cce7d535.png)

Does this come from the python script?

```auto
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

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [June 14, 2024, 5:08pm UTC](https://forum.dynamobim.com/t/does-the-elementtransformutils-class-keep-the-source-parameters/101902/2 "2024-06-14T17:08:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [June 14, 2024, 5:20pm UTC](https://forum.dynamobim.com/t/does-the-elementtransformutils-class-keep-the-source-parameters/101902/3 "2024-06-14T17:20:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [June 14, 2024, 5:31pm UTC](https://forum.dynamobim.com/t/does-the-elementtransformutils-class-keep-the-source-parameters/101902/4 "2024-06-14T17:31:52Z")

</div>

Hmmm… do you have a simple reproducible case?

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [June 15, 2024, 12:30pm UTC](https://forum.dynamobim.com/t/does-the-elementtransformutils-class-keep-the-source-parameters/101902/5 "2024-06-15T12:30:37Z")

</div>

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](http://filesender.renater.fr/?s=download&token=84a45361-1a29-44e2-b2e3-5b4ffcc41469)  
cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [June 16, 2024, 11:15am UTC](https://forum.dynamobim.com/t/does-the-elementtransformutils-class-keep-the-source-parameters/101902/6 "2024-06-16T11:15:51Z")

</div>

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

```auto
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

```

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [June 16, 2024, 12:22pm UTC](https://forum.dynamobim.com/t/does-the-elementtransformutils-class-keep-the-source-parameters/101902/7 "2024-06-16T12:22:05Z")

</div>

Hi,

By using the copy natively  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/b/8b270b8751f6a61269beb6276c90ef33b882c6ec.png)  
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)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/c/5c85020bdbed4bdcfd730cd9e76f94ce24e7a944.png)

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

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [June 16, 2024, 2:13pm UTC](https://forum.dynamobim.com/t/does-the-elementtransformutils-class-keep-the-source-parameters/101902/8 "2024-06-16T14:13:25Z")

</div>

> [@christian.stan](#):
>
> Why the doc.Regenerate()?

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.
