-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDeleteAllMaterialsYesReally.py
More file actions
36 lines (33 loc) · 1.23 KB
/
DeleteAllMaterialsYesReally.py
File metadata and controls
36 lines (33 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#========================================================================#
# _____ __
# \_ \__ _ _ __ \ \ __ _ _ __ ___ ___ ___
# / /\/ _` | '_ \ \ \/ _` | '_ ` _ \ / _ \/ __|
# /\/ /_| (_| | | | | /\_/ / (_| | | | | | | __/\__ \
# \____/ \__,_|_| |_| \___/ \__,_|_| |_| |_|\___||___/
#
#
# This script removes all materials and material assets from a model.
#
# WARNING... THIS WAS WRITTEN FOR A VERY SPECIFIC PURPOSE. ONLY USE IF
# YOU WANT TO PERMANENTLY DELETE ALL MATERIALS AND APPEARANCE
# ASSETS.
#
# December 2018
#
#========================================================================#
import collections
theMaterials = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Materials).ToElementIds()
theAppearanceAssets = FilteredElementCollector(doc).OfClass(AppearanceAssetElement).ToElementIds()
tranny = Transaction(doc)
try:
tranny.Start('Deleting the Materials & Assets')
print 'Deleteing Materials'
doc.Delete(theMaterials)
print 'Deleting AppearanceAssets'
doc.Delete(theAppearanceAssets)
tranny.Commit()
tranny.Dispose()
except Exception as e:
tranny.RollBack()
tranny.Dispose()
print e.message