Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit c6106e6

Browse files
committed
fix edit_pset error for editing material properties in ifc2x3
1 parent 865dbab commit c6106e6

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

src/ifcopenshell-python/ifcopenshell/api/pset/edit_pset.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,18 +378,29 @@ def add_new_properties(self) -> list[ifcopenshell.entity_instance]:
378378
def assign_new_properties(self, props: ifcopenshell.entity_instance) -> None:
379379
if hasattr(self.settings["pset"], "HasProperties"):
380380
self.settings["pset"].HasProperties = props
381+
382+
# Material / Profile properties
381383
elif hasattr(self.settings["pset"], "Properties"):
382384
self.settings["pset"].Properties = props
383385

386+
# IFC2X3 IfcMaterialProperties
387+
elif self.settings["pset"].is_a("IfcMaterialProperties"):
388+
self.settings["pset"].ExtendedProperties = props
389+
384390
def get_properties(self) -> list[ifcopenshell.entity_instance]:
385391
"""
386392
Returns list of existing properties
387393
"""
388-
if hasattr(self.settings["pset"], "HasProperties"):
389-
return self.settings["pset"].HasProperties or []
394+
if (props := getattr(self.settings["pset"], "HasProperties", ...)) is not ...:
395+
return props or []
396+
397+
# Material / Profile properties
398+
elif (props := getattr(self.settings["pset"], "Properties", ...)) is not ...:
399+
return props or []
390400

391-
elif hasattr(self.settings["pset"], "Properties"): # For IfcMaterialProperties
392-
return self.settings["pset"].Properties or []
401+
# IFC2X3 IfcMaterialProperties
402+
elif (props := getattr(self.settings["pset"], "ExtendedProperties", ...)) is not ...:
403+
return props or []
393404

394405
raise TypeError(f"'{self.settings['pset']}' is not a valid pset")
395406

0 commit comments

Comments
 (0)