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.
@@ -1,16 +1,17 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: gcode2image
3
- Version: 2.4.3
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
7
+ Requires-Python: >=3.11
8
8
  Description-Content-Type: text/markdown
9
- Classifier: License :: OSI Approved :: MIT License
9
+ License-Expression: MIT
10
10
  License-File: LICENSE
11
11
  Requires-Dist: numpy >= 1.24.3, <= 2.4.6
12
- Requires-Dist: Pillow >= 9.5.0
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,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: flit 3.12.0
2
+ Generator: flit 4.1.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
gcode2image.py CHANGED
@@ -2,7 +2,7 @@
2
2
  """
3
3
  gcode2image: convert gcode to image.
4
4
  """
5
- __version__ = "2.4.3"
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, 'max_laser_power': 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['max_laser_power'] = float(re.search(f"{float_pattern}", max_laser_power).group())
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
- max_S = gc_info['max_S']
328
- if max_S and max_S > DEFAULT_MAX_LASER_POWER:
329
- # self calibrate
330
- max_laser_power = max_S
331
- else:
332
- max_laser_power = DEFAULT_MAX_LASER_POWER
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,,