Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5804

Exporting an SVG file at 1:1 ratio with python

$
0
0

I am currently able to save an svg file of my desired outline using the code below with ViewCapture, which I found in a previous post. The issue I’m having is that after the file is saved, it is scaled down and is no longer a 1:1 ratio with the original outline. Is there a way to fix the scaling with python so that the outline in the saved svg file is the same size as the original outline?

import Rhino
import scriptcontext as sc
import System.Drawing
import rhinoscriptsyntax as rs

def exportLasernew():
        dpi = 300
        size = System.Drawing.Size(8.5*dpi, 11*dpi)
        settings = Rhino.Display.ViewCaptureSettings(sc.doc.Views.ActiveView,size, dpi)
        svgxml = Rhino.Display.ViewCapture.CaptureToSvg(settings)

        filename = rs.SaveFileName()
        svgxml.Save(filename)


Image 1 is the original outline.


Image 2 is the outline saved in the svg.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5804

Trending Articles