This commit is contained in:
Andrej730
2025-07-28 11:45:12 +05:00
parent 23944d6060
commit cdeeab4b31
20 changed files with 161 additions and 134 deletions
@@ -29,7 +29,14 @@ def has_zero_length_segment(layout: entity_instance) -> bool:
:param layout: An IfcAlignmentHorizontal, IfcAlignmentVertical, IfcAlignmentCant, IfcCompositeCurve, IfcGradientCurve, or IfcSegmentedReferenceCurve
:return: True if the zero length segment is present
"""
expected_types = ["IfcAlignmentHorizontal", "IfcAlignmentVertical", "IfcAlignmentCant","IfcCompositeCurve","IfcGradientCurve","IfcSegmentedReferenceCurve"]
expected_types = [
"IfcAlignmentHorizontal",
"IfcAlignmentVertical",
"IfcAlignmentCant",
"IfcCompositeCurve",
"IfcGradientCurve",
"IfcSegmentedReferenceCurve",
]
if not layout.is_a() in expected_types:
raise TypeError(
f"Expected entity type to be one of {[_ for _ in expected_types]}, instead received '{layout.is_a()}"
@@ -38,7 +45,11 @@ def has_zero_length_segment(layout: entity_instance) -> bool:
result = False
if layout.is_a("IfcCompositeCurve") or layout.is_a("IfcGradientCurve") or layout.is_a("IfcSegmentedReferenceCurve"):
result = True if layout.Segments and 0 < len(layout.Segments) and layout.Segments[-1].SegmentLength.wrappedValue == 0.0 else False
result = (
True
if layout.Segments and 0 < len(layout.Segments) and layout.Segments[-1].SegmentLength.wrappedValue == 0.0
else False
)
else:
for rel in layout.IsNestedBy:
if 0 < len(rel.RelatedObjects):