-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMaterialMatching.py
More file actions
107 lines (99 loc) · 3.39 KB
/
MaterialMatching.py
File metadata and controls
107 lines (99 loc) · 3.39 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#--------------------------------------------------------------------------
def GetAllMaterials():
theMaterials = (
FilteredElementCollector(doc)
.OfCategory(BuiltInCategory.OST_Materials)
.OrderBy(lambda m: m.Name)
.ToList()
)
return theMaterials
#--------------------------------------------------------------------------
def GetAllAppearanceAssets():
theAppearanceAssets = (
FilteredElementCollector(doc)
.OfCategory(BuiltInCategory.OST_AppearanceAsset)
.OrderBy(lambda aa: aa.Name)
.ToList()
)
return theAppearanceAssets
#--------------------------------------------------------------------------
def ReportMaterial(theMaterial):
TabIdentity(theMaterial)
TabGraphics(theMaterial)
TabAppearance(theMaterial)
#--------------------------------------------------------------------------
def GetRGB(theColor):
col = 'RGB '
col = col + theColor.Red.ToString() + '-'
col = col + theColor.Green.ToString() + '-'
col = col + theColor.Blue.ToString()
return col
#--------------------------------------------------------------------------
def GetPatternName(thePatternId):
patName = ''
if ElementId.InvalidElementId == thePatternId:
patName = '<None>'
else:
patName = doc.GetElement(thePatternId).Name
return patName
#--------------------------------------------------------------------------
def GetPatterns(theMaterial):
print 'SURFACE PATTERN'
print 'ForeGround'
print 'Pattern: '
print 'Color: '
print 'Background'
print 'Pattern: '
print 'Color: '
print '\n'
print 'CUT PATTERN'
print 'ForeGround'
print 'Pattern: ' + GetPatternName(theMaterial.CutForegroundPatternId)
print 'Color: ' + GetRGB(theMaterial.CutForegroundPatternColor)
print 'Background'
print 'Pattern: ' + GetPatternName(theMaterial.CutBackgroundPatternId)
print 'Color: '+ GetRGB(theMaterial.CutBackgroundPatternColor)
#--------------------------------------------------------------------------
def TabIdentity(theMaterial):
print '+----------------+'
print '| TAB - Identity |'
print '+----------------+'
print 'Name: ' + theMaterial.Name
print '+-----------------------------+'
print 'Descriptive Information'
print 'Descritpion: '
print 'Class: ' + theMaterial.MaterialClass
print 'Comments: '
print 'Keywords: '
print '+-----------------------------+'
print 'Product Information'
print 'Manufacturer: '
print 'Model: '
print 'Cost: '
print 'URL: '
print '+-----------------------------+'
print 'Revit Annotation Information'
print 'Keynote: '
print 'Mark: '
print '\n'
#--------------------------------------------------------------------------
def TabGraphics(theMaterial):
print '+----------------+'
print '| TAB - Graphics |'
print '+----------------+'
print 'Shading'
print 'Use Render Appearance: ' + theMaterial.UseRenderAppearanceForShading.ToString()
print 'Color: ' + GetRGB(theMaterial.Color)
print 'Transparency: ' + theMaterial.Transparency.ToString()
GetPatterns(theMaterial)
#--------------------------------------------------------------------------
def TabAppearance(theMaterial):
pass
#--------------------------------------------------------------------------
theMaterials = GetAllMaterials()
theMaterialAssets = GetAllAppearanceAssets()
#for aMaterial in theMaterials: print aMaterial.Name
#for aMaterialAsset in theMaterialAssets: print aMaterialAsset.Name
mat = theMaterials[3]
ReportMaterial(mat)