I'm trying to get code from this sample: http://thebuildingcoder.typepad.com/blog/2010/05/duplicate-legend-component.html to run.
I am using Revit 2013 so I had to make some changes:
ICollection<ElementId> SelectedIds = m_UIDoc.Selection.GetElementIds(); Group group = m_doc.Create.NewGroup(SelectedIds);
Revit died on the NewGroup call. There was one ElementId in the selection.
I put an exception handler around it and got this message:
"External component has thrown an exception."
Any ideas?
Also, is there any other way to clone/copy an Element?
Thanks
FYI: I found the problem was that I was calling the code from a modeless dialog box. Apparently Revit doesn't like this.
@Steve_Wellens wrote:...Apparently Revit doesn't like this.
The Essential question is, what did happen to your main thread of the add-in after the modeless dialog was launched? Because that is the only thread you can call Revit API.