Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Collect all column instances

Ali.sadeghi.h1994
Enthusiast

Collect all column instances

Ali.sadeghi.h1994
Enthusiast
Enthusiast

Hi. How can I collect all existed column instances in my model?

Reply
Accepted solutions (1)
411 Views
4 Replies
Replies (4)

RPTHOMAS108
Mentor
Mentor

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.

 

jeremy_tammik
Autodesk
Autodesk
Accepted solution

Retrieve column family instances sorted as in schedule:

 

https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/CmdCollectorPer...

 

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;
  }

 

 

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open

Ali.sadeghi.h1994
Enthusiast
Enthusiast
That was just a grammatical mistake. Thanks for your guides.

Ali.sadeghi.h1994
Enthusiast
Enthusiast
thanks a lot.