File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed
Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ """
2+ Remove Wall Paint
3+
4+ TESTED REVIT API: 2017
5+
6+ Author: min.naung @https://twentytwo.space/contact | https://github.com/mgjean
7+
8+ This file is shared on www.revitapidocs.com
9+ For more information visit http://github.com/gtalarico/revitapidocs
10+ License: http://github.com/gtalarico/revitapidocs/blob/master/LICENSE.md
11+ """
12+
13+ from Autodesk .Revit .DB import Transaction , Reference , FilteredElementCollector
14+
15+
16+ uidoc = __revit__ .ActiveUIDocument
17+ doc = __revit__ .ActiveUIDocument .Document
18+
19+ # selected elements
20+ selection = uidoc .Selection
21+ # wall category id
22+ catId = FilteredElementCollector (doc ).OfClass (Wall ).ToElements ()[0 ].Category .Id
23+
24+ # filtered wall elements
25+ walls = [doc .GetElement (id ) for id in selection .GetElementIds () if doc .GetElement (id ).Category .Id == catId ]
26+
27+ # info message
28+ msg = "%s walls." % len (walls ) if len (walls )> 1 else "%s wall." % len (walls )
29+
30+ # transaction
31+ t = Transaction (doc , 'walls paint remove' )
32+
33+ # start transaction
34+ t .Start ()
35+
36+ # loop wall elements
37+ for wall in walls :
38+
39+ # get geometry object (solid)
40+ geoelem = wall .GetGeometryObjectFromReference (Reference (wall ))
41+
42+ # solid to geometry object
43+ geoobj = geoelem .GetEnumerator ()
44+
45+ # loop geometry object
46+ for obj in geoobj :
47+
48+ # collect faces from geometry object
49+ for f in obj .Faces :
50+
51+ # get each face
52+ doc .RemovePaint (wall .Id ,f )
53+
54+ # print info message
55+ print "Paint removed from %s" % (msg )
56+ #end of transaction
57+ t .Commit ()
You can’t perform that action at this time.
0 commit comments