svg2gcode 4.1.1__tar.gz → 4.1.2__tar.gz

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.
Files changed (44) hide show
  1. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/PKG-INFO +1 -1
  2. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/__init__.py +1 -1
  3. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_examples/nonzero_evenodd.svg +1 -1
  4. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/compiler/_compiler.py +15 -14
  5. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/geometry/_line_segment_chain.py +8 -8
  6. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/LICENSE +0 -0
  7. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/README.md +0 -0
  8. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/pyproject.toml +0 -0
  9. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/__main__.py +0 -0
  10. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_examples/README.md +0 -0
  11. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_examples/abcdefghijklmnop.svg +0 -0
  12. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_examples/gcode_output.zip +0 -0
  13. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_examples/kye_circle_paws_orig copy.svg +0 -0
  14. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_examples/kye_circle_paws_orig.svg +0 -0
  15. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_examples/letter_B.svg +0 -0
  16. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_examples/lettersandsigns.svg +0 -0
  17. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/LICENSE +0 -0
  18. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/__init__.py +0 -0
  19. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/compiler/__init__.py +0 -0
  20. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/compiler/interfaces/__init__.py +0 -0
  21. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/compiler/interfaces/_abstract_interface.py +0 -0
  22. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/compiler/interfaces/_fan_controlled_gcode.py +0 -0
  23. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/compiler/interfaces/_gcode.py +0 -0
  24. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/compiler/last_compiler.py +0 -0
  25. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/compiler/ttt.py +0 -0
  26. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/css_color.py +0 -0
  27. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/formulas.py +0 -0
  28. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/geometry/__init__.py +0 -0
  29. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/geometry/_abstract_chain.py +0 -0
  30. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/geometry/_abstract_curve.py +0 -0
  31. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/geometry/_circular_arc.py +0 -0
  32. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/geometry/_cubic_bazier.py +0 -0
  33. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/geometry/_elliptical_arc.py +0 -0
  34. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/geometry/_line.py +0 -0
  35. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/geometry/_matrix.py +0 -0
  36. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/geometry/_quadratic_bazier.py +0 -0
  37. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/geometry/_raster_image.py +0 -0
  38. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/geometry/_smooth_arc_chain.py +0 -0
  39. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/geometry/_vector.py +0 -0
  40. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/svg_parser/__init__.py +0 -0
  41. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/svg_parser/_parser_methods.py +0 -0
  42. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/svg_parser/_path.py +0 -0
  43. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/svg_parser/_transformation.py +0 -0
  44. {svg2gcode-4.1.1 → svg2gcode-4.1.2}/svg2gcode/svg_to_gcode/svg_parser/debug_methods.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: svg2gcode
3
- Version: 4.1.1
3
+ Version: 4.1.2
4
4
  Summary: svg2gcode: convert an SVG (Scalable Vector Graphic) image to gcode.
5
5
  Keywords: scalable vector graphics,svg,image,laser cutter,laser engraving
6
6
  Author-email: Johannes Noordanus <mailjohannes.mailnoordanus@gmail.com>
@@ -1,4 +1,4 @@
1
1
  """
2
2
  svg2gcode: convert an SVG (Scalable Vector Graphic) image to gcode.
3
3
  """
4
- __version__ = "4.1.1"
4
+ __version__ = "4.1.2"
@@ -42,6 +42,6 @@
42
42
  -->
43
43
  <path
44
44
  id="polygon2"
45
- style="fill-rule:evenodd;fill:#FFFFFF;stroke:#ff0000;stroke-width:0.1"
45
+ style="fill-rule:evenodd;fill:yellow;stroke:#000000;stroke-width:0.3"
46
46
  d="m 150,0 -29,90 77,-55 h -96 l 77,55 z" />
47
47
  </svg>
@@ -234,14 +234,16 @@ class Compiler:
234
234
  return False
235
235
 
236
236
  # check file extentions
237
- suffixes = '.svg,.vect'
238
- if not ext_check(suffixes, svg_file_name):
239
- logger.error(f"Error: unknown input file extension '{Path(svg_file_name).suffix}', vector file extension should be one of '{suffixes}', exit ...")
237
+ if Path(svg_file_name).suffix == Path(file_name).suffix:
238
+ logger.error("Input extension is same as output extension, exit ...")
240
239
  sys.exit(1)
241
- suffixes = '.gc,.gcode'
240
+
241
+ suffixes = '.svg,.xml'
242
+ if not ext_check(suffixes, svg_file_name):
243
+ logger.warning(f"Unknown input file extension '{Path(svg_file_name).suffix}', Scalable Vector Graphics file extensions usually are: '{suffixes}'")
244
+ suffixes = '.gc,.gcode,.gco,.g,.nc,.cnc'
242
245
  if not ext_check(suffixes, file_name):
243
- logger.error(f"Error: unknown output file extension '{Path(file_name).suffix}', gcode file extension should be one of '{suffixes}', exit ...")
244
- sys.exit(1)
246
+ logger.warning(f"Unknown output file extension '{Path(file_name).suffix}', gcode file extensions extensions usually are: '{suffixes}'")
245
247
 
246
248
  # generate gcode for 'path' and 'image' svg tags (calculate bbox)
247
249
  # results accumulate in:
@@ -726,7 +728,7 @@ class Compiler:
726
728
  Generates gcode for images and stroke and fill of paths.
727
729
  """
728
730
 
729
- def correct_fill_lines(delta_chain: LineSegmentChain, fill_lines: list[list[tuple(float,float),tuple(float,float)]]):
731
+ def correct_fill_lines(delta_chain: LineSegmentChain, fill_lines: list[list[tuple[float,float],tuple[float,float]]]):
730
732
  """
731
733
  Correct fill line boundaries to account for stroke_width.
732
734
  """
@@ -926,12 +928,12 @@ class Compiler:
926
928
 
927
929
  # assume style info is the same for paths with the same id
928
930
  (stroke_width,
929
- stroke_color,
930
- stroke_alpha,
931
+ _unused,
932
+ _unused,
931
933
  fill_color,
932
934
  fill_alpha,
933
935
  fill_rule,
934
- style_pathcut) = get_style_info_of_line_chain(path_curves[name_id][0])
936
+ _unused) = get_style_info_of_line_chain(path_curves[name_id][0])
935
937
 
936
938
  if fill_color is not None and len(fill_color):
937
939
  # Get fill alpha channel (opacity)
@@ -1021,9 +1023,9 @@ class Compiler:
1021
1023
  (stroke_width,
1022
1024
  stroke_color,
1023
1025
  stroke_alpha,
1024
- fill_color,
1025
- fill_alpha,
1026
- fill_rule,
1026
+ _unused,
1027
+ _unused,
1028
+ _unused,
1027
1029
  style_pathcut) = get_style_info_of_line_chain(path_curves[name_id][0])
1028
1030
 
1029
1031
  if (style_pathcut is not None and style_pathcut == 'true') or self.settings["pathcut"]:
@@ -1173,4 +1175,3 @@ class Compiler:
1173
1175
 
1174
1176
  # Render 'stroke' attribute
1175
1177
  render_stroke_attribute(path_curves, name_id, boundingbox)
1176
-
@@ -20,22 +20,22 @@ class LineSegmentChain(Chain):
20
20
  def __repr__(self):
21
21
  return f"{type(self)}({len(self._curves)} curves: {[line.__repr__() for line in self._curves[:2]]}...)"
22
22
 
23
- def append(self, line2: Line):
23
+ def append(self, new_curve: Line):
24
24
  if self._curves:
25
- line1 = self._curves[-1]
25
+ line = self._curves[-1]
26
26
 
27
27
  # Assert continuity
28
- if abs(line1.end - line2.start) > TOLERANCES['input']:
28
+ if abs(line.end - new_curve.start) > TOLERANCES['input']:
29
29
  warnings.warn(f"The end of the last line is different from the start of the new line"
30
- f" |{line1.end} - {line2.start}| >= {TOLERANCES['input']}")
30
+ f" |{line.end} - {new_curve.start}| >= {TOLERANCES['input']}")
31
31
 
32
32
  # Join lines
33
- line2.start = line1.end
33
+ new_curve.start = line.end
34
34
 
35
- self._curves.append(line2)
35
+ self._curves.append(new_curve)
36
36
 
37
37
  @staticmethod
38
- def clockwise(line_chains: List[LineSegmentChain]) -> bool | None:
38
+ def clockwise(line_chains: list[Chain]) -> bool | None:
39
39
  """
40
40
  Return true when line chain rotates clockwise
41
41
 
@@ -46,7 +46,7 @@ class LineSegmentChain(Chain):
46
46
  if line_chains:
47
47
  for line_chain in line_chains:
48
48
  for line in line_chain:
49
- if leftmost_line == None or leftmost_line.start.x > line.start.x:
49
+ if leftmost_line is None or leftmost_line.start.x > line.start.x:
50
50
  leftmost_line = line
51
51
 
52
52
  if leftmost_line is not None:
File without changes
File without changes
File without changes