Last active
August 28, 2019 06:50
-
-
Save albisserAdrian/c463e4a8234a4d722808043e25b41baf to your computer and use it in GitHub Desktop.
Revit API Delete Detail Elements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void DeleteDetailElements() | |
{ | |
Document doc = this.Application.ActiveUIDocument.Document; | |
FilteredElementCollector detailLines = new FilteredElementCollector(doc).WhereElementIsNotElementType().OfCategory(BuiltInCategory.OST_Lines); | |
IList<ElementId> detailLineIds = new List<ElementId>(); | |
foreach(CurveElement dl in detailLines) | |
{ | |
detailLineIds.Add(dl.Id); | |
} | |
FilteredElementCollector filledRegions = new FilteredElementCollector(doc).OfClass(typeof(FilledRegion)); | |
IList<ElementId> filledRegionIds = new List<ElementId>(); | |
foreach(FilledRegion fr in filledRegions) | |
{ | |
detailRegionIds.Add(fr.Id); | |
} | |
using(Transaction t = new Transaction(doc,"Delete Detail Elements")) | |
{ | |
t.Start(); | |
doc.Delete(detailLineIds); | |
doc.Delete(filledRegionIds); | |
t.Commit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment