From 6b7318321ba8e834bd263ada6551e3ab72d44b21 Mon Sep 17 00:00:00 2001 From: Bruno Postle Date: Mon, 23 Mar 2026 22:52:09 +0000 Subject: [PATCH] black --- .../api/geometry/copy_representation.py | 12 ++----- .../test/api/geometry/test_clip_solid.py | 1 - .../api/geometry/test_clip_solid_bounded.py | 1 - .../api/geometry/test_copy_representation.py | 34 +++++++------------ 4 files changed, 16 insertions(+), 32 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/copy_representation.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/copy_representation.py index 21843ab22a..c2b4c485a9 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/copy_representation.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/copy_representation.py @@ -61,19 +61,13 @@ def copy_representation( ifcopenshell.api.geometry.copy_representation(model, source=wall_a, target=wall_b) """ - source_rep = ifcopenshell.util.representation.get_representation( - source, "Model", context_identifier - ) + source_rep = ifcopenshell.util.representation.get_representation(source, "Model", context_identifier) if source_rep is None: return None - new_rep = ifcopenshell.util.element.copy_deep( - file, source_rep, exclude=["IfcGeometricRepresentationContext"] - ) + new_rep = ifcopenshell.util.element.copy_deep(file, source_rep, exclude=["IfcGeometricRepresentationContext"]) - existing_rep = ifcopenshell.util.representation.get_representation( - target, "Model", context_identifier - ) + existing_rep = ifcopenshell.util.representation.get_representation(target, "Model", context_identifier) if existing_rep: ifcopenshell.api.geometry.unassign_representation(file, product=target, representation=existing_rep) ifcopenshell.api.geometry.remove_representation(file, representation=existing_rep) diff --git a/src/ifcopenshell-python/test/api/geometry/test_clip_solid.py b/src/ifcopenshell-python/test/api/geometry/test_clip_solid.py index fa7a493cab..512bfcc92e 100644 --- a/src/ifcopenshell-python/test/api/geometry/test_clip_solid.py +++ b/src/ifcopenshell-python/test/api/geometry/test_clip_solid.py @@ -102,7 +102,6 @@ class TestClipSolid(test.bootstrap.IFC4): assert result.is_a("IfcBooleanClippingResult") assert result.SecondOperand.is_a("IfcHalfSpaceSolid") - def test_element_registers_result_in_bbim_boolean(self): extrusion = self.make_extrusion() wall = self.file.createIfcWall() diff --git a/src/ifcopenshell-python/test/api/geometry/test_clip_solid_bounded.py b/src/ifcopenshell-python/test/api/geometry/test_clip_solid_bounded.py index 7e79400011..3dae335cad 100644 --- a/src/ifcopenshell-python/test/api/geometry/test_clip_solid_bounded.py +++ b/src/ifcopenshell-python/test/api/geometry/test_clip_solid_bounded.py @@ -147,7 +147,6 @@ class TestClipSolidBounded(test.bootstrap.IFC4): assert result.FirstOperand == first_clip assert first_clip.FirstOperand == extrusion - def test_element_registers_result_in_bbim_boolean(self): extrusion = self.make_extrusion() wall = self.file.createIfcWall() diff --git a/src/ifcopenshell-python/test/api/geometry/test_copy_representation.py b/src/ifcopenshell-python/test/api/geometry/test_copy_representation.py index 2f7e81b4af..8faf07baa9 100644 --- a/src/ifcopenshell-python/test/api/geometry/test_copy_representation.py +++ b/src/ifcopenshell-python/test/api/geometry/test_copy_representation.py @@ -28,14 +28,18 @@ class TestCopyRepresentation(test.bootstrap.IFC4): body = ifcopenshell.util.representation.get_context(self.file, "Model", "Body", "MODEL_VIEW") if body is None: model = self.file.createIfcGeometricRepresentationContext( - ContextType="Model", CoordinateSpaceDimension=3, Precision=1e-5, + ContextType="Model", + CoordinateSpaceDimension=3, + Precision=1e-5, WorldCoordinateSystem=self.file.createIfcAxis2Placement3D( self.file.createIfcCartesianPoint((0.0, 0.0, 0.0)) ), ) body = self.file.createIfcGeometricRepresentationSubContext( - ContextIdentifier="Body", ContextType="Model", - TargetView="MODEL_VIEW", ParentContext=model, + ContextIdentifier="Body", + ContextType="Model", + TargetView="MODEL_VIEW", + ParentContext=model, ) return body @@ -52,9 +56,7 @@ class TestCopyRepresentation(test.bootstrap.IFC4): wall_b = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall") self._add_body_rep(wall_a) - result = ifcopenshell.api.geometry.copy_representation( - self.file, source=wall_a, target=wall_b - ) + result = ifcopenshell.api.geometry.copy_representation(self.file, source=wall_a, target=wall_b) assert result is not None assert result.is_a("IfcShapeRepresentation") @@ -67,9 +69,7 @@ class TestCopyRepresentation(test.bootstrap.IFC4): wall_b = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall") source_rep = self._add_body_rep(wall_a) - new_rep = ifcopenshell.api.geometry.copy_representation( - self.file, source=wall_a, target=wall_b - ) + new_rep = ifcopenshell.api.geometry.copy_representation(self.file, source=wall_a, target=wall_b) assert new_rep.id() != source_rep.id() assert new_rep.Items[0].id() != source_rep.Items[0].id() @@ -79,9 +79,7 @@ class TestCopyRepresentation(test.bootstrap.IFC4): wall_b = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall") source_rep = self._add_body_rep(wall_a) - new_rep = ifcopenshell.api.geometry.copy_representation( - self.file, source=wall_a, target=wall_b - ) + new_rep = ifcopenshell.api.geometry.copy_representation(self.file, source=wall_a, target=wall_b) assert new_rep.ContextOfItems.id() == source_rep.ContextOfItems.id() @@ -92,9 +90,7 @@ class TestCopyRepresentation(test.bootstrap.IFC4): old_rep = self._add_body_rep(wall_b) old_rep_id = old_rep.id() - ifcopenshell.api.geometry.copy_representation( - self.file, source=wall_a, target=wall_b - ) + ifcopenshell.api.geometry.copy_representation(self.file, source=wall_a, target=wall_b) try: self.file.by_id(old_rep_id) @@ -108,9 +104,7 @@ class TestCopyRepresentation(test.bootstrap.IFC4): source_rep = self._add_body_rep(wall_a) source_rep_id = source_rep.id() - ifcopenshell.api.geometry.copy_representation( - self.file, source=wall_a, target=wall_b - ) + ifcopenshell.api.geometry.copy_representation(self.file, source=wall_a, target=wall_b) assert self.file.by_id(source_rep_id) is not None # source must still exist assert ifcopenshell.util.representation.get_representation(wall_a, "Model", "Body") is not None @@ -119,9 +113,7 @@ class TestCopyRepresentation(test.bootstrap.IFC4): wall_a = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall") wall_b = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall") - result = ifcopenshell.api.geometry.copy_representation( - self.file, source=wall_a, target=wall_b - ) + result = ifcopenshell.api.geometry.copy_representation(self.file, source=wall_a, target=wall_b) assert result is None