mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 01:47:55 +00:00
fix edit_pset error for editing material properties in ifc2x3
This commit is contained in:
@@ -378,18 +378,29 @@ class Usecase:
|
|||||||
def assign_new_properties(self, props: ifcopenshell.entity_instance) -> None:
|
def assign_new_properties(self, props: ifcopenshell.entity_instance) -> None:
|
||||||
if hasattr(self.settings["pset"], "HasProperties"):
|
if hasattr(self.settings["pset"], "HasProperties"):
|
||||||
self.settings["pset"].HasProperties = props
|
self.settings["pset"].HasProperties = props
|
||||||
|
|
||||||
|
# Material / Profile properties
|
||||||
elif hasattr(self.settings["pset"], "Properties"):
|
elif hasattr(self.settings["pset"], "Properties"):
|
||||||
self.settings["pset"].Properties = props
|
self.settings["pset"].Properties = props
|
||||||
|
|
||||||
|
# IFC2X3 IfcMaterialProperties
|
||||||
|
elif self.settings["pset"].is_a("IfcMaterialProperties"):
|
||||||
|
self.settings["pset"].ExtendedProperties = props
|
||||||
|
|
||||||
def get_properties(self) -> list[ifcopenshell.entity_instance]:
|
def get_properties(self) -> list[ifcopenshell.entity_instance]:
|
||||||
"""
|
"""
|
||||||
Returns list of existing properties
|
Returns list of existing properties
|
||||||
"""
|
"""
|
||||||
if hasattr(self.settings["pset"], "HasProperties"):
|
if (props := getattr(self.settings["pset"], "HasProperties", ...)) is not ...:
|
||||||
return self.settings["pset"].HasProperties or []
|
return props or []
|
||||||
|
|
||||||
elif hasattr(self.settings["pset"], "Properties"): # For IfcMaterialProperties
|
# Material / Profile properties
|
||||||
return self.settings["pset"].Properties or []
|
elif (props := getattr(self.settings["pset"], "Properties", ...)) is not ...:
|
||||||
|
return props or []
|
||||||
|
|
||||||
|
# IFC2X3 IfcMaterialProperties
|
||||||
|
elif (props := getattr(self.settings["pset"], "ExtendedProperties", ...)) is not ...:
|
||||||
|
return props or []
|
||||||
|
|
||||||
raise TypeError(f"'{self.settings['pset']}' is not a valid pset")
|
raise TypeError(f"'{self.settings['pset']}' is not a valid pset")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user