| 1 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 2 |
|
| 3 |
from Metadata import export |
| 4 |
from PyObjectBase import PyObjectBase |
| 5 |
from Vector import Vector |
| 6 |
from Placement import Placement |
| 7 |
from Axis import Axis |
| 8 |
from typing import overload |
| 9 |
|
| 10 |
@export( |
| 11 |
Constructor=True, |
| 12 |
Delete=True, |
| 13 |
) |
| 14 |
class Axis(PyObjectBase): |
| 15 |
""" |
| 16 |
Base.Axis class. |
| 17 |
|
| 18 |
An Axis defines a direction and a position (base) in 3D space. |
| 19 |
|
| 20 |
The following constructors are supported: |
| 21 |
|
| 22 |
Axis() |
| 23 |
Empty constructor. |
| 24 |
|
| 25 |
Axis(axis) |
| 26 |
Copy constructor. |
| 27 |
axis : Base.Axis |
| 28 |
|
| 29 |
Axis(base, direction) |
| 30 |
Define from a position and a direction. |
| 31 |
base : Base.Vector |
| 32 |
direction : Base.Vector |
| 33 |
""" |
| 34 |
|
| 35 |
Base: Vector = ... |
| 36 |
"""Base position vector of the Axis.""" |
| 37 |
|
| 38 |
Direction: Vector = ... |
| 39 |
"""Direction vector of the Axis.""" |
| 40 |
|
| 41 |
# fmt: off |
| 42 |
@overload |
| 43 |
def __init__(self) -> None: ... |
| 44 |
@overload |
| 45 |
def __init__(self, axis: Axis) -> None: ... |
| 46 |
@overload |
| 47 |
def __init__(self, base: Vector, direction: Vector) -> None: ... |
| 48 |
# fmt: on |
| 49 |
|
| 50 |
def copy(self) -> Axis: |
| 51 |
""" |
| 52 |
copy() -> Base.Axis |
| 53 |
|
| 54 |
Returns a copy of this Axis. |
| 55 |
""" |
| 56 |
... |
| 57 |
|
| 58 |
def move(self, vector: Vector) -> None: |
| 59 |
""" |
| 60 |
move(vector) -> None |
| 61 |
|
| 62 |
Move the axis base along the given vector. |
| 63 |
|
| 64 |
vector : Base.Vector |
| 65 |
Vector by which to move the axis. |
| 66 |
""" |
| 67 |
... |
| 68 |
|
| 69 |
def multiply(self, placement: Placement) -> Axis: |
| 70 |
""" |
| 71 |
multiply(placement) -> Base.Axis |
| 72 |
|
| 73 |
Multiply this axis by a placement. |
| 74 |
|
| 75 |
placement : Base.Placement |
| 76 |
Placement by which to multiply the axis. |
| 77 |
""" |
| 78 |
... |
| 79 |
|
| 80 |
def reversed(self) -> Axis: |
| 81 |
""" |
| 82 |
reversed() -> Base.Axis |
| 83 |
|
| 84 |
Compute the reversed axis. This returns a new Base.Axis with |
| 85 |
the original direction reversed. |
| 86 |
""" |
| 87 |
... |