svg2gcode 3.3.5__tar.gz → 3.3.6__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.
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/PKG-INFO +1 -1
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/__init__.py +1 -1
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/compiler/_compiler.py +19 -17
- svg2gcode-3.3.6/svg2gcode/svg_to_gcode/compiler/newcompiler.py +1148 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/svg_parser/__init__.py +1 -1
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/svg_parser/_parser_methods.py +5 -5
- svg2gcode-3.3.6/svg2gcode/svg_to_gcode/svg_parser/new__init.py +11 -0
- svg2gcode-3.3.6/svg2gcode/svg_to_gcode/svg_parser/newparsermethods.py +248 -0
- svg2gcode-3.3.6/svg2gcode/svg_to_gcode/svg_parser/t +5 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/LICENSE +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/README.md +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/pyproject.toml +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/__main__.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/LICENSE +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/__init__.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/compiler/__init__.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/compiler/interfaces/__init__.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/compiler/interfaces/_abstract_interface.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/compiler/interfaces/_fan_controlled_gcode.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/compiler/interfaces/_gcode.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/css_color.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/formulas.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/geometry/__init__.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/geometry/_abstract_chain.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/geometry/_abstract_curve.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/geometry/_circular_arc.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/geometry/_cubic_bazier.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/geometry/_elliptical_arc.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/geometry/_line.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/geometry/_line_segment_chain.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/geometry/_matrix.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/geometry/_quadratic_bazier.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/geometry/_raster_image.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/geometry/_smooth_arc_chain.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/geometry/_vector.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/svg_parser/_path.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/svg_parser/_transformation.py +0 -0
- {svg2gcode-3.3.5 → svg2gcode-3.3.6}/svg2gcode/svg_to_gcode/svg_parser/debug_methods.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: svg2gcode
|
|
3
|
-
Version: 3.3.
|
|
3
|
+
Version: 3.3.6
|
|
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>
|
|
@@ -19,7 +19,7 @@ from svg2gcode.svg_to_gcode import DEFAULT_SETTING
|
|
|
19
19
|
from svg2gcode.svg_to_gcode import TOLERANCES, SETTING, check_setting
|
|
20
20
|
|
|
21
21
|
from svg2gcode.svg_to_gcode import css_color
|
|
22
|
-
from svg2gcode.svg_to_gcode.svg_parser import NAMESPACES,
|
|
22
|
+
from svg2gcode.svg_to_gcode.svg_parser import NAMESPACES, ElementTreeParent
|
|
23
23
|
|
|
24
24
|
from svg2gcode import __version__
|
|
25
25
|
|
|
@@ -483,13 +483,13 @@ class Compiler:
|
|
|
483
483
|
style['pathcut'] = curve.path_attrib['gcode_pathcut']
|
|
484
484
|
|
|
485
485
|
# check missing attributes, if any
|
|
486
|
-
if
|
|
487
|
-
parent = curve.path_attrib[
|
|
486
|
+
if ElementTreeParent in curve.path_attrib:
|
|
487
|
+
parent = curve.path_attrib[ElementTreeParent]
|
|
488
488
|
|
|
489
|
-
# find first parent g (group) tag, if any
|
|
489
|
+
# find first parent <g (group) tag, if any
|
|
490
490
|
while parent and parent.tag != "{%s}g" % NAMESPACES["svg"]:
|
|
491
|
-
if
|
|
492
|
-
parent = parent.attrib[
|
|
491
|
+
if ElementTreeParent in parent.attrib:
|
|
492
|
+
parent = parent.attrib[ElementTreeParent]
|
|
493
493
|
else:
|
|
494
494
|
parent = None
|
|
495
495
|
if parent:
|
|
@@ -671,7 +671,7 @@ class Compiler:
|
|
|
671
671
|
def get_style_info_of_line_chain(line_chain: LineSegmentChain) -> ():
|
|
672
672
|
"""
|
|
673
673
|
Get style info of line_chain.
|
|
674
|
-
Returns tuple (stroke_width, stroke_color, stroke_alpha, fill_color, fill_alpha, fill_rule)
|
|
674
|
+
Returns tuple (stroke_width, stroke_color, stroke_alpha, fill_color, fill_alpha, fill_rule, pathcut)
|
|
675
675
|
"""
|
|
676
676
|
# defaults
|
|
677
677
|
stroke_width = 0
|
|
@@ -685,8 +685,7 @@ class Compiler:
|
|
|
685
685
|
first_line_of_chain = line_chain.get(0)
|
|
686
686
|
style = self.parse_style_attribute(first_line_of_chain)
|
|
687
687
|
if style:
|
|
688
|
-
if
|
|
689
|
-
and style['stroke'] is not None and style['stroke'] != "none":
|
|
688
|
+
if style['stroke'] is not None and style['stroke'] != "none":
|
|
690
689
|
stroke_color = style['stroke']
|
|
691
690
|
if style['stroke-opacity'] is not None:
|
|
692
691
|
# fill opacity attribute overrides rgba property
|
|
@@ -721,7 +720,7 @@ class Compiler:
|
|
|
721
720
|
fill_alpha = rgba[3]
|
|
722
721
|
fill_color = round(fill_color * fill_alpha)
|
|
723
722
|
|
|
724
|
-
return (stroke_width, stroke_color, stroke_alpha, fill_color, fill_alpha, fill_rule)
|
|
723
|
+
return (stroke_width, stroke_color, stroke_alpha, fill_color, fill_alpha, fill_rule, style['pathcut'])
|
|
725
724
|
|
|
726
725
|
|
|
727
726
|
path_curves = {}
|
|
@@ -776,9 +775,13 @@ class Compiler:
|
|
|
776
775
|
# Render svg 'stroke' attribute
|
|
777
776
|
for line_chain in path_curves[name_id]:
|
|
778
777
|
# get style info
|
|
779
|
-
stroke_width, stroke_color, stroke_alpha, fill_color, fill_alpha, fill_rule = get_style_info_of_line_chain(line_chain)
|
|
778
|
+
stroke_width, stroke_color, stroke_alpha, fill_color, fill_alpha, fill_rule, style_pathcut = get_style_info_of_line_chain(line_chain)
|
|
780
779
|
|
|
781
|
-
if
|
|
780
|
+
if (style_pathcut is not None and style_pathcut == 'true') or self.settings["pathcut"]:
|
|
781
|
+
# cut path
|
|
782
|
+
self.body.extend([f"\n; cut path (pathcut set) '{name_id}'"])
|
|
783
|
+
render_pathwidth(line_chain, [0], None, None, boundingbox)
|
|
784
|
+
elif len(stroke_color):
|
|
782
785
|
|
|
783
786
|
# Get stroke alpha channel (opacity)
|
|
784
787
|
# fill opacity attribute overrides rgba property
|
|
@@ -840,13 +843,12 @@ class Compiler:
|
|
|
840
843
|
if not (delta == stroke_width and stroke_width % 2 != 0):
|
|
841
844
|
steps.append(round(-delta * pixel_size, self.precision))
|
|
842
845
|
|
|
843
|
-
# color_coded isn't set:
|
|
844
|
-
self.body.extend([f"\n; engrave path '{name_id}', color '{stroke_color}'"])
|
|
846
|
+
# color_coded isn't set: engrave path with stroke color
|
|
847
|
+
self.body.extend([f"\n; default action: engrave path '{name_id}', color '{stroke_color}'"])
|
|
845
848
|
render_pathwidth(line_chain, steps, inverse_bw, speed, boundingbox)
|
|
846
849
|
else:
|
|
847
|
-
#
|
|
848
|
-
self.body.extend([f"\n; no stroke color set:
|
|
849
|
-
#render_pathwidth(line_chain, [0], None, None, boundingbox)
|
|
850
|
+
# cannot engrave path (ignore)
|
|
851
|
+
self.body.extend([f"\n; cannot engrave path (ignore) no stroke color set: path '{name_id}'"])
|
|
850
852
|
|
|
851
853
|
# Render svg 'fill' attribute
|
|
852
854
|
#if not self.settings["nofill"] and fill_color is not None and boundingbox.get() is not None:
|