-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Description
Hi,
I'm trying to open a svg file as a template and position objects programmatically.
I expected a new file with the rectangle and the circle but not the triangle (that worked), where circle and rectangle are placed at the same coordinate in the top left corner (that didn't work).
instead, when looking to the resulting svg i can see that elements get the "translate()" transformation, which is move by 20 to the right and 20 to bottom.
import svgutils.transform as sg
from svgutils.compose import Unit
import sys
ovWdth = Unit('1080px')
ovHght = Unit('768px')
fig = sg.SVGFigure(ovWdth,ovHght)
#load template
tmpl = sg.fromfile('SVGTest.svg')
#get objects
boxObj = tmpl.find_id('rect846')
circObj = tmpl.find_id('path1076')
print(boxObj)
#move objects
boxObj.moveto(20,20)
circObj.moveto(20,20)
#append to figure
fig.append([boxObj, circObj])
#save figure
fig.save('SVGTest_Output.svg')Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels