From 33b68592708db8a6f39930f432bf6c3ee7a6c147 Mon Sep 17 00:00:00 2001 From: jdegenstein Date: Mon, 24 Jun 2024 09:03:45 -0500 Subject: [PATCH 1/3] geometry.py -> add Plane.isometric --- src/build123d/geometry.py | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/build123d/geometry.py b/src/build123d/geometry.py index 9e66b76a..1ae89f99 100644 --- a/src/build123d/geometry.py +++ b/src/build123d/geometry.py @@ -1895,6 +1895,12 @@ def bottom(cls) -> Plane: """Bottom Plane""" return Plane((0, 0, 0), (1, 0, 0), (0, 0, -1)) + @property + def isometric(cls) -> Plane: + """Isometric Plane""" + return Plane( + (0, 0, 0), (1 / 2**0.5, 1 / 2**0.5, 0), (1 / 3**0.5, -1 / 3**0.5, 1 / 3**0.5) + ) class Plane(metaclass=PlaneMeta): """Plane @@ -1909,22 +1915,23 @@ class Plane(metaclass=PlaneMeta): Planes can be created from faces as workplanes for feature creation on objects. - ======= ====== ====== ====== - Name x_dir y_dir z_dir - ======= ====== ====== ====== - XY +x +y +z - YZ +y +z +x - ZX +z +x +y - XZ +x +z -y - YX +y +x -z - ZY +z +y -x - front +x +z -y - back -x +z +y - left -y +z -x - right +y +z +x - top +x +y +z - bottom +x -y -z - ======= ====== ====== ====== + ======= ====== ====== ====== + Name x_dir y_dir z_dir + ======= ====== ====== ====== + XY +x +y +z + YZ +y +z +x + ZX +z +x +y + XZ +x +z -y + YX +y +x -z + ZY +z +y -x + front +x +z -y + back -x +z +y + left -y +z -x + right +y +z +x + top +x +y +z + bottom +x -y -z + isometric +x+y -x+y+z +x+y-z + ======= ====== ====== ====== Args: gp_pln (gp_Pln): an OCCT plane object From d0f4fbfa62a466a7e2bfe4df015c22838a7aed2c Mon Sep 17 00:00:00 2001 From: jdegenstein Date: Mon, 24 Jun 2024 09:10:06 -0500 Subject: [PATCH 2/3] test_direct_api.py -> add test for Plane.isometric --- tests/test_direct_api.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/tests/test_direct_api.py b/tests/test_direct_api.py index b1fb1c8a..895199a3 100644 --- a/tests/test_direct_api.py +++ b/tests/test_direct_api.py @@ -2267,20 +2267,21 @@ class TestPlane(DirectApiTestCase): def test_class_properties(self): """Validate - Name x_dir y_dir z_dir - ======= ====== ====== ====== - XY +x +y +z - YZ +y +z +x - ZX +z +x +y - XZ +x +z -y - YX +y +x -z - ZY +z +y -x - front +x +z -y - back -x +z +y - left -y +z -x - right +y +z +x - top +x +y +z - bottom +x -y -z + Name x_dir y_dir z_dir + ======= ====== ====== ====== + XY +x +y +z + YZ +y +z +x + ZX +z +x +y + XZ +x +z -y + YX +y +x -z + ZY +z +y -x + front +x +z -y + back -x +z +y + left -y +z -x + right +y +z +x + top +x +y +z + bottom +x -y -z + isometric +x+y -x+y+z +x+y-z """ planes = [ (Plane.XY, (1, 0, 0), (0, 0, 1)), @@ -2295,6 +2296,7 @@ def test_class_properties(self): (Plane.right, (0, 1, 0), (1, 0, 0)), (Plane.top, (1, 0, 0), (0, 0, 1)), (Plane.bottom, (1, 0, 0), (0, 0, -1)), + (Plane.isometric, (1 / 2**0.5, 1 / 2**0.5, 0), (1 / 3**0.5, -1 / 3**0.5, 1 / 3**0.5)), ] for plane, x_dir, z_dir in planes: self.assertVectorAlmostEquals(plane.x_dir, x_dir, 5) From 5c48717f105461516df631adad8b20e260b7f335 Mon Sep 17 00:00:00 2001 From: jdegenstein Date: Mon, 24 Jun 2024 09:20:26 -0500 Subject: [PATCH 3/3] geometry.py -> table spacing enhancement --- src/build123d/geometry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build123d/geometry.py b/src/build123d/geometry.py index 1ae89f99..39a3516a 100644 --- a/src/build123d/geometry.py +++ b/src/build123d/geometry.py @@ -1931,7 +1931,7 @@ class Plane(metaclass=PlaneMeta): top +x +y +z bottom +x -y -z isometric +x+y -x+y+z +x+y-z - ======= ====== ====== ====== + ======= ====== ====== ====== Args: gp_pln (gp_Pln): an OCCT plane object