Hi @62BJW
try using the below code
public class RoomSelectionFilter : ISelectionFilter
{
public bool AllowElement(Element element)
{
if (element.Category.Id.IntegerValue==(int)BuiltInCategory.OST_Rooms)
{
return true;
}
return false;
}
public bool AllowReference(Reference refer, XYZ point)
{
return false;
}
}
RoomSelectionFilter RoomFilter = new RoomSelectionFilter();
IList<Reference> RoomReferences=uidoc.Selection.PickObjects(ObjectType.Element,RoomFilter) as IList<Reference>;
foreach(Reference RoomReference in RoomReferences)
{
ElementId roomID = RoomReference.ElementId;
Room R = doc.GetElement(roomID) as Room;
/*
your code
*/
}
Naveen Kumar T
Developer Technical Services
Autodesk Developer Network