diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/_create_polyline_representation.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/_create_polyline_representation.py index 5c5b423e66..97b78cfd04 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/_create_polyline_representation.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/_create_polyline_representation.py @@ -25,7 +25,9 @@ import math 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 @@ -40,9 +42,11 @@ def _create_polyline_representation(file: ifcopenshell.file, alignment: entity_i placement = file.createIfcLocalPlacement( 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) representation = file.createIfcShapeRepresentation( @@ -52,6 +56,5 @@ def _create_polyline_representation(file: ifcopenshell.file, alignment: entity_i Items=(curve,), ) - alignment.ObjectPlacement = placement ifcopenshell.api.geometry.assign_representation(file, alignment, representation) diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/add_stationing_referent.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/add_stationing_referent.py index 0c3af185ac..74e145044b 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/add_stationing_referent.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/add_stationing_referent.py @@ -102,11 +102,11 @@ def add_stationing_referent( ay = float(p[1, 2]) az = float(p[2, 2]) - object_placement.CartesianPosition=file.createIfcAxis2Placement3D( - Location=file.createIfcCartesianPoint((x, y, z)), - Axis=file.createIfcDirection((ax, ay, az)), - RefDirection=file.createIfcDirection((rx, ry, rz)), - ) + object_placement.CartesianPosition = file.createIfcAxis2Placement3D( + Location=file.createIfcCartesianPoint((x, y, z)), + Axis=file.createIfcDirection((ax, ay, az)), + RefDirection=file.createIfcDirection((rx, ry, rz)), + ) # this commented out code is what you would do to add a geometric representation of the referent # the example is a circle. a better way would be to pass a representation into the function # representation = file.create_entity( diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/create.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/create.py index d54c57a32f..e31826ce3b 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/create.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/create.py @@ -77,9 +77,7 @@ def create( # define stationing name = ifcopenshell.util.stationing.station_as_string(file, start_station) - referent = ifcopenshell.api.alignment.add_stationing_referent( - file, alignment, 0.0, start_station, name - ) + referent = ifcopenshell.api.alignment.add_stationing_referent(file, alignment, 0.0, start_station, name) ifcopenshell.api.nest.reorder_nesting(file, referent, -1, 0) # IFC 4.1.4.1.1 Alignment Aggregation To Project @@ -87,4 +85,4 @@ def create( if project: ifcopenshell.api.aggregate.assign_object(file, products=[alignment], relating_object=project) - return alignment \ No newline at end of file + return alignment diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/create_as_polyline.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/create_as_polyline.py index feae6afc92..826e8226dd 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/create_as_polyline.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/create_as_polyline.py @@ -55,9 +55,7 @@ def create_as_polyline( # define stationing name = ifcopenshell.util.stationing.station_as_string(file, start_station) - referent = ifcopenshell.api.alignment.add_stationing_referent( - file, alignment, 0.0, start_station, name - ) + referent = ifcopenshell.api.alignment.add_stationing_referent(file, alignment, 0.0, start_station, name) ifcopenshell.api.nest.reorder_nesting(file, referent, -1, 0) # IFC 4.1.4.1.1 Alignment Aggregation To Project @@ -65,4 +63,4 @@ def create_as_polyline( if project: ifcopenshell.api.aggregate.assign_object(file, products=[alignment], relating_object=project) - return alignment \ No newline at end of file + return alignment diff --git a/src/ifcopenshell-python/test/api/alignment/test_create.py b/src/ifcopenshell-python/test/api/alignment/test_create.py index 8a068e66f8..d08d486417 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_create.py +++ b/src/ifcopenshell-python/test/api/alignment/test_create.py @@ -69,4 +69,3 @@ def test_create(): assert ifcopenshell.api.alignment.has_zero_length_segment( a ) # there is a check in this function for the geometry curve - diff --git a/src/ifcopenshell-python/test/api/alignment/test_create_as_polyline.py b/src/ifcopenshell-python/test/api/alignment/test_create_as_polyline.py index 84650c08d1..dac7d3156b 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_create_as_polyline.py +++ b/src/ifcopenshell-python/test/api/alignment/test_create_as_polyline.py @@ -28,23 +28,22 @@ def test_create_as_polyline(): ifcopenshell.api.unit.assign_unit(file, units=[length]) points = [ - file.createIfcCartesianPoint((945.2, 583.6, 50.0)), - file.createIfcCartesianPoint((756.3, 871.7, 66.2)), - file.createIfcCartesianPoint(( 567.4, 1159.7, 78.5)), - file.createIfcCartesianPoint(( 379.4, 1448.3, 86.8)), - file.createIfcCartesianPoint(( 201.7, 1743.3, 91.1)), - file.createIfcCartesianPoint(( 36.8, 2045.7, 91.3)), - file.createIfcCartesianPoint((-118.9, 2353.0, 87.5)), - file.createIfcCartesianPoint((-274.3, 2660.4, 79.7)), - file.createIfcCartesianPoint((-429.6, 2967.8, 68.3)), - file.createIfcCartesianPoint((-585.0, 3275.2, 56.2 )), - ] + file.createIfcCartesianPoint((945.2, 583.6, 50.0)), + file.createIfcCartesianPoint((756.3, 871.7, 66.2)), + file.createIfcCartesianPoint((567.4, 1159.7, 78.5)), + file.createIfcCartesianPoint((379.4, 1448.3, 86.8)), + file.createIfcCartesianPoint((201.7, 1743.3, 91.1)), + file.createIfcCartesianPoint((36.8, 2045.7, 91.3)), + file.createIfcCartesianPoint((-118.9, 2353.0, 87.5)), + file.createIfcCartesianPoint((-274.3, 2660.4, 79.7)), + file.createIfcCartesianPoint((-429.6, 2967.8, 68.3)), + 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) assert curve.is_a("IfcPolyline") assert len(curve.Points) == 10 -test_create_as_polyline() \ No newline at end of file +test_create_as_polyline()