MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / get_attributes

Function get_attributes

src/ifcfm/ifcfm/cobie24.py:169–255  ·  view source on GitHub ↗
(ifc_file: ifcopenshell.file)

Source from the content-addressed store, hash-verified

167
168
169def 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:

Callers

nothing calls this directly

Calls 11

get_historyFunction · 0.70
get_email_from_historyFunction · 0.70
get_created_byFunction · 0.70
get_created_onFunction · 0.70
get_external_systemFunction · 0.70
valFunction · 0.70
get_categoryFunction · 0.70
get_property_unitFunction · 0.70
itemsMethod · 0.45
by_idMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected