File size: 2,200 Bytes
985c397 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | # SPDX-License-Identifier: LGPL-2.1-or-later
from __future__ import annotations
from typing import Any, Final, overload, Union
from Base.Metadata import constmethod, export
from Base.Persistence import Persistence
from .Command import Command
@export(
Include="Mod/CAM/App/Path.h",
Twin="Toolpath",
TwinPointer="Toolpath",
Namespace="Path",
Delete=True,
Constructor=True,
)
class Path(Persistence):
"""
Path([commands]): Represents a basic Gcode path
commands (optional) is a list of Path commands
Author: Yorik van Havre (yorik@uncreated.net)
License: LGPL-2.1-or-later
"""
@overload
def addCommands(self, command: Command, /) -> Path: ...
@overload
def addCommands(self, commands: list[Command], /) -> Path: ...
def addCommands(self, arg: Union[Command, list[Command]], /) -> Path:
"""adds a command or a list of commands at the end of the path"""
...
def insertCommand(self, command: Command, pos: int = -1, /) -> Path:
"""
adds a command at the given position or at the end of the path
"""
...
def deleteCommand(self, pos: int = -1, /) -> Path:
"""
deletes the command found at the given position or from the end of the path
"""
...
def setFromGCode(self, gcode: str, /) -> None:
"""sets the contents of the path from a gcode string"""
...
@constmethod
def toGCode(self) -> str:
"""returns a gcode string representing the path"""
...
@constmethod
def copy(self) -> Path:
"""returns a copy of this path"""
...
@constmethod
def getCycleTime(
self, h_feed: float, v_feed: float, h_rapid: float, v_rapid: float, /
) -> float:
"""return the cycle time estimation for this path in s"""
...
Length: Final[float]
"""the total length of this path in mm"""
Size: Final[int]
"""the number of commands in this path"""
Commands: list
"""the list of commands of this path"""
Center: Any
"""the center position for all rotational parameters"""
BoundBox: Final[Any]
"""the extent of this path"""
|