You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With some svg I have this error :
File "B:\berialdraw\scripts\svg2icn.py", line 288, in
icn.parse()
File "B:\berialdraw\scripts\svg2icn.py", line 15, in parse
new_paths = self.move_paths_to_origin(converted_paths, self.x, self.y)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "B:\berialdraw\scripts\svg2icn.py", line 209, in move_paths_to_origin
return [
^
File "B:\berialdraw\scripts\svg2icn.py", line 210, in
path.translated(complex(-x, -y))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "X:\Portable\python311\Lib\site-packages\svgpathtools\path.py", line 3119, in translated
return translate(self, z0)
^^^^^^^^^^^^^^^^^^^
File "X:\Portable\python311\Lib\site-packages\svgpathtools\path.py", line 234, in translate
return transform_segments_together(curve, transformation)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "X:\Portable\python311\Lib\site-packages\svgpathtools\path.py", line 191, in transform_segments_together
transformed_segs = [transformation(seg) for seg in path]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "X:\Portable\python311\Lib\site-packages\svgpathtools\path.py", line 191, in
transformed_segs = [transformation(seg) for seg in path]
^^^^^^^^^^^^^^^^^^^
File "X:\Portable\python311\Lib\site-packages\svgpathtools\path.py", line 233, in
transformation = lambda seg: translate(seg, z0)
^^^^^^^^^^^^^^^^^^
File "X:\Portable\python311\Lib\site-packages\svgpathtools\path.py", line 236, in translate
return bpoints2bezier([bpt + z0 for bpt in curve.bpoints()])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "X:\Portable\python311\Lib\site-packages\svgpathtools\path.py", line 236, in
return bpoints2bezier([bpt + z0 for bpt in curve.bpoints()])
~~~~^~~~
TypeError: can only concatenate tuple (not "complex") to tuple
I fixed with this modification:
def translate(curve, z0):
"""Shifts the curve by the complex quantity z such that
translate(curve, z0).point(t) = curve.point(t) + z0"""
if isinstance(curve, Path):
transformation = lambda seg: translate(seg, z0)
return transform_segments_together(curve, transformation)
elif is_bezier_segment(curve):
lst = []
for bpt in curve.bpoints():
if type(bpt) == type((0,0)):
bpt = complex(*bpt)
lst.append(bpt + z0)
return bpoints2bezier(lst)
elif isinstance(curve, Arc):
new_start = curve.start + z0
new_end = curve.end + z0
return Arc(new_start, radius=curve.radius, rotation=curve.rotation,
large_arc=curve.large_arc, sweep=curve.sweep, end=new_end)
else:
raise TypeError("Input curve should be a Path, Line, "
"QuadraticBezier, CubicBezier, or Arc object.")
The svg file which produce this error :
The text was updated successfully, but these errors were encountered:
With some svg I have this error :
File "B:\berialdraw\scripts\svg2icn.py", line 288, in
icn.parse()
File "B:\berialdraw\scripts\svg2icn.py", line 15, in parse
new_paths = self.move_paths_to_origin(converted_paths, self.x, self.y)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "B:\berialdraw\scripts\svg2icn.py", line 209, in move_paths_to_origin
return [
^
File "B:\berialdraw\scripts\svg2icn.py", line 210, in
path.translated(complex(-x, -y))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "X:\Portable\python311\Lib\site-packages\svgpathtools\path.py", line 3119, in translated
return translate(self, z0)
^^^^^^^^^^^^^^^^^^^
File "X:\Portable\python311\Lib\site-packages\svgpathtools\path.py", line 234, in translate
return transform_segments_together(curve, transformation)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "X:\Portable\python311\Lib\site-packages\svgpathtools\path.py", line 191, in transform_segments_together
transformed_segs = [transformation(seg) for seg in path]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "X:\Portable\python311\Lib\site-packages\svgpathtools\path.py", line 191, in
transformed_segs = [transformation(seg) for seg in path]
^^^^^^^^^^^^^^^^^^^
File "X:\Portable\python311\Lib\site-packages\svgpathtools\path.py", line 233, in
transformation = lambda seg: translate(seg, z0)
^^^^^^^^^^^^^^^^^^
File "X:\Portable\python311\Lib\site-packages\svgpathtools\path.py", line 236, in translate
return bpoints2bezier([bpt + z0 for bpt in curve.bpoints()])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "X:\Portable\python311\Lib\site-packages\svgpathtools\path.py", line 236, in
return bpoints2bezier([bpt + z0 for bpt in curve.bpoints()])
~~~~^~~~
TypeError: can only concatenate tuple (not "complex") to tuple
I fixed with this modification:
def translate(curve, z0):
"""Shifts the curve by the complex quantity z such that
translate(curve, z0).point(t) = curve.point(t) + z0"""
if isinstance(curve, Path):
transformation = lambda seg: translate(seg, z0)
return transform_segments_together(curve, transformation)
elif is_bezier_segment(curve):
lst = []
for bpt in curve.bpoints():
if type(bpt) == type((0,0)):
bpt = complex(*bpt)
lst.append(bpt + z0)
return bpoints2bezier(lst)
elif isinstance(curve, Arc):
new_start = curve.start + z0
new_end = curve.end + z0
return Arc(new_start, radius=curve.radius, rotation=curve.rotation,
large_arc=curve.large_arc, sweep=curve.sweep, end=new_end)
else:
raise TypeError("Input
curve
should be a Path, Line, ""QuadraticBezier, CubicBezier, or Arc object.")
The svg file which produce this error :
The text was updated successfully, but these errors were encountered: