- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
From reading The Building Coder's post about Retrieving All Available Line Styles (https://thebuildingcoder.typepad.com/blog/2013/08/retrieving-all-available-line-styles.html) it is my understanding that detail line elements can be collected via FilteredElementCollector once a subcategory is selected? I have a line style subcategory and would like to collect all the detail lines of that style. How do I do that?
For context from the link above (bold added by me for emphasis):
"
While the Revit API does not provide a true 'Line style' element, the line styles are actually subcategories of the Lines category. Therefore, the FilteredElementCollector cannot easily be used for this in a single statement, like in your examples above.
It should be possible to retrieve the line styles without a line instance, though.
Here’s a macro that lists all subcategories of the Lines category:
public void GetListOfLinestyles( Document doc )
{
Category c = doc.Settings.Categories.get_Item(
BuiltInCategory.OST_Lines );
CategoryNameMap subcats = c.SubCategories;
foreach( Category lineStyle in subcats )
{
TaskDialog.Show( "Line style", string.Format(
"Linestyle {0} id {1}", lineStyle.Name,
lineStyle.Id.ToString() ) );
}
}
Note that some line styles like 'Room Boundary' cannot actually be assigned to arbitrary lines in the UI, but this should be good enough to find a usable one.
Once you have a collection of the line style subcategories of interest, you can create a filtered element collector retrieving all ElementType elements belonging to any one of them.
"
Solved! Go to Solution.