When Rhino prints layouts to PDF, all layouts are printed in a single PDF.
i want to print layouts to PDF’s separately, one layout to one PDF in a defined folder. The PDF’s use layout names.
it should be automatic, because i have 100 Layouts, and i change mein model very often.
i mean, if i chang my model, i must overwrite the 100 pdfs one time.
Oh this is great Kelvin!
Just one question…is there a way to change output from vector to raster? I’ve been looking at ViewCaptureSettings but nothing there
thank you so much. it works good!
i have one question, i can change the PDF Size manually, if i have all layouts in A4 or A3, or A2…
but what happend if i have different Layoutsize, for example, i have 2X A4, 3XA3, 4XA0…
can you change the script that it automatically get the layousize? it will very helpful.
thank you very much.
"
import Rhino
import scriptcontext as sc
import System.Drawing
import rhinoscriptsyntax as rs
PageView has a “PageWidth” and “PageHeight” property so it should be possible to redefine “size” every iteration. If you are familiar with scripting this shouldn’t be too hard, if not you would have to wait a bit, not on a PC right now
This seems to be working, though i’m having trouble how to set up dpi if the pageunitsystem is not in inches but rather in mm, like it is typically done around here in europe…
maybe someone has more knowledge in that part? right now i’m just multiplying by a factor i found on the internet. That gives linewidths that are a bit too thick, anyways here is the code
import Rhino
import scriptcontext as sc
import System.Drawing
import rhinoscriptsyntax as rs
def createSinglePDF(view):
# converts millimeters to inch, because DPI is "DotsPerInch"
# 1 dot/inch [dpi] = 0.0393700787401575 dot/millimeter [dot/mm]
if sc.doc.ActiveDoc.PageUnitSystem == sc.doc.PageUnitSystem.Millimeters:
factor = 0.0393700787401575
else:
factor = 1.0
# create pdf object
pdf = Rhino.FileIO.FilePdf.Create()
# hardcoded dpi
dpi = 600
# create size from pageWidth / height, our factor and dpi
size = System.Drawing.Size(view.PageWidth * factor * dpi, view.PageHeight * factor * dpi)
# create settings
settings = Rhino.Display.ViewCaptureSettings(view, size, dpi)
# add one page to our pdf object containing the layout
pdf.AddPage(settings)
# create our filename
filename = "c:/pdf_output/" + view.PageName + ".pdf"
# and finally write to file
pdf.Write(filename)
for view in sc.doc.Views:
if type(view) is Rhino.Display.RhinoPageView:
createSinglePDF(view)
Hey Willem,
Yes that makes sense as 1/25,5 = 0.0393700787401575 ca.
I still don’t understand why dpi so drastically influence line thickness especially when going higher than around 2k dpi all the lines become dotted. This might be the inner workings of the pdf class in rhino or maybe the pdf format itself