@@ -51,6 +51,95 @@ def grab_props(src_element):
51
51
if x .Definition .Name not in EXCLUDE_PARAMS ]
52
52
53
53
54
+ def compare_view_filters (view1 , view2 ):
55
+ output .print_md ("### View Filters" )
56
+
57
+ filters1 = set (view1 .GetFilters ())
58
+ filters2 = set (view2 .GetFilters ())
59
+
60
+ filter_names1 = {view1 .Document .GetElement (fid ).Name : fid for fid in filters1 }
61
+ filter_names2 = {view2 .Document .GetElement (fid ).Name : fid for fid in filters2 }
62
+
63
+ shared_filters = set (filter_names1 .keys ()).intersection (set (filter_names2 .keys ()))
64
+ only_in_1 = set (filter_names1 .keys ()) - set (filter_names2 .keys ())
65
+ only_in_2 = set (filter_names2 .keys ()) - set (filter_names1 .keys ())
66
+
67
+ if only_in_1 or only_in_2 :
68
+ rows = [[n , "" ] for n in sorted (only_in_1 )]
69
+ rows .extend ([["" , n ] for n in sorted (only_in_2 )])
70
+ output .print_table (
71
+ rows ,
72
+ columns = ["Only in Source View" , "Only in Target View" ],
73
+ title = "Different Filter Assignments" ,
74
+ )
75
+
76
+ for fname in sorted (shared_filters ):
77
+ fid1 = filter_names1 [fname ]
78
+ fid2 = filter_names2 [fname ]
79
+
80
+ ov1 = view1 .GetFilterOverrides (fid1 )
81
+ ov2 = view2 .GetFilterOverrides (fid2 )
82
+
83
+ differences = []
84
+
85
+ # Compare properties of OverrideGraphicSettings
86
+ # Colors
87
+ c1 = ov1 .ProjectionLineColor
88
+ c2 = ov2 .ProjectionLineColor
89
+ if c1 .IsValid and c2 .IsValid :
90
+ if c1 .Red != c2 .Red or c1 .Green != c2 .Green or c1 .Blue != c2 .Blue :
91
+ differences .append ("ProjectionLineColor" )
92
+ elif c1 .IsValid != c2 .IsValid :
93
+ differences .append ("ProjectionLineColor" )
94
+
95
+ c1 = ov1 .SurfaceForegroundPatternColor
96
+ c2 = ov2 .SurfaceForegroundPatternColor
97
+ if c1 .IsValid and c2 .IsValid :
98
+ if c1 .Red != c2 .Red or c1 .Green != c2 .Green or c1 .Blue != c2 .Blue :
99
+ differences .append ("SurfaceColor" )
100
+ elif c1 .IsValid != c2 .IsValid :
101
+ differences .append ("SurfaceColor" )
102
+
103
+ c1 = ov1 .CutLineColor
104
+ c2 = ov2 .CutLineColor
105
+ if c1 .IsValid and c2 .IsValid :
106
+ if c1 .Red != c2 .Red or c1 .Green != c2 .Green or c1 .Blue != c2 .Blue :
107
+ differences .append ("CutLineColor" )
108
+ elif c1 .IsValid != c2 .IsValid :
109
+ differences .append ("CutLineColor" )
110
+
111
+ c1 = ov1 .CutBackgroundPatternColor
112
+ c2 = ov2 .CutBackgroundPatternColor
113
+ if c1 .IsValid and c2 .IsValid :
114
+ if c1 .Red != c2 .Red or c1 .Green != c2 .Green or c1 .Blue != c2 .Blue :
115
+ differences .append ("CutBackgroundPatternColor" )
116
+ elif c1 .IsValid != c2 .IsValid :
117
+ differences .append ("CutBackgroundPatternColor" )
118
+
119
+ # Not checking pattern or linestyle overrides because I'm lazy
120
+
121
+ # Other appearance stuff
122
+ if ov1 .Transparency != ov2 .Transparency :
123
+ differences .append ("Transparency" )
124
+ if ov1 .Halftone != ov2 .Halftone :
125
+ differences .append ("Halftone" )
126
+
127
+ # More general stuff
128
+ if view1 .GetIsFilterEnabled (fid1 ) != view2 .GetIsFilterEnabled (fid2 ):
129
+ differences .append ("Enabled Status" )
130
+
131
+ if view1 .GetFilterVisibility (fid1 ) != view2 .GetFilterVisibility (fid2 ):
132
+ differences .append ("Vsibility Status" )
133
+
134
+ if differences :
135
+ output .print_md (
136
+ ":warning: **Filter '{}' has different overrides:** {}"
137
+ .format (fname , ", " .join (differences )))
138
+ else :
139
+ output .print_md (
140
+ ":white_heavy_check_mark: Filter '{}' overrides match." .format (fname ))
141
+
142
+
54
143
def compare_props (src_element , tgt_element ):
55
144
output .print_md ("### Instance Properties" )
56
145
src_type = revit .query .get_type (src_element )
@@ -106,6 +195,10 @@ def compare_props(src_element, tgt_element):
106
195
title = 'Unique Type Properties'
107
196
)
108
197
198
+ # If both are views, compare filters
199
+ if isinstance (src_element , DB .View ) and isinstance (tgt_element , DB .View ):
200
+ compare_view_filters (src_element , tgt_element )
201
+
109
202
110
203
# main
111
204
# try use selected elements
0 commit comments