-
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
drawSvg does not officially support units but SVGs do, sort of. I recommend using Drawing.setPixelSize() to scale your drawing so a 1 in your drawing corresponds to 1mm. You have to decide how big a standard "pixel" is. This depends on how you view the SVG. For questions like this that apply to SVGs in general, try Googling "SVG how do I specify dimensions and sizes in cm or mm?". |
Beta Was this translation helpful? Give feedback.
-
Thank you for quick response. I thought that drawSvg is a wrapper that builds svg so I've tried to specify viewport dimensions in 'mm' like '210 mm', but it appears that assert float(width) == width doesnt allow to create a new Drawing and I'm wondering if that on purpose. Anyways I'm a beginner in SVG and just exploring it's features if you think it's cumbersome to make drawSvg accept any type of dimensions in the future then it is. I'm just looking for a way to generate and print absolute encoder ring for my custom device and precision does matter and I'm choosing between drawSvg and svgwrite which accepts milimeters. Thank you anyway, I'll try the trick with setPixelSize() and I see somebody already has asked a similar question I missed somehow. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
drawSvg does not officially support units but SVGs do, sort of. I recommend using Drawing.setPixelSize() to scale your drawing so a 1 in your drawing corresponds to 1mm. You have to decide how big a standard "pixel" is. This depends on how you view the SVG.
For questions like this that apply to SVGs in general, try Googling "SVG how do I specify dimensions and sizes in cm or mm?".
Here's one result: https://jenkov.com/tutorials/svg/svg-viewport-view-box.html