Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import clr
#Load Revit API
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk
#Load document reference
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
bool = IN[0]
collector = FilteredElementCollector(doc)
allLinePatterns = collector.OfClass(LinePatternElement).ToElements()
linePatternsNames = UnwrapElement(allLinePatterns)
output = ""
delLinePatternsId = []
if bool == True:
for l in linePatternsNames:
if l.Name.startswith("IMPORT"):
delLinePatternsId.append(l.Id)
output = str(len(delLinePatternsId)) + " Line Patterns have been deleted"
TransactionManager.Instance.EnsureInTransaction(doc)
for l in delLinePatternsId:
doc.Delete(l)
TransactionManager.Instance.TransactionTaskDone()
OUT = output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.