Message 1 of 2
Error in ElementTransformUtils.CopyElements
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I use the method to copy one element from a project to an empty document file (that will be used after for some things).
It works with some kind of elements, such as Wall, Floors, etc.
But with Pipes for exemple, the methode throws an InvalidOperationException exception.
Here is the code I use :
ICollection<ElementId> types = inFamilySystem.GetValidTypes(); List<ElementId> collect = new List<ElementId>(); foreach (ElementId id in types) { ElementType eT = inDoc.GetElement(id) as ElementType; if (eT != null) { if (XXX) { collect.Add(eT.Id); } } } collect.Add(inFamilySystem.Id); CopyPasteOptions opts = new CopyPasteOptions(); opts.SetDuplicateTypeNamesHandler(new RevitSession.DuplicateHandler()); ICollection<ElementId> copiedElems = ElementTransformUtils.CopyElements(inDoc, collect, newDoc, Transform.Identity, opts);
The exception throwed is an "InvalidOperationException", and I can not know why it failes.
If the element was view-specific, it should be an "ArgumentException" exception no ?
Do you have an idea ?
Regards,
GBG