Skip to content

delete

Database elements deletion functions.

Attributes

Functions

clear_sheet_revisions(sheet)

Source code in pyrevitlib/pyrevit/revit/db/delete.py
def clear_sheet_revisions(sheet):
    sheet.SetAdditionalRevisionIds(List[DB.ElementId]([]))

delete_elements(element_list, doc=None)

Source code in pyrevitlib/pyrevit/revit/db/delete.py
def delete_elements(element_list, doc=None):
    doc = doc or DOCS.doc
    element_ids = ensure.ensure_element_ids(element_list)
    return doc.Delete(List[DB.ElementId](element_ids))

delete_revision(rvt_rev, doc=None)

Source code in pyrevitlib/pyrevit/revit/db/delete.py
def delete_revision(rvt_rev, doc=None):
    doc = doc or DOCS.doc
    return doc.Delete(rvt_rev.Id)

reset_subcategories(doc=None, purgable=False, filterfunc=None)

Source code in pyrevitlib/pyrevit/revit/db/delete.py
def reset_subcategories(doc=None, purgable=False, filterfunc=None):
    # get subcategories
    cats_to_delete = query.get_subcategories(doc=doc,
                                             purgable=purgable,
                                             filterfunc=filterfunc)
    doc.Delete(List[DB.ElementId]([x.Id for x in cats_to_delete]))
    del cats_to_delete