Possible Bug in ElementTransformUtils.CopyElements?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm running into a potential bug in Revit 2021.1.7 (confirmed in 2023, see below) when I'm using ElementTransformUtils.CopyElements(Document document, ICollection<ElementId> elementsToCopy, XYZ translation) to copy a List of walls - I have not verified if this occurs in other versions.
For some reason the first set of walls I'm copying is set at Level 2, however, the actual base constraint listed for the wall is at Level 1. After the first copy, all the other walls show up at the correct elevation.
Actual code doing the copying is similar to this:
ICollection<ElementId> offsetList = offsetWallList;
XYZ direction = offsetDirection; // location for new copy
XYZ offset = direction; // offset vector
for (int idx = 0; idx < quantity; idx++)
{
ElementTransformUtils.CopyElements(rvtDoc, offsetList, direction);
direction += offset;
}
It appears this also happens if I create a Level 3 and place the walls at Level 3 - the 1st set of walls copied shows up at Level 2 even though the base constraint is set to Level 3.
Note that if I use a transform, this doesn't seem to happen:
ICollection<ElementId> offsetList = offsetWallList;
XYZ direction = offsetDirection; // location for new copy
XYZ offset = direction; // offset vector
Transform transform = Transform.CreateTranslation(direction);
for (int idx = 0; idx < quantity; idx++)
{
ElementTransformUtils.CopyElements(rvtDoc, offsetList, rvtDoc, transform, new CopyPasteOptions());
direction += offset;
transform = Transform.CreateTranslation(direction);
}
So I'm not necessarily looking for a solution, but just wanted to report it.
Thanks,
Alan