gcode2image 2.4.3__py3-none-any.whl → 2.4.5__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.
- {gcode2image-2.4.3.dist-info → gcode2image-2.4.5.dist-info}/METADATA +6 -5
- gcode2image-2.4.5.dist-info/RECORD +6 -0
- {gcode2image-2.4.3.dist-info → gcode2image-2.4.5.dist-info}/WHEEL +1 -1
- gcode2image.py +11 -14
- gcode2image-2.4.3.dist-info/RECORD +0 -6
- {gcode2image-2.4.3.dist-info → gcode2image-2.4.5.dist-info}/entry_points.txt +0 -0
- {gcode2image-2.4.3.dist-info → gcode2image-2.4.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: gcode2image
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.5
|
|
4
4
|
Summary: gcode2image: convert gcode to image.
|
|
5
5
|
Keywords: engraving,laser,image,laser engraving,PWM,gcode
|
|
6
6
|
Author-email: Johannes Noordanus <mailjohannes.mailnoordanus@gmail.com>
|
|
7
|
-
Requires-Python: >=3.
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
|
-
|
|
9
|
+
License-Expression: MIT
|
|
10
10
|
License-File: LICENSE
|
|
11
11
|
Requires-Dist: numpy >= 1.24.3, <= 2.4.6
|
|
12
|
-
Requires-Dist: Pillow >=
|
|
12
|
+
Requires-Dist: Pillow >= 12.2.0
|
|
13
13
|
Project-URL: Home, https://github.com/johannesnoordanus/gcode2image
|
|
14
|
+
Import-Name: gcode2image
|
|
14
15
|
|
|
15
16
|
# gcode2image
|
|
16
17
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
gcode2image.py,sha256=mLzH8VjwCO4I5gpcZdi03koCTqe5MAzVIm4waJtftf4,17638
|
|
2
|
+
gcode2image-2.4.5.dist-info/entry_points.txt,sha256=3WTwx9hWoGPO7A4sCDOWktfO-uanp6gKGl25rZ3UHjo,48
|
|
3
|
+
gcode2image-2.4.5.dist-info/licenses/LICENSE,sha256=ghSxQl_EUJUTiu712NkZkroJHvgOrR0j4CddAq8Y7Tc,1085
|
|
4
|
+
gcode2image-2.4.5.dist-info/WHEEL,sha256=lqN8jXt_QloFOGcx9kStvWbryhfEXoI2F2z-YURm350,81
|
|
5
|
+
gcode2image-2.4.5.dist-info/METADATA,sha256=VrNhqvGZEl4TNWeIf2hzOLXMFh9doYgZB8vYKKejT1I,4585
|
|
6
|
+
gcode2image-2.4.5.dist-info/RECORD,,
|
gcode2image.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"""
|
|
3
3
|
gcode2image: convert gcode to image.
|
|
4
4
|
"""
|
|
5
|
-
__version__ = "2.4.
|
|
5
|
+
__version__ = "2.4.5"
|
|
6
6
|
|
|
7
7
|
import sys
|
|
8
8
|
import re
|
|
@@ -25,7 +25,7 @@ def gcode2image(args) -> np.array:
|
|
|
25
25
|
# set args
|
|
26
26
|
gcode = args.gcode
|
|
27
27
|
|
|
28
|
-
float_pattern = "[+\-]?[0-9]+(\.[0-9]+)?"
|
|
28
|
+
float_pattern = r"[+\-]?[0-9]+(\.[0-9]+)?"
|
|
29
29
|
|
|
30
30
|
X_pattern = f"X{float_pattern}"
|
|
31
31
|
Y_pattern = f"Y{float_pattern}"
|
|
@@ -248,7 +248,7 @@ def gcode2image(args) -> np.array:
|
|
|
248
248
|
|
|
249
249
|
def get_gcode_info():
|
|
250
250
|
nonlocal gcode
|
|
251
|
-
gc_info = { 'min_X': None, 'min_Y': None, 'max_X': None, 'max_Y': None, 'max_S': None, 'pixelsize': None, 'M': None, '
|
|
251
|
+
gc_info = { 'min_X': None, 'min_Y': None, 'max_X': None, 'max_Y': None, 'max_S': None, 'pixelsize': None, 'M': None, 'max_image_laser_power': None }
|
|
252
252
|
|
|
253
253
|
while True:
|
|
254
254
|
line = gcode.readline()
|
|
@@ -289,7 +289,7 @@ def gcode2image(args) -> np.array:
|
|
|
289
289
|
max_laser_power = re.search(f"^;.*maximum_image_laser_power:? +{float_pattern}", line)
|
|
290
290
|
if max_laser_power:
|
|
291
291
|
max_laser_power = re.search(f"maximum_image_laser_power:? +{float_pattern}", max_laser_power.group()).group()
|
|
292
|
-
gc_info['
|
|
292
|
+
gc_info['max_image_laser_power'] = float(re.search(f"{float_pattern}", max_laser_power).group())
|
|
293
293
|
|
|
294
294
|
return gc_info
|
|
295
295
|
|
|
@@ -319,18 +319,15 @@ def gcode2image(args) -> np.array:
|
|
|
319
319
|
|
|
320
320
|
# handle pixel intensity
|
|
321
321
|
if args.maxintensity is not None:
|
|
322
|
+
# commandline setting is followed
|
|
322
323
|
max_laser_power = args.maxintensity
|
|
323
|
-
elif gc_info['max_laser_power']:
|
|
324
|
-
max_laser_power = gc_info['max_laser_power']
|
|
325
|
-
print(f"maxintensity is set to {max_laser_power} (found within '{args.gcode.name}')")
|
|
326
324
|
else:
|
|
327
|
-
|
|
328
|
-
if
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
print(f"maxintensity is set to {max_laser_power} (option '--maxintensity' is not supplied or found in '{args.gcode.name}')")
|
|
325
|
+
max_laser_power = DEFAULT_MAX_LASER_POWER
|
|
326
|
+
if gc_info['max_image_laser_power']:
|
|
327
|
+
max_laser_power = gc_info['max_image_laser_power']
|
|
328
|
+
if gc_info['max_S'] and gc_info['max_S'] > max_laser_power:
|
|
329
|
+
max_laser_power = gc_info['max_S']
|
|
330
|
+
print(f"maxintensity is set to {max_laser_power}")
|
|
334
331
|
|
|
335
332
|
# handle missing G1 and M3(4) commands
|
|
336
333
|
M = gc_info['M']
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
gcode2image.py,sha256=ukEVP9-yb5Fj2FzsQklqCzbd5tbVjFIueI_QMbmLPXQ,17792
|
|
2
|
-
gcode2image-2.4.3.dist-info/entry_points.txt,sha256=3WTwx9hWoGPO7A4sCDOWktfO-uanp6gKGl25rZ3UHjo,48
|
|
3
|
-
gcode2image-2.4.3.dist-info/licenses/LICENSE,sha256=ghSxQl_EUJUTiu712NkZkroJHvgOrR0j4CddAq8Y7Tc,1085
|
|
4
|
-
gcode2image-2.4.3.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
5
|
-
gcode2image-2.4.3.dist-info/METADATA,sha256=5leyIJRTU-4Wzme2Vg0kbrNUMeyJM1yWC_169hVfcvk,4585
|
|
6
|
-
gcode2image-2.4.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|