From 0acbcdb9643d12bfbfbc5cdc6340913483ac21f6 Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Wed, 12 Jun 2024 13:06:26 +0200 Subject: [PATCH 1/6] fix: typo --- .../examples/01_getting_started/05_plotter_picker.mystnb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/source/examples/01_getting_started/05_plotter_picker.mystnb b/doc/source/examples/01_getting_started/05_plotter_picker.mystnb index 46091fad79..b1eca7070d 100644 --- a/doc/source/examples/01_getting_started/05_plotter_picker.mystnb +++ b/doc/source/examples/01_getting_started/05_plotter_picker.mystnb @@ -175,8 +175,7 @@ The Python visualizer is used by default. However, you can also use ```python -plotter = GeometryPlotter -(use_trame=True) +plotter = GeometryPlotter(use_trame=True) plotter.show(plot_list) ``` From e7b295d4208ae2776c9635ce46c1df14d198d0f6 Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Wed, 12 Jun 2024 13:30:04 +0200 Subject: [PATCH 2/6] test: verifying issue 1192 --- tests/integration/test_design.py | 45 +++++++++++++++++++++++++ tests/integration/test_design_import.py | 3 +- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_design.py b/tests/integration/test_design.py index 25c89c8255..f06324597a 100644 --- a/tests/integration/test_design.py +++ b/tests/integration/test_design.py @@ -2341,3 +2341,48 @@ def test_revolve_sketch_fail(modeler: Modeler): angle=Angle(90, unit=UNITS.degrees), rotation_origin=Point3D([0, 0, 0]), ) + + +def test_temp_body_on_empty_intersect_issue1192(modeler: Modeler): + """Test demonstrating the issue when intersecting two bodies that do not intersect + and the empty temporal body that gets created.""" + # When attempting to intersect two bodies that do not intersect, no body should be + # created. However, in the past, a temporary body was created and added to the + # component. This test checks if this issue has been resolved. + design = modeler.create_design("temp-body-intersect-issue") + + # Create two bodies that do not intersect + plane = Plane( + Point3D([1 / 2, 1 / 2, 0.0]), + UNITVECTOR3D_X, + UNITVECTOR3D_Y, + ) + matrix_plane = Sketch(plane) + matrix_plane.box(Point2D([0.0, 0.0]), width=1, height=1) + matrix = design.extrude_sketch("Matrix", matrix_plane, 1) + + p = Point3D([1.0, 1.0, 1.5]) + plane = Plane(p, UNITVECTOR3D_X, UNITVECTOR3D_Y) + sketch_fibres = Sketch(plane) + sketch_fibres.circle(Point2D([0.0, 0.0]), radius=0.5) + fibre = design.extrude_sketch("fibre", sketch_fibres, 1) + + # Attempt intersection - which fails and thus deletes copy + matrix_copy = matrix.copy(design) + try: + fibre.intersect(matrix_copy) + except: + design.delete_body(matrix_copy) + + # No intersection took place... so no body should be created + # Let's read the design and check that only the two bodies are present + read_design = modeler.read_existing_design() + + # Verify the design + assert len(read_design.bodies) == 2 + assert len(read_design.bodies) == 2 + assert len(read_design.bodies[0].faces) == 6 + assert len(read_design.bodies[1].faces) == 3 + assert read_design.bodies[0].name == "Matrix" + assert read_design.bodies[1].name == "fibre" + assert len(read_design.components) == 0 diff --git a/tests/integration/test_design_import.py b/tests/integration/test_design_import.py index 6362bad359..ad19db8ed8 100644 --- a/tests/integration/test_design_import.py +++ b/tests/integration/test_design_import.py @@ -133,7 +133,6 @@ def test_design_import_with_surfaces_issue834(modeler: Modeler): For more info see https://github.com/ansys/pyansys-geometry/issues/834 """ - # TODO: to be reactivated by https://github.com/ansys/pyansys-geometry/issues/799 skip_if_linux(modeler, test_design_import_with_surfaces_issue834.__name__, "open_file") # Open the design @@ -205,7 +204,7 @@ def test_open_file(modeler: Modeler, tmp_path_factory: pytest.TempPathFactory): # IGES # # TODO: Something has gone wrong with IGES - # TODO: Issue https://github.com/ansys/pyansys-geometry/issues/801 + # TODO: Issue https://github.com/ansys/pyansys-geometry/issues/1146 # file = tmp_path_factory.mktemp("test_design_import") / "two_cars.igs" # design.download(file, DesignFileFormat.IGES) # design2 = modeler.open_file(file) From 41a6dd9bd7f589b8daaf955f8ead9b43fc6bcada Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot Date: Wed, 12 Jun 2024 11:32:25 +0000 Subject: [PATCH 3/6] Adding changelog entry: 1258.fixed.md --- doc/changelog.d/1258.fixed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/1258.fixed.md diff --git a/doc/changelog.d/1258.fixed.md b/doc/changelog.d/1258.fixed.md new file mode 100644 index 0000000000..820b5999b9 --- /dev/null +++ b/doc/changelog.d/1258.fixed.md @@ -0,0 +1 @@ +test: verifying issue with empty intersect and temporal body creation \ No newline at end of file From b96390979bc86084f88080c6910b29517be1600c Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Tue, 16 Jul 2024 14:25:58 +0200 Subject: [PATCH 4/6] fix: change test location --- tests/integration/test_design.py | 45 ------------------------------- tests/integration/test_issues.py | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 45 deletions(-) diff --git a/tests/integration/test_design.py b/tests/integration/test_design.py index 1206001099..d474f41c5f 100644 --- a/tests/integration/test_design.py +++ b/tests/integration/test_design.py @@ -2366,48 +2366,3 @@ def test_revolve_sketch_fail(modeler: Modeler): angle=Angle(90, unit=UNITS.degrees), rotation_origin=Point3D([0, 0, 0]), ) - - -def test_temp_body_on_empty_intersect_issue1192(modeler: Modeler): - """Test demonstrating the issue when intersecting two bodies that do not intersect - and the empty temporal body that gets created.""" - # When attempting to intersect two bodies that do not intersect, no body should be - # created. However, in the past, a temporary body was created and added to the - # component. This test checks if this issue has been resolved. - design = modeler.create_design("temp-body-intersect-issue") - - # Create two bodies that do not intersect - plane = Plane( - Point3D([1 / 2, 1 / 2, 0.0]), - UNITVECTOR3D_X, - UNITVECTOR3D_Y, - ) - matrix_plane = Sketch(plane) - matrix_plane.box(Point2D([0.0, 0.0]), width=1, height=1) - matrix = design.extrude_sketch("Matrix", matrix_plane, 1) - - p = Point3D([1.0, 1.0, 1.5]) - plane = Plane(p, UNITVECTOR3D_X, UNITVECTOR3D_Y) - sketch_fibres = Sketch(plane) - sketch_fibres.circle(Point2D([0.0, 0.0]), radius=0.5) - fibre = design.extrude_sketch("fibre", sketch_fibres, 1) - - # Attempt intersection - which fails and thus deletes copy - matrix_copy = matrix.copy(design) - try: - fibre.intersect(matrix_copy) - except: - design.delete_body(matrix_copy) - - # No intersection took place... so no body should be created - # Let's read the design and check that only the two bodies are present - read_design = modeler.read_existing_design() - - # Verify the design - assert len(read_design.bodies) == 2 - assert len(read_design.bodies) == 2 - assert len(read_design.bodies[0].faces) == 6 - assert len(read_design.bodies[1].faces) == 3 - assert read_design.bodies[0].name == "Matrix" - assert read_design.bodies[1].name == "fibre" - assert len(read_design.components) == 0 diff --git a/tests/integration/test_issues.py b/tests/integration/test_issues.py index 656abbd4bb..1b60b03d0d 100644 --- a/tests/integration/test_issues.py +++ b/tests/integration/test_issues.py @@ -129,3 +129,49 @@ def test_issue_1304_arc_sketch_creation(): finally: # Reverse the default units to meter DEFAULT_UNITS.LENGTH = UNITS.meter + + + +def test_issue_1192_temp_body_on_empty_intersect(modeler: Modeler): + """Test demonstrating the issue when intersecting two bodies that do not intersect + and the empty temporal body that gets created.""" + # When attempting to intersect two bodies that do not intersect, no body should be + # created. However, in the past, a temporary body was created and added to the + # component. This test checks if this issue has been resolved. + design = modeler.create_design("temp-body-intersect-issue") + + # Create two bodies that do not intersect + plane = Plane( + Point3D([1 / 2, 1 / 2, 0.0]), + UNITVECTOR3D_X, + UNITVECTOR3D_Y, + ) + matrix_plane = Sketch(plane) + matrix_plane.box(Point2D([0.0, 0.0]), width=1, height=1) + matrix = design.extrude_sketch("Matrix", matrix_plane, 1) + + p = Point3D([1.0, 1.0, 1.5]) + plane = Plane(p, UNITVECTOR3D_X, UNITVECTOR3D_Y) + sketch_fibres = Sketch(plane) + sketch_fibres.circle(Point2D([0.0, 0.0]), radius=0.5) + fibre = design.extrude_sketch("fibre", sketch_fibres, 1) + + # Attempt intersection - which fails and thus deletes copy + matrix_copy = matrix.copy(design) + try: + fibre.intersect(matrix_copy) + except: + design.delete_body(matrix_copy) + + # No intersection took place... so no body should be created + # Let's read the design and check that only the two bodies are present + read_design = modeler.read_existing_design() + + # Verify the design + assert len(read_design.bodies) == 2 + assert len(read_design.bodies) == 2 + assert len(read_design.bodies[0].faces) == 6 + assert len(read_design.bodies[1].faces) == 3 + assert read_design.bodies[0].name == "Matrix" + assert read_design.bodies[1].name == "fibre" + assert len(read_design.components) == 0 From 79dbbc7f7933cfe4630dc4cdd725ed9ddedf715b Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Tue, 16 Jul 2024 14:28:31 +0200 Subject: [PATCH 5/6] fix: pre-commit --- tests/integration/test_issues.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test_issues.py b/tests/integration/test_issues.py index 1b60b03d0d..52d77eb9f7 100644 --- a/tests/integration/test_issues.py +++ b/tests/integration/test_issues.py @@ -160,7 +160,7 @@ def test_issue_1192_temp_body_on_empty_intersect(modeler: Modeler): matrix_copy = matrix.copy(design) try: fibre.intersect(matrix_copy) - except: + except Exception: design.delete_body(matrix_copy) # No intersection took place... so no body should be created From df1dcf5f02ad2b6d1ab2d888503f99b343c2a06d Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Tue, 27 Aug 2024 09:54:59 +0000 Subject: [PATCH 6/6] chore: adding changelog file 1258.test.md --- doc/changelog.d/1258.fixed.md | 1 - doc/changelog.d/1258.test.md | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 doc/changelog.d/1258.fixed.md create mode 100644 doc/changelog.d/1258.test.md diff --git a/doc/changelog.d/1258.fixed.md b/doc/changelog.d/1258.fixed.md deleted file mode 100644 index 820b5999b9..0000000000 --- a/doc/changelog.d/1258.fixed.md +++ /dev/null @@ -1 +0,0 @@ -test: verifying issue with empty intersect and temporal body creation \ No newline at end of file diff --git a/doc/changelog.d/1258.test.md b/doc/changelog.d/1258.test.md new file mode 100644 index 0000000000..7cde69eb55 --- /dev/null +++ b/doc/changelog.d/1258.test.md @@ -0,0 +1 @@ +verifying issue with empty intersect and temporal body creation \ No newline at end of file