This commit is contained in:
Andrej730
2025-07-14 16:29:07 +05:00
parent 73b76ba666
commit 72af88a4b3
6 changed files with 29 additions and 32 deletions
@@ -25,7 +25,9 @@ import math
from collections.abc import Sequence from collections.abc import Sequence
def _create_polyline_representation(file: ifcopenshell.file, alignment: entity_instance, points: Sequence[Sequence[float]]) -> None: def _create_polyline_representation(
file: ifcopenshell.file, alignment: entity_instance, points: Sequence[Sequence[float]]
) -> None:
""" """
Create geometric representation for the alignment based on an IfcPolyline Create geometric representation for the alignment based on an IfcPolyline
@@ -40,7 +42,9 @@ def _create_polyline_representation(file: ifcopenshell.file, alignment: entity_i
placement = file.createIfcLocalPlacement( placement = file.createIfcLocalPlacement(
PlacementRelTo=None, PlacementRelTo=None,
RelativePlacement=file.createIfcAxis2Placement3D(Location=file.createIfcCartesianPoint(Coordinates=(0.0, 0.0, 0.0))), RelativePlacement=file.createIfcAxis2Placement3D(
Location=file.createIfcCartesianPoint(Coordinates=(0.0, 0.0, 0.0))
),
) )
curve = file.createIfcPolyLine(Points=points) curve = file.createIfcPolyLine(Points=points)
@@ -52,6 +56,5 @@ def _create_polyline_representation(file: ifcopenshell.file, alignment: entity_i
Items=(curve,), Items=(curve,),
) )
alignment.ObjectPlacement = placement alignment.ObjectPlacement = placement
ifcopenshell.api.geometry.assign_representation(file, alignment, representation) ifcopenshell.api.geometry.assign_representation(file, alignment, representation)
@@ -77,9 +77,7 @@ def create(
# define stationing # define stationing
name = ifcopenshell.util.stationing.station_as_string(file, start_station) name = ifcopenshell.util.stationing.station_as_string(file, start_station)
referent = ifcopenshell.api.alignment.add_stationing_referent( referent = ifcopenshell.api.alignment.add_stationing_referent(file, alignment, 0.0, start_station, name)
file, alignment, 0.0, start_station, name
)
ifcopenshell.api.nest.reorder_nesting(file, referent, -1, 0) ifcopenshell.api.nest.reorder_nesting(file, referent, -1, 0)
# IFC 4.1.4.1.1 Alignment Aggregation To Project # IFC 4.1.4.1.1 Alignment Aggregation To Project
@@ -55,9 +55,7 @@ def create_as_polyline(
# define stationing # define stationing
name = ifcopenshell.util.stationing.station_as_string(file, start_station) name = ifcopenshell.util.stationing.station_as_string(file, start_station)
referent = ifcopenshell.api.alignment.add_stationing_referent( referent = ifcopenshell.api.alignment.add_stationing_referent(file, alignment, 0.0, start_station, name)
file, alignment, 0.0, start_station, name
)
ifcopenshell.api.nest.reorder_nesting(file, referent, -1, 0) ifcopenshell.api.nest.reorder_nesting(file, referent, -1, 0)
# IFC 4.1.4.1.1 Alignment Aggregation To Project # IFC 4.1.4.1.1 Alignment Aggregation To Project
@@ -69,4 +69,3 @@ def test_create():
assert ifcopenshell.api.alignment.has_zero_length_segment( assert ifcopenshell.api.alignment.has_zero_length_segment(
a a
) # there is a check in this function for the geometry curve ) # there is a check in this function for the geometry curve
@@ -40,7 +40,6 @@ def test_create_as_polyline():
file.createIfcCartesianPoint((-585.0, 3275.2, 56.2)), file.createIfcCartesianPoint((-585.0, 3275.2, 56.2)),
] ]
alignment = ifcopenshell.api.alignment.create_as_polyline(file, "A1", points) alignment = ifcopenshell.api.alignment.create_as_polyline(file, "A1", points)
curve = ifcopenshell.api.alignment.get_curve(alignment) curve = ifcopenshell.api.alignment.get_curve(alignment)
assert curve.is_a("IfcPolyline") assert curve.is_a("IfcPolyline")