#RTCNA wish 8 granted! Delete unused elevation markers

Want to get rid of these?

Capture

public void deleteUnusedElevations()
{
    Document doc = this.ActiveUIDocument.Document;
    using (Transaction t = new Transaction(doc, "Delete unused elevations"))
    {
        t.Start();
        doc.Delete(new FilteredElementCollector(doc)
                   .OfClass(typeof(ElevationMarker))
                   .Cast<ElevationMarker>()
                   .Where(q => !q.HasElevations())
                   .Select(q => q.Id).ToList());
        t.Commit();
    }
}
Advertisements

2 thoughts on “#RTCNA wish 8 granted! Delete unused elevation markers

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s