- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi. How can I collect all existed column instances in my model?
Solved! Go to Solution.
The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.
Hi. How can I collect all existed column instances in my model?
Solved! Go to Solution.
Like you collect all things FilteredElementCollector
'Existed' or 'Existing'?
It is impossible to tell if it 'existed' apart from comparing with older models.
What do you mean by 'existing':
This column exists in the model and so it is existing, it is therefore it exists?
This column is built on a phase previous to the current one?
ElementPhaseStatusFilter is a slow filter so combine it with ElementCategoryFilter for columns. You could use a class filter but then you would still have to distinguish the category since both would be FamilyInstances. So in this instance a ElementCategoryFilter seems the best quick filter.
Retrieve column family instances sorted as in schedule:
Retrieve column instances:
/// <summary>
/// Return a sorted list of all structural columns.
/// The sort order is defined by ColumnMarkComparer
/// as requested to to replicate the graphical column
/// schedule sort order with C# in
/// https://forums.autodesk.com/t5/revit-api-forum/replicate-graphical-column-schedule-sort-order-with-c/m-p/9105470
/// </summary>
private List<FamilyInstance> GetSortedColumns(Document doc)
{
var colums
= new FilteredElementCollector(doc)
.WhereElementIsNotElementType()
.OfCategory(BuiltInCategory.OST_StructuralColumns)
.OfClass(typeof(FamilyInstance))
.Cast<FamilyInstance>()
.ToList();
colums.Sort(new ColumnMarkComparer());
return colums;
}