From 43fbdf57c8681da0e1905e7129e81cf12d321ff0 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Thu, 28 Aug 2025 10:57:26 +0500 Subject: [PATCH] black . --- src/bonsai/bonsai/bim/module/model/wall.py | 8 ++++++-- src/bonsai/scripts/dev_environment.py | 1 - .../api/alignment/_add_segment_to_layout.py | 6 +++--- .../api/alignment/add_stationing_referent.py | 6 +++--- .../ifcopenshell/api/alignment/create.py | 13 +++++++------ .../api/alignment/create_layout_segment.py | 2 +- .../ifcopenshell/api/alignment/get_alignment.py | 1 + .../api/alignment/get_alignment_layout_nest.py | 3 ++- .../api/alignment/get_alignment_segment_nest.py | 1 + .../api/alignment/get_alignment_station.py | 1 + .../api/alignment/get_referent_nest.py | 5 +++-- .../ifcopenshell/api/alignment/util.py | 3 ++- .../api/alignment/test_add_segment_to_layout.py | 6 +++--- .../api/alignment/test_add_vertical_alignment.py | 8 ++++---- .../test/api/alignment/test_create_by_pi_method.py | 14 +++++++------- .../test/api/alignment/test_create_no_geometry.py | 2 +- .../test_horizontal_layout_by_pi_method.py | 4 ++-- .../test/api/alignment/test_name_segments.py | 3 ++- .../test/api/alignment/test_referent_names.py | 9 ++++----- .../alignment/test_vertical_layout_by_pi_method.py | 8 ++++---- 20 files changed, 57 insertions(+), 47 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/model/wall.py b/src/bonsai/bonsai/bim/module/model/wall.py index 067e37c0ae..e2826fbada 100644 --- a/src/bonsai/bonsai/bim/module/model/wall.py +++ b/src/bonsai/bonsai/bim/module/model/wall.py @@ -469,8 +469,12 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator): existing_x_angle = 0 if tool.Cad.is_x(existing_x_angle, pi, tolerance=0.001) else existing_x_angle coord_list = builder.get_polyline_coords(extrusion.SweptArea.OuterCurve) - coord_list = [(p[0], p[1] * abs(cos(existing_x_angle))) for p in coord_list] # Reset the transformation and returns to the original points with 0 degrees - coord_list = [(p[0], p[1] * abs(1 / cos(x_angle))) for p in coord_list] # Apply the transformation for the new x_angle + coord_list = [ + (p[0], p[1] * abs(cos(existing_x_angle))) for p in coord_list + ] # Reset the transformation and returns to the original points with 0 degrees + coord_list = [ + (p[0], p[1] * abs(1 / cos(x_angle))) for p in coord_list + ] # Apply the transformation for the new x_angle builder.set_polyline_coords(extrusion.SweptArea.OuterCurve, coord_list) # The extrusion direction calculated previously default to the positive direction diff --git a/src/bonsai/scripts/dev_environment.py b/src/bonsai/scripts/dev_environment.py index cff36d8320..55d3fc2a77 100644 --- a/src/bonsai/scripts/dev_environment.py +++ b/src/bonsai/scripts/dev_environment.py @@ -50,7 +50,6 @@ else: raise RuntimeError("Unsupported platform") - BONSAI_PATH_CANDIDATES = ( # Installed from Bonsai Unstalble Repo. BLENDER_PATH / r"extensions/raw_githubusercontent_com/bonsai", diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_layout.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_layout.py index 4baf0a4e8f..b6e10113a7 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_layout.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_layout.py @@ -137,7 +137,7 @@ def _add_segment_to_layout(file: ifcopenshell.file, layout: entity_instance, seg start_dist_along = segment.DesignParameters.StartDistAlong + segment.DesignParameters.HorizontalLength zero_length_segment.DesignParameters.StartDistAlong = start_dist_along - referent_nest = ifcopenshell.api.alignment.get_referent_nest(file,layout) + referent_nest = ifcopenshell.api.alignment.get_referent_nest(file, layout) end_referent = referent_nest.RelatedObjects[-1] end_referent.Name = f"{_get_segment_start_point_label(zero_length_segment,None)} ({ifcopenshell.util.alignment.station_as_string(file,start_station+start_dist_along)})" @@ -180,13 +180,13 @@ def _add_segment_to_layout(file: ifcopenshell.file, layout: entity_instance, seg referent = ifcopenshell.api.alignment.add_stationing_referent( file, layout, distance_along=dist_along, station=station, name=name, positioned_product=segment ) - ifcopenshell.api.nest.reorder_nesting(file,referent,-1,-1) + ifcopenshell.api.nest.reorder_nesting(file, referent, -1, -1) if len(curve.Segments) == 2 and layout.is_a("IfcAlignmentHorizontal"): # this is the first real segment in the horizontal alignment # update the location of the alignment's stationing referent alignment = ifcopenshell.api.alignment.get_alignment(layout) - ref_nest = ifcopenshell.api.alignment.get_referent_nest(file,alignment) + ref_nest = ifcopenshell.api.alignment.get_referent_nest(file, alignment) stationing_referent = ref_nest.RelatedObjects[0] p = curve_evaluator.evaluate( stationing_referent.ObjectPlacement.RelativePlacement.Location.DistanceAlong.wrappedValue 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 2c68fbb2a4..c1590164e9 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/add_stationing_referent.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/add_stationing_referent.py @@ -34,7 +34,7 @@ def add_stationing_referent( distance_along: float, station: float, name: str, - positioned_product: entity_instance + positioned_product: entity_instance, ) -> entity_instance: """ Adds an IfcReferent to the element with the Pset_Stationing property set. @@ -44,7 +44,7 @@ def add_stationing_referent( :param distance_along: distance along the alignment curve :param station: station value :param name: name to assign to IfcReferent.Name, typically a stringized version of the station value - :param positioned_product: the product whose position is informed by the referent + :param positioned_product: the product whose position is informed by the referent :return: referent Example: @@ -144,7 +144,7 @@ def add_stationing_referent( pset_stationing = ifcopenshell.api.pset.add_pset(file, product=referent, name="Pset_Stationing") ifcopenshell.api.pset.edit_pset(file, pset=pset_stationing, properties={"Station": station}) - nest = ifcopenshell.api.alignment.get_referent_nest(file,element) + nest = ifcopenshell.api.alignment.get_referent_nest(file, element) nest.RelatedObjects += (referent,) if len(referent.Positions) == 0: diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/create.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/create.py index 67c3757bcb..daa44ed460 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/create.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/create.py @@ -37,15 +37,15 @@ def create( start_station: float = 0.0, ) -> entity_instance: """ - Creates a new alignment with a horizontal layout. Optionally, vertical and cant layouts can be created as well. - The geometric representations are created as well, unless they are explicitly excluded. - Zero length segments are added at the end of the layouts and geometric representations. + Creates a new alignment with a horizontal layout. Optionally, vertical and cant layouts can be created as well. + The geometric representations are created as well, unless they are explicitly excluded. + Zero length segments are added at the end of the layouts and geometric representations. The alignment is automatically aggreated to the project if it exists. Use get_horizontal_layout(alignment), get_vertical_layout(alignment) and get_cant_layout(alignment) to get the corresponding IfcAlignmentHorizontal, IfcAlignmentVertical, and IfcAlignmentCant layout entities. - If the alignment has Viennese Bend transition curves, create the segments in the cant layout before the horizontal layout using create_layout_segment(). + If the alignment has Viennese Bend transition curves, create the segments in the cant layout before the horizontal layout using create_layout_segment(). The horizontal geometry in the Viennese Bend transition curves depends on the Viennese Bend cant parameters. create_layout_segment() automatically creates the geometric representation from the semantic definition. The horizontal segment geometric representation will fail if the cant segment is not defined. @@ -86,8 +86,9 @@ def create( if include_geometry: # define stationing name = ifcopenshell.util.alignment.station_as_string(file, start_station) - referent = ifcopenshell.api.alignment.add_stationing_referent(file, alignment, 0.0, start_station, name, alignment) - + referent = ifcopenshell.api.alignment.add_stationing_referent( + file, alignment, 0.0, start_station, name, alignment + ) # IFC 4.1.4.1.1 Alignment Aggregation To Project project = file.by_type("IfcProject")[0] diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/create_layout_segment.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/create_layout_segment.py index 1cf7ac9386..3f6789fd98 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/create_layout_segment.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/create_layout_segment.py @@ -60,7 +60,7 @@ def create_layout_segment( # returned and used when defining the next segment alignment = ifcopenshell.api.alignment.get_alignment(layout) curve = ifcopenshell.api.alignment.get_curve(alignment) - + if curve: if layout.is_a("IfcAlignmentHorizontal"): if curve.is_a("IfcGradientCurve"): diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment.py index 3086bac669..850ee12ca9 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment.py @@ -18,6 +18,7 @@ from ifcopenshell import entity_instance + def get_alignment(layout: entity_instance) -> entity_instance: """ Returns the alignment that nests this layout diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_layout_nest.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_layout_nest.py index 495157ce14..b870fd1692 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_layout_nest.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_layout_nest.py @@ -19,11 +19,12 @@ import ifcopenshell from ifcopenshell import entity_instance + def get_alignment_layout_nest(alignment: entity_instance) -> entity_instance: """ Searches for the IfcRelNest that contains IfcAlignmentHorizontal, IfcAlignmentVertical, or IfcAlignmentCant - :param alignment: the alignment + :param alignment: the alignment :return: Returns the IfcRelNests containing the alignment layout """ layout_types = ["IfcAlignmentHorizontal", "IfcAlignmentVertical", "IfcAlignmentCant"] diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_segment_nest.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_segment_nest.py index 49cb7628e5..fba39617ea 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_segment_nest.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_segment_nest.py @@ -19,6 +19,7 @@ import ifcopenshell from ifcopenshell import entity_instance + def get_alignment_segment_nest(layout: entity_instance) -> entity_instance: """ Searches for the IfcRelNest that contains IfcAlignmentSegment diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_station.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_station.py index 9ca8120bf3..313ab949a7 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_station.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_station.py @@ -21,6 +21,7 @@ import ifcopenshell.api.alignment import ifcopenshell.util.element from ifcopenshell import entity_instance + def get_alignment_station(file: ifcopenshell.file, alignment: entity_instance) -> float: """ Returns the start station of the alignment. If the alignment is nested by an IfcReferent diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/get_referent_nest.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/get_referent_nest.py index 74eab17056..0efad8c3cb 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/get_referent_nest.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/get_referent_nest.py @@ -19,7 +19,8 @@ import ifcopenshell from ifcopenshell import entity_instance -def get_referent_nest(file: ifcopenshell.file,entity: entity_instance) -> entity_instance: + +def get_referent_nest(file: ifcopenshell.file, entity: entity_instance) -> entity_instance: """ Searches for the IfcRelNest that contains IfcReferent. If one is not found, a empty IfcRelNests is created. @@ -32,5 +33,5 @@ def get_referent_nest(file: ifcopenshell.file,entity: entity_instance) -> entity if related_object.is_a("IfcReferent"): return nest - nest = file.createIfcRelNests(GlobalId=ifcopenshell.guid.new(),RelatingObject=entity,RelatedObjects=[]) + nest = file.createIfcRelNests(GlobalId=ifcopenshell.guid.new(), RelatingObject=entity, RelatedObjects=[]) return nest diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/util.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/util.py index f0295b331b..389f94576a 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/util.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/util.py @@ -163,10 +163,11 @@ def print_composite_curve_deep(curve): print(" " * 4, segment.Placement.Location) print(" " * 4, segment.Placement.RefDirection) + def print_positioned_products(file: ifcopenshell.file): referents = file.by_type("IfcReferent") for referent in referents: print(referent) for rel in referent.Positions: for product in rel.RelatedProducts: - print(" " * 2,product) \ No newline at end of file + print(" " * 2, product) diff --git a/src/ifcopenshell-python/test/api/alignment/test_add_segment_to_layout.py b/src/ifcopenshell-python/test/api/alignment/test_add_segment_to_layout.py index 1b0e72c51c..6ca593f7dd 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_add_segment_to_layout.py +++ b/src/ifcopenshell-python/test/api/alignment/test_add_segment_to_layout.py @@ -68,10 +68,10 @@ def test_add_segment_to_layout(): _add_segment_to_layout(file, horizontal_alignment, alignment_segment) assert len(horizontal_alignment.IsNestedBy) == 2 - referent_nest = ifcopenshell.api.alignment.get_referent_nest(file,horizontal_alignment) + referent_nest = ifcopenshell.api.alignment.get_referent_nest(file, horizontal_alignment) segment_nest = ifcopenshell.api.alignment.get_alignment_segment_nest(horizontal_alignment) - assert (len(segment_nest.RelatedObjects) == 2) - assert (len(referent_nest.RelatedObjects) == 2) + assert len(segment_nest.RelatedObjects) == 2 + assert len(referent_nest.RelatedObjects) == 2 test_add_segment_to_layout() diff --git a/src/ifcopenshell-python/test/api/alignment/test_add_vertical_alignment.py b/src/ifcopenshell-python/test/api/alignment/test_add_vertical_alignment.py index 6287d28738..70247f97e5 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_add_vertical_alignment.py +++ b/src/ifcopenshell-python/test/api/alignment/test_add_vertical_alignment.py @@ -33,8 +33,8 @@ def test_add_vertical_alignment(): assert len(alignment.IsDecomposedBy) == 0 # no child alignments assert len(alignment.IsNestedBy) == 2 # nests for layout and referents - assert len(alignment.IsNestedBy[0].RelatedObjects) == 1 - assert ifcopenshell.api.alignment.get_referent_nest(file,alignment).RelatedObjects[0].is_a("IfcReferent") + assert len(alignment.IsNestedBy[0].RelatedObjects) == 1 + assert ifcopenshell.api.alignment.get_referent_nest(file, alignment).RelatedObjects[0].is_a("IfcReferent") assert alignment.IsNestedBy[0].RelatedObjects[0].is_a("IfcAlignmentHorizontal") curve = ifcopenshell.api.alignment.get_curve(alignment) assert curve.is_a("IfcCompositeCurve") @@ -43,7 +43,7 @@ def test_add_vertical_alignment(): assert len(alignment.IsDecomposedBy) == 0 # no child alignments assert len(alignment.IsNestedBy) == 2 - assert (len(alignment.IsNestedBy[0].RelatedObjects) == 2) + assert len(alignment.IsNestedBy[0].RelatedObjects) == 2 assert alignment.IsNestedBy[0].RelatedObjects[0].is_a("IfcAlignmentHorizontal") assert alignment.IsNestedBy[0].RelatedObjects[1].is_a("IfcAlignmentVertical") curve = ifcopenshell.api.alignment.get_curve(alignment) @@ -53,7 +53,7 @@ def test_add_vertical_alignment(): vertical_layout = ifcopenshell.api.alignment.add_vertical_layout(file, alignment) assert len(alignment.IsDecomposedBy) == 1 # 1 IfcRelAggreates relationship for the child algiments - assert (len(alignment.IsDecomposedBy[0].RelatedObjects) == 2) + assert len(alignment.IsDecomposedBy[0].RelatedObjects) == 2 for child_alignment in alignment.IsDecomposedBy[0].RelatedObjects: assert child_alignment.is_a("IfcAlignment") diff --git a/src/ifcopenshell-python/test/api/alignment/test_create_by_pi_method.py b/src/ifcopenshell-python/test/api/alignment/test_create_by_pi_method.py index 4486db600a..4b3b0d3c8d 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_create_by_pi_method.py +++ b/src/ifcopenshell-python/test/api/alignment/test_create_by_pi_method.py @@ -49,19 +49,19 @@ def test_create_by_pi_method(): assert len(alignment.IsNestedBy) == 2 layout_nest = ifcopenshell.api.alignment.get_alignment_layout_nest(alignment) - assert (len(layout_nest.RelatedObjects) == 2) + assert len(layout_nest.RelatedObjects) == 2 horizontal_layout = ifcopenshell.api.alignment.get_horizontal_layout(alignment) horizontal_segment_nest = ifcopenshell.api.alignment.get_alignment_segment_nest(horizontal_layout) - assert (len(horizontal_segment_nest.RelatedObjects) == 8) - horizontal_referent_nest = ifcopenshell.api.alignment.get_referent_nest(file,horizontal_layout) - assert (len(horizontal_referent_nest.RelatedObjects) == 8) + assert len(horizontal_segment_nest.RelatedObjects) == 8 + horizontal_referent_nest = ifcopenshell.api.alignment.get_referent_nest(file, horizontal_layout) + assert len(horizontal_referent_nest.RelatedObjects) == 8 vertical_layout = ifcopenshell.api.alignment.get_vertical_layout(alignment) vertical_segment_nest = ifcopenshell.api.alignment.get_alignment_segment_nest(vertical_layout) - assert (len(vertical_segment_nest.RelatedObjects) == 10) - vertical_referent_nest = ifcopenshell.api.alignment.get_referent_nest(file,vertical_layout) - assert (len(vertical_referent_nest.RelatedObjects) == 10) + assert len(vertical_segment_nest.RelatedObjects) == 10 + vertical_referent_nest = ifcopenshell.api.alignment.get_referent_nest(file, vertical_layout) + assert len(vertical_referent_nest.RelatedObjects) == 10 test_create_by_pi_method() diff --git a/src/ifcopenshell-python/test/api/alignment/test_create_no_geometry.py b/src/ifcopenshell-python/test/api/alignment/test_create_no_geometry.py index 308525fbe0..15b64af2f9 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_create_no_geometry.py +++ b/src/ifcopenshell-python/test/api/alignment/test_create_no_geometry.py @@ -29,7 +29,7 @@ def test_create_no_geometry(): ifcopenshell.api.unit.assign_unit(file, units=[length]) # creates an IfcAlignment with an IfcAlignmentHorizontal layout containing only the zero length segment - ali = ifcopenshell.api.alignment.create(file, "A1", include_vertical=True,include_geometry=False) + ali = ifcopenshell.api.alignment.create(file, "A1", include_vertical=True, include_geometry=False) # append a segment to the horizontal layout horizontal_alignment = ifcopenshell.api.alignment.get_horizontal_layout(ali) diff --git a/src/ifcopenshell-python/test/api/alignment/test_horizontal_layout_by_pi_method.py b/src/ifcopenshell-python/test/api/alignment/test_horizontal_layout_by_pi_method.py index c500d3d66e..a4678f7e0e 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_horizontal_layout_by_pi_method.py +++ b/src/ifcopenshell-python/test/api/alignment/test_horizontal_layout_by_pi_method.py @@ -46,12 +46,12 @@ def test_horizontal_layout_by_pi_method(): assert len(alignment.IsDecomposedBy) == 0 # no child alignments assert len(alignment.IsNestedBy) == 2 - referent_nest = ifcopenshell.api.alignment.get_referent_nest(file,alignment) + referent_nest = ifcopenshell.api.alignment.get_referent_nest(file, alignment) layout_nest = ifcopenshell.api.alignment.get_alignment_layout_nest(alignment) assert referent_nest.RelatedObjects[0].is_a("IfcReferent") assert layout_nest.RelatedObjects[0].is_a("IfcAlignmentHorizontal") segment_nest = ifcopenshell.api.alignment.get_alignment_segment_nest(layout_nest.RelatedObjects[0]) - assert (len(segment_nest.RelatedObjects) == 3) # segments in horizontal layout + assert len(segment_nest.RelatedObjects) == 3 # segments in horizontal layout test_horizontal_layout_by_pi_method() diff --git a/src/ifcopenshell-python/test/api/alignment/test_name_segments.py b/src/ifcopenshell-python/test/api/alignment/test_name_segments.py index ee84bcde85..5a1174573b 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_name_segments.py +++ b/src/ifcopenshell-python/test/api/alignment/test_name_segments.py @@ -55,4 +55,5 @@ def test_name_segments(): assert f"Q{i}" == segment.Name i += 1 -test_name_segments() \ No newline at end of file + +test_name_segments() diff --git a/src/ifcopenshell-python/test/api/alignment/test_referent_names.py b/src/ifcopenshell-python/test/api/alignment/test_referent_names.py index 06c0bad61b..6939190d5f 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_referent_names.py +++ b/src/ifcopenshell-python/test/api/alignment/test_referent_names.py @@ -98,7 +98,7 @@ def callback_alignment(): def test_with_default_names(default_names_alignment): hlayout = ifcopenshell.api.alignment.get_horizontal_layout(default_names_alignment) - referent_nest = ifcopenshell.api.alignment.get_referent_nest(None,hlayout) + referent_nest = ifcopenshell.api.alignment.get_referent_nest(None, hlayout) assert "P.O.B." in referent_nest.RelatedObjects[0].Name assert "P.C." in referent_nest.RelatedObjects[1].Name @@ -106,7 +106,7 @@ def test_with_default_names(default_names_alignment): assert "P.O.E." in referent_nest.RelatedObjects[-1].Name vlayout = ifcopenshell.api.alignment.get_vertical_layout(default_names_alignment) - referent_nest = ifcopenshell.api.alignment.get_referent_nest(None,vlayout) + referent_nest = ifcopenshell.api.alignment.get_referent_nest(None, vlayout) assert "V.P.O.B." in referent_nest.RelatedObjects[0].Name assert "P.V.C." in referent_nest.RelatedObjects[1].Name @@ -116,7 +116,7 @@ def test_with_default_names(default_names_alignment): def test_with_callbacks(callback_alignment): hlayout = ifcopenshell.api.alignment.get_horizontal_layout(callback_alignment) - referent_nest = ifcopenshell.api.alignment.get_referent_nest(None,hlayout) + referent_nest = ifcopenshell.api.alignment.get_referent_nest(None, hlayout) assert "A" in referent_nest.RelatedObjects[0].Name assert "Q" in referent_nest.RelatedObjects[1].Name @@ -124,10 +124,9 @@ def test_with_callbacks(callback_alignment): assert "Z" in referent_nest.RelatedObjects[-1].Name vlayout = ifcopenshell.api.alignment.get_vertical_layout(callback_alignment) - referent_nest = ifcopenshell.api.alignment.get_referent_nest(None,vlayout) + referent_nest = ifcopenshell.api.alignment.get_referent_nest(None, vlayout) assert "a" in referent_nest.RelatedObjects[0].Name assert "q" in referent_nest.RelatedObjects[1].Name assert "q" in referent_nest.RelatedObjects[2].Name assert "z" in referent_nest.RelatedObjects[-1].Name - diff --git a/src/ifcopenshell-python/test/api/alignment/test_vertical_layout_by_pi_method.py b/src/ifcopenshell-python/test/api/alignment/test_vertical_layout_by_pi_method.py index 9d39cf4b36..5315070937 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_vertical_layout_by_pi_method.py +++ b/src/ifcopenshell-python/test/api/alignment/test_vertical_layout_by_pi_method.py @@ -59,12 +59,12 @@ def test_vertical_layout_by_pi_method(): assert len(alignment.IsDecomposedBy) == 0 # no child alignments assert len(alignment.IsNestedBy) == 2 - referent_nest = ifcopenshell.api.alignment.get_referent_nest(file,alignment) + referent_nest = ifcopenshell.api.alignment.get_referent_nest(file, alignment) layout_nest = ifcopenshell.api.alignment.get_alignment_layout_nest(alignment) - assert(len(referent_nest.RelatedObjects) == 1) - assert(len(layout_nest.RelatedObjects) == 2) + assert len(referent_nest.RelatedObjects) == 1 + assert len(layout_nest.RelatedObjects) == 2 segment_nest = ifcopenshell.api.alignment.get_alignment_segment_nest(vlayout) - assert(len(segment_nest.RelatedObjects) == 3) + assert len(segment_nest.RelatedObjects) == 3 test_vertical_layout_by_pi_method()