create Instances of Selected object Revit Api

2.2k views Asked by At

I'm new to Revit Api Programming..I want to make program that user can select any object he has drawn, then he will get the object repeated. the problem is i don't know how to identify object to get its parameters and the point to repeat it ..Any guidelines Please? Thanks In Advance.

1

There are 1 answers

0
Colin Stark On BEST ANSWER

I'll assume you're using a macro for the following answer.

To retrieve a user's current selection:

UIDocument uidoc = this.ActiveUIDocument;
SelElementSet selElSet = uidoc.Selection.Elements;
IEnumerable<Element> elements = (from Element el in selElSet select el);

To prompt a user to select an element:

UIDocument uidoc = this.ActiveUIDocument;
Reference reference = uidoc.Selection.PickObject(ObjectType.Element);
Element el = uidoc.Document.GetElement(reference);

Take a look at the Revit API samples, at the API documentation file (RevitAPI.chm), The Building Coder blog and the Boost Your BIM blog if you want some more information on how to get started.