mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
restructure if/elif/else chain
This commit is contained in:
committed by
Thomas Krijnen
parent
a5353e02b5
commit
3a0aaee03b
@@ -201,6 +201,7 @@ class Usecase:
|
|||||||
"""
|
"""
|
||||||
value = self.settings["properties"][prop.Name]
|
value = self.settings["properties"][prop.Name]
|
||||||
unit, value = self.unpack_unit_value(value)
|
unit, value = self.unpack_unit_value(value)
|
||||||
|
|
||||||
if isinstance(value, (tuple, list)):
|
if isinstance(value, (tuple, list)):
|
||||||
sel_vals = []
|
sel_vals = []
|
||||||
for val in value:
|
for val in value:
|
||||||
@@ -210,17 +211,23 @@ class Usecase:
|
|||||||
ifc_val = self.file.create_entity(primary_measure_type, val)
|
ifc_val = self.file.create_entity(primary_measure_type, val)
|
||||||
sel_vals.append(ifc_val)
|
sel_vals.append(ifc_val)
|
||||||
prop.EnumerationValues = tuple(sel_vals) or None
|
prop.EnumerationValues = tuple(sel_vals) or None
|
||||||
else:
|
|
||||||
if value.EnumerationReference.EnumerationValues == ():
|
elif (
|
||||||
|
isinstance(value, ifcopenshell.entity_instance)
|
||||||
|
and value.is_a("IfcPropertyEnumeratedValue")
|
||||||
|
):
|
||||||
|
if not value.EnumerationReference.EnumerationValues:
|
||||||
if self.settings["should_purge"]:
|
if self.settings["should_purge"]:
|
||||||
del self.settings["properties"][prop.Name]
|
del self.settings["properties"][prop.Name]
|
||||||
self.file.remove(prop)
|
self.file.remove(prop)
|
||||||
return
|
return
|
||||||
prop.EnumerationReference.EnumerationValues = None
|
prop.EnumerationReference.EnumerationValues = None
|
||||||
prop.EnumerationValues = None
|
prop.EnumerationValues = None
|
||||||
elif isinstance(value, ifcopenshell.entity_instance):
|
|
||||||
|
else:
|
||||||
prop.EnumerationReference.EnumerationValues = value.EnumerationReference.EnumerationValues
|
prop.EnumerationReference.EnumerationValues = value.EnumerationReference.EnumerationValues
|
||||||
prop.EnumerationValues = value.EnumerationValues
|
prop.EnumerationValues = value.EnumerationValues
|
||||||
|
|
||||||
if unit:
|
if unit:
|
||||||
prop.Unit = unit
|
prop.Unit = unit
|
||||||
del self.settings["properties"][prop.Name]
|
del self.settings["properties"][prop.Name]
|
||||||
|
|||||||
Reference in New Issue
Block a user