File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -321,7 +321,6 @@ def To_SVG(self):
321321 else :
322322 svg = base .encode ()
323323
324- print (self .metadata )
325324 return svg
326325
327326
Original file line number Diff line number Diff line change @@ -44,9 +44,16 @@ def __init__(self):
4444
4545
4646 def From_SVG (self , tag ):
47- x = tag ['x' ]
48- y = tag ['y' ]
49- self .at = [str (float (x ) / pxToMM ), str (float (y ) / pxToMM )]
47+ x = float (tag ['x' ])
48+ y = float (tag ['y' ])
49+ if tag .has_attr ('transform' ):
50+ transform = tag ['transform' ]
51+ translate = transform [transform .find ('translate(' ) + 10 :- 1 ]
52+ translate = translate [0 :translate .find (')' )]
53+ xt , yt = translate .split (',' )
54+ x = (float (xt ) + x )
55+ y = (float (yt ) + y )
56+ self .at = [str (x / pxToMM ), str (y / pxToMM )]
5057
5158 self .size = str (float (tag ['size' ]) / pxToMM )
5259 self .drill = str (float (tag ['drill' ]) / pxToMM )
You can’t perform that action at this time.
0 commit comments