flashforge-python-api 1.4.0__py3-none-any.whl → 1.6.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.
@@ -0,0 +1,58 @@
1
+ """
2
+ FlashForge Python API - Slicer warning translations
3
+
4
+ Slicers in the OrcaSlicer family (OrcaSlicer, Orca-FlashForge, Flash Studio)
5
+ write slice warnings into ``Metadata/slice_info.config`` as raw i18n keys such
6
+ as ``bed_temperature_too_high_than_filament``, not as display text. This module
7
+ turns those keys into readable sentences. An unknown key falls back to a
8
+ prettified form, so a new warning still reads acceptably.
9
+
10
+ The keys come from OrcaSlicer's ``GCodeProcessor.hpp``, and the wording follows
11
+ ``Plater::get_slice_warning_string()``, so the messages match what the slicer
12
+ itself shows. The table matches ``slicer-meta``'s ``warning-translations.ts``.
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ _KNOWN_WARNINGS: dict[str, str] = {
18
+ "bed_temperature_too_high_than_filament": (
19
+ "The current hot bed temperature is relatively high. The nozzle may be clogged "
20
+ "when printing this filament in a closed enclosure. Please open the front door "
21
+ "and/or remove the upper glass."
22
+ ),
23
+ "the_actual_nozzle_hrc_smaller_than_the_required_nozzle_hrc": (
24
+ "The nozzle hardness required by the filament is higher than the default nozzle "
25
+ "hardness of the printer. Please replace the hardened nozzle or filament, "
26
+ "otherwise, the nozzle will be attrited or damaged."
27
+ ),
28
+ "not_support_traditional_timelapse": (
29
+ "Enabling traditional timelapse photography may cause surface imperfections. "
30
+ "It is recommended to change to smooth mode."
31
+ ),
32
+ "not_generate_timelapse": "Timelapse will not be generated for this print.",
33
+ "smooth_timelapse_without_prime_tower": (
34
+ "Smooth mode for timelapse is enabled, but the prime tower is off, which may "
35
+ "cause print defects. Please enable the prime tower, re-slice and print again."
36
+ ),
37
+ "activate_long_retraction_when_cut": "Long retraction when cut is enabled for this print.",
38
+ }
39
+
40
+
41
+ def translate_warning(key: str) -> str:
42
+ """
43
+ Translate a raw slicer warning key into readable text.
44
+
45
+ Args:
46
+ key: The warning key as the slicer wrote it.
47
+
48
+ Returns:
49
+ The curated message for a known key, a prettified form of an unknown
50
+ snake_case key, or an empty string for an empty key.
51
+ """
52
+ if not key:
53
+ return ""
54
+ known = _KNOWN_WARNINGS.get(key)
55
+ if known is not None:
56
+ return known
57
+ words = key.replace("_", " ").strip()
58
+ return words[:1].upper() + words[1:] if words else ""
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: flashforge-python-api
3
- Version: 1.4.0
3
+ Version: 1.6.0
4
4
  Summary: A comprehensive Python library for controlling FlashForge 3D printers
5
5
  Project-URL: Homepage, https://github.com/GhostTypes/ff-5mp-api-py
6
6
  Project-URL: Documentation, https://github.com/GhostTypes/ff-5mp-api-py#readme
@@ -143,6 +143,39 @@ asyncio.run(main())
143
143
  - temperature and motion control, including per-nozzle and chamber temperature control (Creator 5)
144
144
  - LED, camera, and filtration control where supported
145
145
  - AD5X and Creator 5 / Creator 5 Pro material-station, slot configuration, and material mapping
146
+ - sliced 3MF parsing: read the tools, materials, colors, estimates, and thumbnail of a `.3mf` before upload
147
+
148
+ ## Parse a Sliced 3MF
149
+
150
+ A sliced 3MF tells you which filaments (tools) a print uses. The Creator 5 series does not report this for stored files, so read the 3MF before you upload it. Then build one material mapping per filament.
151
+
152
+ ```python
153
+ import asyncio
154
+ from flashforge import AD5XMaterialMapping, parse_3mf
155
+
156
+
157
+ async def build_mappings(path: str) -> list[AD5XMaterialMapping]:
158
+ # parse_3mf is synchronous file I/O, so run it in a worker thread.
159
+ info = await asyncio.to_thread(parse_3mf, path)
160
+ print(f"{info.file_name}: {info.tool_count} tool(s), sliced for {info.printer_family}")
161
+
162
+ mappings = []
163
+ for filament in info.filaments:
164
+ mappings.append(
165
+ AD5XMaterialMapping(
166
+ tool_id=filament.tool_id, # 0-based: filament 1 is tool 0
167
+ slot_id=filament.tool_id + 1, # choose the station slot to print from
168
+ material_name=filament.material_name,
169
+ tool_material_color=filament.color or "#FFFFFF",
170
+ slot_material_color=filament.color or "#FFFFFF",
171
+ )
172
+ )
173
+ return mappings
174
+ ```
175
+
176
+ In a real app, pick `slot_id` and `slot_material_color` from the slots the printer reports. Pass the mappings to `upload_file_creator5` / `start_creator5_job` (Creator 5 series) or `upload_file_ad5x` (AD5X).
177
+
178
+ `parse_3mf` accepts one sliced plate only. A project file with no sliced G-code raises `ThreeMFNotSlicedError`. A file with more than one sliced plate raises `ThreeMFMultiplePlatesError`. All 3MF errors subclass `ThreeMFError`.
146
179
 
147
180
  ## Documentation
148
181
 
@@ -1,17 +1,17 @@
1
- flashforge/__init__.py,sha256=cYJmX39_FZxN6yyHkwepT_g9mnU2hHuVYuv3Lpg6seY,5472
2
- flashforge/client.py,sha256=nDtnv3y9XlEQknIkgIUiuOYAiyTEGbQ7tHBdCs2fg1I,21432
3
- flashforge/exceptions.py,sha256=rZwBJHyqqtoI6cgd8iGOvPH8EDcytA3lyU3FoVMJgyU,1732
1
+ flashforge/__init__.py,sha256=HojGIgobrlO5Qr9mzrHhFeuVq5a1otJPDMBa9AFuKBM,5984
2
+ flashforge/client.py,sha256=5DxKJyicq5LX8xfZUtIB0Q-_sh8kIFNzMMV_3Dos5fk,22519
3
+ flashforge/exceptions.py,sha256=LQli1pAH2X8fm3jsRD4caz0Mn-nyBjNpaJh_En7YJw0,1737
4
4
  flashforge/api/__init__.py,sha256=vQz-DkG6LTH39bI4fyiUc0D9jQzemLh45pORLptSOlg,335
5
5
  flashforge/api/constants/__init__.py,sha256=Q0HL2tqSBYPd4Oz49VHLS3qUvRuv__GCvTGecaLrQ-Y,163
6
- flashforge/api/constants/commands.py,sha256=XM2rooBESPDaywlZrfW2ECTaLLFaSKXkJ7FQ-RBmVdY,578
6
+ flashforge/api/constants/commands.py,sha256=9WggRLBgidf4cBBXMllQVAZr64UvHOf7gNHlPEKvo2g,579
7
7
  flashforge/api/constants/endpoints.py,sha256=oZtOFfkU64THDeCMUIVv6_0L-BOUZzgLKAUfjHkUhi8,337
8
8
  flashforge/api/controls/__init__.py,sha256=53s-H25Pjwr0kvPk8MZ2Twy8VHGqGcO6Q6uBphhEOh4,293
9
- flashforge/api/controls/control.py,sha256=OgE7K6NkFLwFN1r_q5g1RPwYC8MCt0f6L5CZxDW44d8,15151
10
- flashforge/api/controls/creator5_palette.py,sha256=zdD3PIXx7hCVj2Fmv1CSFOaqogRUPeBaymgY2DFiMxk,8835
11
- flashforge/api/controls/files.py,sha256=Jk2ySrJdw2QDk1CJlGfY4bTmZJocx4GXztkEqE4rRaI,8830
12
- flashforge/api/controls/info.py,sha256=7E2TtfFgT79m9lI3nBIvO-536dhl4xzwe1L9XCWVZ78,24836
13
- flashforge/api/controls/job_control.py,sha256=NnACm4LPUz4n8lnRiUl33jilWekS1b6HQTbP--nDzZc,33225
14
- flashforge/api/controls/temp_control.py,sha256=EOO5TkODirjFcnQ7rZrirxAweHBdVin032AWj-Z8VQs,13040
9
+ flashforge/api/controls/control.py,sha256=mK-k3SX53wrq3-aPmMaAbAnqcOaJgvuNSR-sm1aowJM,15099
10
+ flashforge/api/controls/creator5_palette.py,sha256=1I6QfAYlCJcpqPzrySsXfn2EST04QYHZKVxCRnxu4AQ,8795
11
+ flashforge/api/controls/files.py,sha256=tOqPgf9SBIvJBgno1GMAROdoDHF_ZJOmbEac1ikq_HI,8769
12
+ flashforge/api/controls/info.py,sha256=E-VepEeTyquh50ssckpMGIkH9cagNZGUzn_Zb-bPplY,24846
13
+ flashforge/api/controls/job_control.py,sha256=-6UafeTpjYOs5gIVAHbQyTUROErJs4XW8lpI6HsLJgM,36119
14
+ flashforge/api/controls/temp_control.py,sha256=_qrKCfjKJsPE4dj6bXZeJRH2FjLKx2T2V3pyG2oLrgI,12991
15
15
  flashforge/api/filament/__init__.py,sha256=isT2dl0hzUS0xMTXMm4Tip0GTG1gCsm8LKWa9xPu4Y8,104
16
16
  flashforge/api/filament/filament.py,sha256=TtcC2G2nD9Sq4cOrCZzFLZ6Q0Ve-zfrfuEF9uQ8M3eE,1214
17
17
  flashforge/api/misc/__init__.py,sha256=1AG7vOMRBZQtHp6QUzfr9alcJPeNv3JpU44NrznxDHs,211
@@ -24,8 +24,8 @@ flashforge/api/network/utils.py,sha256=Q5-Vj_1VN611QV_TGpDzrrZ2X8PqaGT0j00BhSHv5
24
24
  flashforge/discovery/__init__.py,sha256=G0WiP70EhfHdjXR1RNlv6xjhyHOdo-HWyOm9J0ds4SM,828
25
25
  flashforge/discovery/discovery.py,sha256=-hOmVIpn8gu-rPYo8FRBfhKb_tBqwamLfmoPVYaDzLI,27614
26
26
  flashforge/models/__init__.py,sha256=hdcK0E4KeDfv_A8Y2aPOHgHziwTjP1RPb_VP-89dOzQ,1086
27
- flashforge/models/machine_info.py,sha256=OvvpjjUtmOHyogYADFfRJRQnwwPQnjiGVCkXRNdka7Y,24397
28
- flashforge/models/responses.py,sha256=10-8yFfZtLuDmH1TK2xVYl-Uf-zT2WEJnpb2H5ZK3ZU,10637
27
+ flashforge/models/machine_info.py,sha256=Chcpoeus1pppPKMDNsGIiCGGQ6tATezUT6ML5MjubD0,24407
28
+ flashforge/models/responses.py,sha256=P0Zo8c6QywbS0_kEWq-8HsRwwQkCiG4MfeDcGADpPHg,10965
29
29
  flashforge/tcp/__init__.py,sha256=hpnqoWHeRtTwJPzdsVlwGt1njKbAkrgIHKADkLSIRec,1317
30
30
  flashforge/tcp/a3_client.py,sha256=Aqb6MuKkjnNUVdE2LbZKd7bPlFK8XPIm17C_BG_PuNU,15867
31
31
  flashforge/tcp/a4_client.py,sha256=snmAvTCpSWFjxb8h6V7H4tk5yOoMqKEzKoBY_1JaaPs,11213
@@ -42,8 +42,11 @@ flashforge/tcp/parsers/print_status.py,sha256=C-KzukhK0TR86AP3t3XrMH4dief6pa3I-y
42
42
  flashforge/tcp/parsers/printer_info.py,sha256=CHPs6nJfEByXyG3co7Nb8_ygggxkYuc7A9O9bpQEqXE,5441
43
43
  flashforge/tcp/parsers/temp_info.py,sha256=9wRGUM9cKvDiZD3SIxBx_qVLZbeXoYsoY3-R3vN3H4g,7938
44
44
  flashforge/tcp/parsers/thumbnail_info.py,sha256=1U1S_gcIZ2lDpEA4622ywUew6TVw0BnzjlBAiihQwzk,10478
45
- flashforge_python_api-1.4.0.dist-info/METADATA,sha256=VQsv_msrpBzurF7zMQUadt7jpyy1ljomJQxV_XhALIg,4970
46
- flashforge_python_api-1.4.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
47
- flashforge_python_api-1.4.0.dist-info/entry_points.txt,sha256=AkOxlsLvQ7cvMLxn7tlzfKp_DCH2hXhbVceHIXxawpU,66
48
- flashforge_python_api-1.4.0.dist-info/licenses/LICENSE,sha256=-cTA-hrmvlb3pqlQrBZQXUnKayhUjsLJMPb7TD91frM,1067
49
- flashforge_python_api-1.4.0.dist-info/RECORD,,
45
+ flashforge/threemf/__init__.py,sha256=xjoHiyl-RFvzMCGeZ00K197d01ZO7-j2o15Xy0ns96Y,900
46
+ flashforge/threemf/parser.py,sha256=mr-FJ2_Zs__VcBwPZvQXUPtBEuKUB-2fcMMaKOQYYOE,20987
47
+ flashforge/threemf/warnings.py,sha256=-8o7VhdaXqaOpx4ZH-A5kYybWJZepqRxmScVV3d-UzA,2472
48
+ flashforge_python_api-1.6.0.dist-info/METADATA,sha256=22juPUjzsx7czIfPWSgH13A846vO1Mf09_IMtibg7cw,6619
49
+ flashforge_python_api-1.6.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
50
+ flashforge_python_api-1.6.0.dist-info/entry_points.txt,sha256=AkOxlsLvQ7cvMLxn7tlzfKp_DCH2hXhbVceHIXxawpU,66
51
+ flashforge_python_api-1.6.0.dist-info/licenses/LICENSE,sha256=-cTA-hrmvlb3pqlQrBZQXUnKayhUjsLJMPb7TD91frM,1067
52
+ flashforge_python_api-1.6.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.31.0
2
+ Generator: hatchling 1.32.4
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any