mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
ifc5d.qto.IfcOpenshell - skip None values
Just for consistency, in all other cases besides get_segment_length we were only preserving floats anyway
This commit is contained in:
+10
-2
@@ -304,7 +304,9 @@ class IfcOpenShell(QtoCalculator):
|
||||
results[element].setdefault(name, {})
|
||||
for quantity, formula in quantities.items():
|
||||
if formula == "get_segment_length":
|
||||
results[element][name][quantity] = cls.get_segment_length(element)
|
||||
value = cls.get_segment_length(element)
|
||||
if value is None:
|
||||
continue
|
||||
elif formula == "get_weight":
|
||||
value = cls.get_weight(element, geometry)
|
||||
if value is None:
|
||||
@@ -334,7 +336,13 @@ class IfcOpenShell(QtoCalculator):
|
||||
return iterators
|
||||
|
||||
@classmethod
|
||||
def get_segment_length(cls, element: ifcopenshell.entity_instance) -> float:
|
||||
def get_segment_length(cls, element: ifcopenshell.entity_instance) -> Union[float, None]:
|
||||
"""Get segment length.
|
||||
|
||||
:param element: IFC element entity.
|
||||
:return: ``float`` segment length in project units
|
||||
or ``None`` if element doesn't have a representation or it's not supported.
|
||||
"""
|
||||
rep = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW")
|
||||
if rep and len(rep.Items or []) == 1 and rep.Items[0].is_a("IfcExtrudedAreaSolid"):
|
||||
item = rep.Items[0]
|
||||
|
||||
Reference in New Issue
Block a user