@@ -90,6 +90,8 @@ extension Database {
90
90
/// Provides a static list of the indexed model types.
91
91
/// See: https://github.com/vimaec/vim/blob/master/ObjectModel/object-model-schema.json
92
92
static let models : [ any IndexedPersistentModel . Type ] = [
93
+ AreaScheme . self,
94
+ Area . self,
93
95
AssemblyInstance . self,
94
96
Asset . self,
95
97
BimDocument . self,
@@ -146,6 +148,75 @@ extension Database {
146
148
}
147
149
}
148
150
151
+ @Model
152
+ public final class AreaScheme : IndexedPersistentModel {
153
+
154
+ public static func predicate( _ index: Int64 ) -> Predicate < AreaScheme > {
155
+ #Predicate< AreaScheme> { $0. index == index }
156
+ }
157
+
158
+ @Transient
159
+ public static let importPriority : ModelImportPriority = . normal
160
+
161
+ @Attribute ( . unique)
162
+ public var index : Int64
163
+ public var isGrossBuildingArea : Bool
164
+ public var element : Element ?
165
+
166
+ /// Initializer.
167
+ public required init ( ) {
168
+ index = . empty
169
+ isGrossBuildingArea = false
170
+ }
171
+
172
+ public func update( from data: [ String : AnyHashable ] , cache: ImportCache ) {
173
+ isGrossBuildingArea = data [ " IsGrossBuildingArea " ] as? Bool ?? false
174
+ if let idx = data [ " Element " ] as? Int64 , idx != . empty {
175
+ element = cache. findOrCreate ( idx)
176
+ }
177
+ }
178
+ }
179
+
180
+ @Model
181
+ public final class Area : IndexedPersistentModel {
182
+
183
+ public static func predicate( _ index: Int64 ) -> Predicate < Area > {
184
+ #Predicate< Area> { $0. index == index }
185
+ }
186
+
187
+ @Transient
188
+ public static let importPriority : ModelImportPriority = . normal
189
+
190
+ @Attribute ( . unique)
191
+ public var index : Int64
192
+ public var isGrossInterior : Bool
193
+ public var perimeter : Double
194
+ public var value : Double
195
+ public var scheme : AreaScheme ?
196
+ public var element : Element ?
197
+ public var number : String ?
198
+
199
+ /// Initializer.
200
+ public required init ( ) {
201
+ index = . empty
202
+ isGrossInterior = false
203
+ perimeter = 0
204
+ value = 0
205
+ }
206
+
207
+ public func update( from data: [ String : AnyHashable ] , cache: ImportCache ) {
208
+ isGrossInterior = data [ " IsGrossInterior " ] as? Bool ?? false
209
+ perimeter = data [ " Perimeter " ] as? Double ?? . zero
210
+ value = data [ " Value " ] as? Double ?? . zero
211
+ number = data [ " Number " ] as? String
212
+ if let idx = data [ " AreaScheme " ] as? Int64 , idx != . empty {
213
+ scheme = cache. findOrCreate ( idx)
214
+ }
215
+ if let idx = data [ " Element " ] as? Int64 , idx != . empty {
216
+ element = cache. findOrCreate ( idx)
217
+ }
218
+ }
219
+ }
149
220
150
221
@Model
151
222
public final class Asset : IndexedPersistentModel {
0 commit comments