Hello,
I have a model from an external party and I want to purge schemas to avoid the constant popups regarding the addins they used.
While I’m trying to delete them some of them are read only. How can I remove these?
Can you share one of the models with EVERYTHING stripped out (open detached purging worksets, delete all links, accept all primary design options, delete all model elements, delete all levels, delete all grids, delete all views, purge unused, purge unused, purge unused, save, close, and open again with audit)? It’s likely you’ll need to go a Python route with it.
You need set mode overrideWriteAccessWithUserPermission
to True, or filter just schema allow permission is True , and you can follow api at EraseSchemaAndAllEntities Method and check python script example bellow.
import clr
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB.ExtensibleStorage import Schema
# Input parameters
schemaName = "<YourSchemaNameHere>"
overrideWriteAccessWithUserPermission = True
# Get the current Revit document
doc = DocumentManager.Instance.CurrentDBDocument
# Start a Revit transaction
TransactionManager.Instance.EnsureInTransaction(doc)
# Find the schema by name
schema = Schema.Lookup(schemaName)
if schema:
# Erase the schema and all entities associated with it
Schema.EraseSchemaAndAllEntities(schema, overrideWriteAccessWithUserPermission)
# Commit the transaction
TransactionManager.Instance.TransactionTaskDone()
# Output message
OUT = "your schema erased"
2 Likes