mirror of
https://github.com/gumyr/build123d.git
synced 2026-01-05 16:51:45 -08:00
Deprecated to_axis Issue #155
Some checks are pending
benchmarks / benchmarks (macos-13, 3.12) (push) Waiting to run
benchmarks / benchmarks (macos-14, 3.12) (push) Waiting to run
benchmarks / benchmarks (ubuntu-latest, 3.12) (push) Waiting to run
benchmarks / benchmarks (windows-latest, 3.12) (push) Waiting to run
Upload coverage reports to Codecov / run (push) Waiting to run
pylint / lint (3.10) (push) Waiting to run
Run type checker / typecheck (3.10) (push) Waiting to run
Run type checker / typecheck (3.13) (push) Waiting to run
Wheel building and publishing / Build wheel on ubuntu-latest (push) Waiting to run
Wheel building and publishing / upload_pypi (push) Blocked by required conditions
tests / tests (macos-13, 3.10) (push) Waiting to run
tests / tests (macos-13, 3.13) (push) Waiting to run
tests / tests (macos-14, 3.10) (push) Waiting to run
tests / tests (macos-14, 3.13) (push) Waiting to run
tests / tests (ubuntu-latest, 3.10) (push) Waiting to run
tests / tests (ubuntu-latest, 3.13) (push) Waiting to run
tests / tests (windows-latest, 3.10) (push) Waiting to run
tests / tests (windows-latest, 3.13) (push) Waiting to run
Some checks are pending
benchmarks / benchmarks (macos-13, 3.12) (push) Waiting to run
benchmarks / benchmarks (macos-14, 3.12) (push) Waiting to run
benchmarks / benchmarks (ubuntu-latest, 3.12) (push) Waiting to run
benchmarks / benchmarks (windows-latest, 3.12) (push) Waiting to run
Upload coverage reports to Codecov / run (push) Waiting to run
pylint / lint (3.10) (push) Waiting to run
Run type checker / typecheck (3.10) (push) Waiting to run
Run type checker / typecheck (3.13) (push) Waiting to run
Wheel building and publishing / Build wheel on ubuntu-latest (push) Waiting to run
Wheel building and publishing / upload_pypi (push) Blocked by required conditions
tests / tests (macos-13, 3.10) (push) Waiting to run
tests / tests (macos-13, 3.13) (push) Waiting to run
tests / tests (macos-14, 3.10) (push) Waiting to run
tests / tests (macos-14, 3.13) (push) Waiting to run
tests / tests (ubuntu-latest, 3.10) (push) Waiting to run
tests / tests (ubuntu-latest, 3.13) (push) Waiting to run
tests / tests (windows-latest, 3.10) (push) Waiting to run
tests / tests (windows-latest, 3.13) (push) Waiting to run
This commit is contained in:
parent
67115111e2
commit
2efd21ff58
8 changed files with 94 additions and 59 deletions
|
|
@ -33,7 +33,7 @@ import unittest
|
|||
import numpy as np
|
||||
from OCP.gp import gp_Ax1, gp_Dir, gp_Pnt
|
||||
from build123d.geometry import Axis, Location, Plane, Vector
|
||||
from build123d.topology import Edge
|
||||
from build123d.topology import Edge, Vertex
|
||||
|
||||
|
||||
class AlwaysEqual:
|
||||
|
|
@ -65,10 +65,18 @@ class TestAxis(unittest.TestCase):
|
|||
self.assertAlmostEqual(test_axis.position, (1, 2, 3), 5)
|
||||
self.assertAlmostEqual(test_axis.direction, (0, 0, 1), 5)
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
Axis("one")
|
||||
with self.assertRaises(ValueError):
|
||||
Axis("one", "up")
|
||||
with self.assertRaises(ValueError):
|
||||
Axis(one="up")
|
||||
with self.assertRaises(ValueError):
|
||||
bad_edge = Edge()
|
||||
bad_edge.wrapped = Vertex(0, 1, 2).wrapped
|
||||
Axis(edge=bad_edge)
|
||||
with self.assertRaises(ValueError):
|
||||
Axis(gp_ax1=Edge.make_line((0, 0), (1, 0)))
|
||||
|
||||
def test_axis_from_occt(self):
|
||||
occt_axis = gp_Ax1(gp_Pnt(1, 1, 1), gp_Dir(0, 1, 0))
|
||||
|
|
@ -100,6 +108,11 @@ class TestAxis(unittest.TestCase):
|
|||
self.assertAlmostEqual(y_axis.position, (0, 0, 1), 5)
|
||||
self.assertAlmostEqual(y_axis.direction, (0, 1, 0), 5)
|
||||
|
||||
def test_from_location(self):
|
||||
axis = Axis(Location((1, 2, 3), (-90, 0, 0)))
|
||||
self.assertAlmostEqual(axis.position, (1, 2, 3), 6)
|
||||
self.assertAlmostEqual(axis.direction, (0, 1, 0), 6)
|
||||
|
||||
def test_axis_to_plane(self):
|
||||
x_plane = Axis.X.to_plane()
|
||||
self.assertTrue(isinstance(x_plane, Plane))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue