Message 1 of 5
Not applicable
01-23-2017
02:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hello again,
This is my first post in this forum
well,my problem is:
How I can filter elemet after selection?
IList<Element> pickedElements = uidoc.Selection.PickElementsByRectangle("Made rectangle");
if (pickedElements.Count > 0)
{
Lista_idElement = new List<string>();
foreach (Element element in pickedElements)
{
if (element is Wall)
{
{ TaskDialog.Show("Revit", " wall"); }
// get ElementType
ElementId id = element.GetTypeId();
// get Element_id (idElement variable definida al principio)
idElement = element.Id.ToString();
// get type element ( type variable definida al principio)
tipo_elemento = doc.GetElement(element.GetTypeId()) as ElementType;
Lista_idElement.Add(idElement);
Lista_tipo_elemento.Add(tipo_elemento.ToString());
// get the builtin parameter
Parameter param_codigo = tipo_elemento.get_Parameter(BuiltInParameter.KEYNOTE_PARAM);
Parameter param_C1 = tipo_elemento.LookupParameter("C1");
paramametro_C1 = param_C1.AsString();
parametro_codigo = param_codigo.AsString();
Lista_codigo.Add(parametro_codigo);
Lista_C1.Add(param_C1.ToString());
}
else
{ TaskDialog.Show("Revit", "No is wall"); }
}With this code when i do the rectangle selection add to list "Lista_tipo_elemento" all the element ,not only the wall.
i look for some like....
foreach (Element element in pickedElements)
{
if (element is Wall)
{......make list of wall........}
if (elem.Category.Id.IntegerValue == (int)BuiltInCategory.OST_Windows)
{..........make list of windows........}thanks¡¡¡
Solved! Go to Solution.