Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Collect all column instances

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Ali.sadeghi.h1994
303 Views, 4 Replies

Collect all column instances

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

Tags (3)
Labels (2)
4 REPLIES 4
Message 2 of 5

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.

 

Message 3 of 5

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
Message 4 of 5

That was just a grammatical mistake. Thanks for your guides.
Message 5 of 5

thanks a lot.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community