flashforge-python-api 1.5.0__py3-none-any.whl → 3.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flashforge/__init__.py +337 -233
- flashforge/_removed.py +65 -0
- flashforge/api/__init__.py +12 -18
- flashforge/api/constants/__init__.py +11 -11
- flashforge/api/constants/commands.py +18 -15
- flashforge/api/constants/endpoints.py +11 -11
- flashforge/api/misc/__init__.py +8 -8
- flashforge/api/network/__init__.py +11 -11
- flashforge/api/network/utils.py +71 -71
- flashforge/backends/__init__.py +80 -0
- flashforge/backends/connect.py +275 -0
- flashforge/backends/creator5_backend.py +191 -0
- flashforge/backends/dual_api_backend.py +170 -0
- flashforge/backends/dual_api_models.py +145 -0
- flashforge/backends/http_core.py +431 -0
- flashforge/backends/http_printer_backend.py +254 -0
- flashforge/backends/legacy_backend.py +436 -0
- flashforge/backends/printer_backend.py +217 -0
- flashforge/backends/types.py +125 -0
- flashforge/capabilities/__init__.py +98 -0
- flashforge/capabilities/models.py +67 -0
- flashforge/capabilities/palettes/__init__.py +28 -0
- flashforge/capabilities/palettes/ad5x_palette.py +70 -0
- flashforge/capabilities/palettes/creator5_palette.py +78 -0
- flashforge/capabilities/palettes/palette.py +54 -0
- flashforge/{api/controls/creator5_palette.py → capabilities/palettes/palette_snap.py} +226 -258
- flashforge/capabilities/printer_capabilities.py +145 -0
- flashforge/capabilities/registry.py +125 -0
- flashforge/capabilities/resolve_model.py +61 -0
- flashforge/discovery/__init__.py +39 -39
- flashforge/discovery/discovery.py +730 -763
- flashforge/exceptions.py +90 -51
- flashforge/models/__init__.py +52 -55
- flashforge/models/machine_info.py +540 -543
- flashforge/{api/controls/info.py → models/machine_info_parser.py} +35 -242
- flashforge/models/responses.py +119 -254
- flashforge/status/__init__.py +43 -0
- flashforge/status/printer_snapshot.py +396 -0
- flashforge/tcp/__init__.py +55 -54
- flashforge/tcp/a3_client.py +427 -427
- flashforge/tcp/a4_client.py +304 -304
- flashforge/tcp/ff_client.py +609 -590
- flashforge/tcp/gcode/__init__.py +15 -13
- flashforge/tcp/gcode/a3_gcode_controller.py +109 -109
- flashforge/tcp/gcode/gcode_controller.py +292 -308
- flashforge/tcp/gcode/gcodes.py +81 -99
- flashforge/tcp/gcode/legacy_gcode_controller.py +56 -0
- flashforge/tcp/parsers/__init__.py +27 -27
- flashforge/tcp/parsers/endstop_status.py +248 -248
- flashforge/tcp/parsers/location_info.py +83 -83
- flashforge/tcp/parsers/print_status.py +180 -180
- flashforge/tcp/parsers/printer_info.py +146 -146
- flashforge/tcp/parsers/temp_info.py +218 -218
- flashforge/tcp/parsers/thumbnail_info.py +274 -274
- flashforge/tcp/tcp_client.py +52 -12
- flashforge/threemf/__init__.py +40 -0
- flashforge/threemf/parser.py +560 -0
- flashforge/threemf/warnings.py +58 -0
- flashforge_python_api-3.0.0.dist-info/METADATA +184 -0
- flashforge_python_api-3.0.0.dist-info/RECORD +69 -0
- {flashforge_python_api-1.5.0.dist-info → flashforge_python_api-3.0.0.dist-info}/WHEEL +1 -1
- {flashforge_python_api-1.5.0.dist-info → flashforge_python_api-3.0.0.dist-info}/licenses/LICENSE +21 -21
- flashforge/api/controls/__init__.py +0 -17
- flashforge/api/controls/control.py +0 -413
- flashforge/api/controls/files.py +0 -210
- flashforge/api/controls/job_control.py +0 -880
- flashforge/api/controls/temp_control.py +0 -309
- flashforge/client.py +0 -609
- flashforge_python_api-1.5.0.dist-info/METADATA +0 -152
- flashforge_python_api-1.5.0.dist-info/RECORD +0 -49
- {flashforge_python_api-1.5.0.dist-info → flashforge_python_api-3.0.0.dist-info}/entry_points.txt +0 -0
flashforge/tcp/gcode/gcodes.py
CHANGED
|
@@ -1,99 +1,81 @@
|
|
|
1
|
-
"""
|
|
2
|
-
G-code and M-code command constants for FlashForge 3D printers.
|
|
3
|
-
|
|
4
|
-
This module defines the standard commands used for TCP communication with FlashForge printers.
|
|
5
|
-
The '~' prefix is characteristic of FlashForge's TCP command protocol.
|
|
6
|
-
Placeholders like '%%filename%%' are intended to be replaced with actual values before sending.
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
from typing import Final
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class GCodes:
|
|
13
|
-
"""
|
|
14
|
-
Collection of G-code and M-code command strings for FlashForge 3D printers.
|
|
15
|
-
|
|
16
|
-
All commands use the FlashForge TCP protocol with '~' prefix.
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
# Authentication and session control
|
|
20
|
-
CMD_LOGIN: Final[str] = "~M601 S1"
|
|
21
|
-
"""Command to initiate a control session with the printer (login)."""
|
|
22
|
-
|
|
23
|
-
CMD_LOGOUT: Final[str] = "~M602"
|
|
24
|
-
"""Command to terminate a control session with the printer (logout)."""
|
|
25
|
-
|
|
26
|
-
# Emergency control
|
|
27
|
-
CMD_EMERGENCY_STOP: Final[str] = "~M112"
|
|
28
|
-
"""Command for an emergency stop of all printer activity."""
|
|
29
|
-
|
|
30
|
-
# Status queries
|
|
31
|
-
CMD_PRINT_STATUS: Final[str] = "~M27"
|
|
32
|
-
"""Command to request the current print job status."""
|
|
33
|
-
|
|
34
|
-
CMD_ENDSTOP_INFO: Final[str] = "~M119"
|
|
35
|
-
"""Command to request the status of the printer's endstops."""
|
|
36
|
-
|
|
37
|
-
CMD_INFO_STATUS: Final[str] = "~M115"
|
|
38
|
-
"""Command to request general printer information, including firmware version."""
|
|
39
|
-
|
|
40
|
-
CMD_INFO_XYZAB: Final[str] = "~M114"
|
|
41
|
-
"""Command to request the current X, Y, Z, A, B coordinates of the print head."""
|
|
42
|
-
|
|
43
|
-
CMD_TEMP: Final[str] = "~M105"
|
|
44
|
-
"""Command to request current temperatures (extruder, bed)."""
|
|
45
|
-
|
|
46
|
-
# LED control
|
|
47
|
-
CMD_LED_ON: Final[str] = "~M146 r255 g255 b255 F0"
|
|
48
|
-
"""Command to turn the printer's LED lights on (full white)."""
|
|
49
|
-
|
|
50
|
-
CMD_LED_OFF: Final[str] = "~M146 r0 g0 b0 F0"
|
|
51
|
-
"""Command to turn the printer's LED lights off."""
|
|
52
|
-
|
|
53
|
-
#
|
|
54
|
-
|
|
55
|
-
"""Command to
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"""Command to
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"""Command to
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"""Command to
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
CMD_START_PRINT: Final[str] = "~M23 0:/user/%%filename%%"
|
|
83
|
-
"""Command to select a file for printing. %%filename%% should be replaced with actual file path."""
|
|
84
|
-
|
|
85
|
-
CMD_PAUSE_PRINT: Final[str] = "~M25"
|
|
86
|
-
"""Command to pause the current print job."""
|
|
87
|
-
|
|
88
|
-
CMD_RESUME_PRINT: Final[str] = "~M24"
|
|
89
|
-
"""Command to resume a paused print job."""
|
|
90
|
-
|
|
91
|
-
CMD_STOP_PRINT: Final[str] = "~M26"
|
|
92
|
-
"""Command to stop/cancel the current print job."""
|
|
93
|
-
|
|
94
|
-
# Temperature control with waiting
|
|
95
|
-
WAIT_FOR_HOTEND_TEMP: Final[str] = "~M109"
|
|
96
|
-
"""Command to set extruder temperature and wait until it's reached. Requires S[temperature] parameter."""
|
|
97
|
-
|
|
98
|
-
WAIT_FOR_BED_TEMP: Final[str] = "~M190"
|
|
99
|
-
"""Command to set bed temperature and wait until it's reached. Requires S[temperature] or R[temperature] parameter."""
|
|
1
|
+
"""
|
|
2
|
+
G-code and M-code command constants for FlashForge 3D printers.
|
|
3
|
+
|
|
4
|
+
This module defines the standard commands used for TCP communication with FlashForge printers.
|
|
5
|
+
The '~' prefix is characteristic of FlashForge's TCP command protocol.
|
|
6
|
+
Placeholders like '%%filename%%' are intended to be replaced with actual values before sending.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Final
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class GCodes:
|
|
13
|
+
"""
|
|
14
|
+
Collection of G-code and M-code command strings for FlashForge 3D printers.
|
|
15
|
+
|
|
16
|
+
All commands use the FlashForge TCP protocol with '~' prefix.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
# Authentication and session control
|
|
20
|
+
CMD_LOGIN: Final[str] = "~M601 S1"
|
|
21
|
+
"""Command to initiate a control session with the printer (login)."""
|
|
22
|
+
|
|
23
|
+
CMD_LOGOUT: Final[str] = "~M602"
|
|
24
|
+
"""Command to terminate a control session with the printer (logout)."""
|
|
25
|
+
|
|
26
|
+
# Emergency control
|
|
27
|
+
CMD_EMERGENCY_STOP: Final[str] = "~M112"
|
|
28
|
+
"""Command for an emergency stop of all printer activity."""
|
|
29
|
+
|
|
30
|
+
# Status queries
|
|
31
|
+
CMD_PRINT_STATUS: Final[str] = "~M27"
|
|
32
|
+
"""Command to request the current print job status."""
|
|
33
|
+
|
|
34
|
+
CMD_ENDSTOP_INFO: Final[str] = "~M119"
|
|
35
|
+
"""Command to request the status of the printer's endstops."""
|
|
36
|
+
|
|
37
|
+
CMD_INFO_STATUS: Final[str] = "~M115"
|
|
38
|
+
"""Command to request general printer information, including firmware version."""
|
|
39
|
+
|
|
40
|
+
CMD_INFO_XYZAB: Final[str] = "~M114"
|
|
41
|
+
"""Command to request the current X, Y, Z, A, B coordinates of the print head."""
|
|
42
|
+
|
|
43
|
+
CMD_TEMP: Final[str] = "~M105"
|
|
44
|
+
"""Command to request current temperatures (extruder, bed)."""
|
|
45
|
+
|
|
46
|
+
# LED control
|
|
47
|
+
CMD_LED_ON: Final[str] = "~M146 r255 g255 b255 F0"
|
|
48
|
+
"""Command to turn the printer's LED lights on (full white)."""
|
|
49
|
+
|
|
50
|
+
CMD_LED_OFF: Final[str] = "~M146 r0 g0 b0 F0"
|
|
51
|
+
"""Command to turn the printer's LED lights off."""
|
|
52
|
+
|
|
53
|
+
# File operations
|
|
54
|
+
CMD_LIST_LOCAL_FILES: Final[str] = "~M661"
|
|
55
|
+
"""Command to list files stored locally on the printer."""
|
|
56
|
+
|
|
57
|
+
CMD_GET_THUMBNAIL: Final[str] = "~M662"
|
|
58
|
+
"""Command to retrieve a thumbnail image for a specified G-code file."""
|
|
59
|
+
|
|
60
|
+
CMD_PREP_FILE_UPLOAD: Final[str] = "~M28 %%size%% 0:/user/%%filename%%"
|
|
61
|
+
"""Command to begin a legacy raw-binary file upload to printer storage."""
|
|
62
|
+
|
|
63
|
+
CMD_COMPLETE_FILE_UPLOAD: Final[str] = "~M29"
|
|
64
|
+
"""Command to finalize a legacy raw-binary file upload."""
|
|
65
|
+
|
|
66
|
+
# Movement and homing
|
|
67
|
+
CMD_HOME_AXES: Final[str] = "~G28"
|
|
68
|
+
"""Command to home all printer axes (X, Y, Z)."""
|
|
69
|
+
|
|
70
|
+
# Print job control
|
|
71
|
+
CMD_START_PRINT: Final[str] = "~M23 0:/user/%%filename%%"
|
|
72
|
+
"""Command to select a file for printing. %%filename%% should be replaced with actual file path."""
|
|
73
|
+
|
|
74
|
+
CMD_PAUSE_PRINT: Final[str] = "~M25"
|
|
75
|
+
"""Command to pause the current print job."""
|
|
76
|
+
|
|
77
|
+
CMD_RESUME_PRINT: Final[str] = "~M24"
|
|
78
|
+
"""Command to resume a paused print job."""
|
|
79
|
+
|
|
80
|
+
CMD_STOP_PRINT: Final[str] = "~M26"
|
|
81
|
+
"""Command to stop/cancel the current print job."""
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""
|
|
2
|
+
G-code controller for the legacy Adventurer 3 / 4 TCP clients.
|
|
3
|
+
|
|
4
|
+
Adds the "set and wait" temperature options (M109 / M190) on top of
|
|
5
|
+
GCodeController. The Adventurer 5M, 5M Pro and AD5X do not support M109 or
|
|
6
|
+
M190, so the modern FlashForgeClient does not use this class. Support on the
|
|
7
|
+
Adventurer 3 / 4 is not verified.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from typing import Final
|
|
11
|
+
|
|
12
|
+
from .gcode_controller import GCodeController
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class LegacyGCodeController(GCodeController):
|
|
16
|
+
"""G-code controller for the legacy Adventurer 3 / 4 clients."""
|
|
17
|
+
|
|
18
|
+
WAIT_FOR_HOTEND_TEMP: Final[str] = "~M109"
|
|
19
|
+
"""Set extruder temperature and wait until it is reached. Requires S[temperature]."""
|
|
20
|
+
|
|
21
|
+
WAIT_FOR_BED_TEMP: Final[str] = "~M190"
|
|
22
|
+
"""Set bed temperature and wait until it is reached. Requires S[temperature] or R[temperature]."""
|
|
23
|
+
|
|
24
|
+
async def set_extruder_temp(self, temp: int, wait_for: bool = False) -> bool:
|
|
25
|
+
"""
|
|
26
|
+
Set the target temperature for the extruder.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
temp: The target temperature in Celsius
|
|
30
|
+
wait_for: If True, send M109 and wait until the target temperature is reached
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
True if the command was successful, False otherwise
|
|
34
|
+
"""
|
|
35
|
+
if not wait_for:
|
|
36
|
+
return await super().set_extruder_temp(temp)
|
|
37
|
+
if not await self.client.send_cmd_ok(f"{self.WAIT_FOR_HOTEND_TEMP} S{temp}"):
|
|
38
|
+
return False
|
|
39
|
+
return await self.wait_for_extruder_temp(temp)
|
|
40
|
+
|
|
41
|
+
async def set_bed_temp(self, temp: int, wait_for: bool = False) -> bool:
|
|
42
|
+
"""
|
|
43
|
+
Set the target temperature for the print bed.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
temp: The target temperature in Celsius
|
|
47
|
+
wait_for: If True, send M190 and wait until the target temperature is reached
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
True if the command was successful, False otherwise
|
|
51
|
+
"""
|
|
52
|
+
if not wait_for:
|
|
53
|
+
return await super().set_bed_temp(temp)
|
|
54
|
+
if not await self.client.send_cmd_ok(f"{self.WAIT_FOR_BED_TEMP} S{temp}"):
|
|
55
|
+
return False
|
|
56
|
+
return await self.wait_for_bed_temp(temp)
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Response parsers for FlashForge printer TCP communication.
|
|
3
|
-
|
|
4
|
-
This module contains classes for parsing various response types from FlashForge printers,
|
|
5
|
-
including printer information, temperature data, location data, and more.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
from .endstop_status import Endstop, EndstopStatus, MachineStatus, MoveMode, Status
|
|
9
|
-
from .location_info import LocationInfo
|
|
10
|
-
from .print_status import PrintStatus
|
|
11
|
-
from .printer_info import PrinterInfo
|
|
12
|
-
from .temp_info import TempData, TempInfo
|
|
13
|
-
from .thumbnail_info import ThumbnailInfo
|
|
14
|
-
|
|
15
|
-
__all__ = [
|
|
16
|
-
"PrinterInfo",
|
|
17
|
-
"TempInfo",
|
|
18
|
-
"TempData",
|
|
19
|
-
"LocationInfo",
|
|
20
|
-
"EndstopStatus",
|
|
21
|
-
"MachineStatus",
|
|
22
|
-
"MoveMode",
|
|
23
|
-
"Status",
|
|
24
|
-
"Endstop",
|
|
25
|
-
"PrintStatus",
|
|
26
|
-
"ThumbnailInfo",
|
|
27
|
-
]
|
|
1
|
+
"""
|
|
2
|
+
Response parsers for FlashForge printer TCP communication.
|
|
3
|
+
|
|
4
|
+
This module contains classes for parsing various response types from FlashForge printers,
|
|
5
|
+
including printer information, temperature data, location data, and more.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .endstop_status import Endstop, EndstopStatus, MachineStatus, MoveMode, Status
|
|
9
|
+
from .location_info import LocationInfo
|
|
10
|
+
from .print_status import PrintStatus
|
|
11
|
+
from .printer_info import PrinterInfo
|
|
12
|
+
from .temp_info import TempData, TempInfo
|
|
13
|
+
from .thumbnail_info import ThumbnailInfo
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"PrinterInfo",
|
|
17
|
+
"TempInfo",
|
|
18
|
+
"TempData",
|
|
19
|
+
"LocationInfo",
|
|
20
|
+
"EndstopStatus",
|
|
21
|
+
"MachineStatus",
|
|
22
|
+
"MoveMode",
|
|
23
|
+
"Status",
|
|
24
|
+
"Endstop",
|
|
25
|
+
"PrintStatus",
|
|
26
|
+
"ThumbnailInfo",
|
|
27
|
+
]
|