mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
black
This commit is contained in:
@@ -152,10 +152,7 @@ def _add_segment_to_curve(file: ifcopenshell.file, segment: entity_instance, cur
|
||||
axis_geom_subcontext = ifcopenshell.api.alignment.get_axis_subcontext(file)
|
||||
|
||||
axis_representation = file.createIfcShapeRepresentation(
|
||||
ContextOfItems=axis_geom_subcontext,
|
||||
RepresentationIdentifier="Axis",
|
||||
RepresentationType="Segment",
|
||||
Items = items
|
||||
ContextOfItems=axis_geom_subcontext, RepresentationIdentifier="Axis", RepresentationType="Segment", Items=items
|
||||
)
|
||||
|
||||
product = file.createIfcProductDefinitionShape(Representations=(axis_representation,))
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ def _create_offset_curve_representation(
|
||||
expected_type = "IfcAlignment"
|
||||
if not alignment.is_a(expected_type):
|
||||
raise TypeError(f"Expected {expected_type} but got {alignment.is_a()}")
|
||||
|
||||
|
||||
expected_type = "IfcPointByDistanceExpression"
|
||||
for offset in offsets:
|
||||
if not offset.is_a(expected_type):
|
||||
|
||||
@@ -71,9 +71,7 @@ def clear_layout_segments(file: ifcopenshell.file, layout: entity_instance) -> N
|
||||
"""
|
||||
expected_types = ["IfcAlignmentHorizontal", "IfcAlignmentVertical", "IfcAlignmentCant"]
|
||||
if layout.is_a() not in expected_types:
|
||||
raise TypeError(
|
||||
f"Expected entity type to be one of {expected_types}, instead received {layout.is_a()}"
|
||||
)
|
||||
raise TypeError(f"Expected entity type to be one of {expected_types}, instead received {layout.is_a()}")
|
||||
|
||||
# Get the geometric curve for this layout
|
||||
curve = ifcopenshell.api.alignment.get_layout_curve(layout)
|
||||
|
||||
@@ -32,7 +32,7 @@ def get_alignment_layout(segment: entity_instance) -> entity_instance:
|
||||
)
|
||||
|
||||
layout = None
|
||||
layouts=["IfcAlignmentHorizontal","IfcAlignmentVertical","IfcAlignmentCant"]
|
||||
layouts = ["IfcAlignmentHorizontal", "IfcAlignmentVertical", "IfcAlignmentCant"]
|
||||
for nest in segment.Nests:
|
||||
if nest.RelatingObject.is_a() in layouts:
|
||||
layout = nest.RelatingObject
|
||||
|
||||
@@ -63,15 +63,21 @@ def evaluate_segment(segment: entity_instance, dist_along: float) -> np.ndarray:
|
||||
|
||||
# Validate dist_along is within segment bounds
|
||||
# SegmentLength can be negative (indicates curve direction), so we need to handle both cases
|
||||
seg_len = segment.SegmentLength.wrappedValue if hasattr(segment.SegmentLength, 'wrappedValue') else segment.SegmentLength
|
||||
seg_len = (
|
||||
segment.SegmentLength.wrappedValue if hasattr(segment.SegmentLength, "wrappedValue") else segment.SegmentLength
|
||||
)
|
||||
if seg_len >= 0:
|
||||
# Positive length: valid range is 0 to seg_len
|
||||
if dist_along < 0 or dist_along > seg_len:
|
||||
raise ValueError(f"Provided value {dist_along=} is beyond the end of the segment ({segment.SegmentLength}).")
|
||||
raise ValueError(
|
||||
f"Provided value {dist_along=} is beyond the end of the segment ({segment.SegmentLength})."
|
||||
)
|
||||
else:
|
||||
# Negative length: valid range is seg_len to 0
|
||||
if dist_along > 0 or dist_along < seg_len:
|
||||
raise ValueError(f"Provided value {dist_along=} is beyond the end of the segment ({segment.SegmentLength}).")
|
||||
raise ValueError(
|
||||
f"Provided value {dist_along=} is beyond the end of the segment ({segment.SegmentLength})."
|
||||
)
|
||||
|
||||
s = ifcopenshell.geom.settings()
|
||||
function_item = ifcopenshell_wrapper.map_shape(s, segment.wrapped_data)
|
||||
|
||||
Reference in New Issue
Block a user