(ifc_file: ifcopenshell.file)
| 167 | |
| 168 | |
| 169 | def get_attributes(ifc_file: ifcopenshell.file) -> list[dict[str, Any]]: |
| 170 | results: list[dict[str, Any]] = [] |
| 171 | history = get_history(ifc_file) |
| 172 | created_by = get_email_from_history(history) if history else None |
| 173 | created_on = ifcopenshell.util.date.ifc2datetime(history.CreationDate).isoformat() if history else None |
| 174 | external_system = history.OwningApplication.ApplicationFullName if history else None |
| 175 | get_sheets = { |
| 176 | "Facility": get_facilities, |
| 177 | "Floor": get_floors, |
| 178 | "Space": get_spaces, |
| 179 | "Type": get_types, |
| 180 | "Component": get_components, |
| 181 | } |
| 182 | |
| 183 | # COBie-Plugins includes what seems like a whole bunch of arbitrary "at the |
| 184 | # time it seemed to help" exclusion names. I don't like that strategy. If |
| 185 | # you've got garbage in your model, clean it out first. |
| 186 | |
| 187 | # fmt: off |
| 188 | excluded_names = { |
| 189 | "Manufacturer", |
| 190 | "ModelNumber", "ArticleNumber", "ModelLabel", |
| 191 | "WarrantyGuarantorParts", "PointOfContact", |
| 192 | "WarrantyGuarantorLabor", "PointOfContact", |
| 193 | "WarrantyDescription", "WarrantyIdentifier", |
| 194 | "ReplacementCost", "Replacement Cost", "Replacement", "Cost", |
| 195 | "NominalLength", "OverallLength", |
| 196 | "NominalWidth", "Width", |
| 197 | "NominalHeight", "Height", |
| 198 | "ModelReference", "Reference", |
| 199 | "Shape", |
| 200 | "Size", |
| 201 | "Color", "Colour", |
| 202 | "Finish", |
| 203 | "Grade", |
| 204 | "Material", |
| 205 | "Constituents", "Parts", |
| 206 | "Features", |
| 207 | "AccessibilityPerformance", "Access", |
| 208 | "CodePerformance", "Regulation", |
| 209 | "SustainabilityPerformance", "Environmental", |
| 210 | "SerialNumber", "InstallationDate", "WarrantyStartDate", "TagNumber", "BarCode", "AssetIdentifier" |
| 211 | } |
| 212 | # fmt: on |
| 213 | |
| 214 | for sheet_name, get_sheet in get_sheets.items(): |
| 215 | for element in get_sheet(ifc_file): |
| 216 | for pset_name, props in ifcopenshell.util.element.get_psets(element).items(): |
| 217 | pset = ifc_file.by_id(props["id"]) |
| 218 | pset_created_by = get_created_by(pset) or created_by |
| 219 | pset_created_on = get_created_on(pset) or created_on |
| 220 | pset_external_system = get_external_system(element) or external_system |
| 221 | pset_description = val(pset.Description) or pset_name |
| 222 | category = get_category(pset) |
| 223 | for name, value in props.items(): |
| 224 | if value == "default" or not val(value): |
| 225 | continue |
| 226 | elif name in excluded_names: |
nothing calls this directly
no test coverage detected