I am relatively new at programming in Revit. I am currently getting a list of elements in my drawing that are of type door or window. What I want to do is cast these as an opening however I get an error when I try to cast them as a Autodesk.Revit.DB.Opening.
Code Below:
// filter for current design option
var designOptionFilter = S2E.Revit.Tools.Library.Cache.DesignOptionFilter;
List<Element> elements = collector.WherePasses(designOptionFilter).ToElements().ToList();
var list = new List<Autodesk.Revit.DB.Opening>();
foreach (var element in elements) {
var opening = (Opening)element;
if (opening.Host.Id == wallId) {
list.Add(opening);
}
}
return list;
As you can see I am testing if the id of the host matches the wall I am woking on. At least that is what I would like to do. All I am looking for is how to cast an element as an Opening.
Thanks, Rich