Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to get the visible elements of a subcategory, Property Line Segments. This particular subcategory allows independent elements, meaning they don't show as a Site category element even though its nested under it. When using the following code in a view where Property Line Segments is off, it will return the number of segments, assuming you have some. The expected value would be 0 (since the subcategory is off). When you turn off the Site category, then it returns 0. Is this a bug?
Tested in rac_advanced_sample_project.rvt:
public void GetVisibleSubCategoryElements()
{
Document doc = this.ActiveUIDocument.Document;
var propLineSegCat = Category.GetCategory(doc, BuiltInCategory.OST_SitePropertyLineSegment);
var elemList = new FilteredElementCollector(doc, doc.ActiveView.Id).OfCategoryId(propLineSegCat.Id).ToElements().ToList();
TaskDialog.Show("Info", elemList.Count + " elements found.");
}
Solved! Go to Solution.