Batch Printing And Exporting to PDF using Python

How is it going everyone! I have been using Rhino for around two years now and have just started to play around with Python Scripts. For my line of work I end up printing a lot of layouts as well as export them to a pdf so the rest of my coworkers can easily observe my documentation (Ones who dont use Rhino). After a couple days messing around with Rhnio’s editpythonscript command I came up with two scripts that open and export and or print any Rhino file in that directory. This was designed for people who use layouts. Also I am fairly new to python code so if there is a better way constructive feedback is always appreciated. When I was looking for information about batch printing I could not find any simple python scripts, these are really simple and should be easy to follow. All you have to do is place the script in the directory with all the rhino files you want exported or printed. Then open any rhino file (a new file is best) and enter editpythonscript, once the Rhino Python Editor is open, open the script located in the directory that you placed it in and hit that play button or F5! Hope you all enjoy I know this will be saving me quite a bit of time.

All the best,
Derek

Export Rhino Files to PDF.py (1.1 KB) Print Rhino Files.py (821 Bytes)

1 Like

Hi @dcomeau

Thank you for sharing your scripts. They are really helpful to understand the procedure involved in printing multiple layouts.

Do you happen to know how if there is a way to print directly from the model space? The usual Print command has the option Set Window, and I’m trying to replicate that. I strongly believe it has something to do with setting a new viewport, and passing the bounds/rectangle to the print area.

sc.doc.View.ActiveView

Not quite sure what to do next. Any ideas?

~ ~ ~ ~ ~ ~ ~ ~
Kaushik LS
Chennai, IN

I would focus on generating a layout that focuses on the model space you want printed then use my script to print out the layouts generated. I started working on something like this a couple months back but never finished it. I found some useful code on this form that was really useful and got me close. Ill post it below, hope that helps !

All the best,

DMClayoutcheckv1.py (1.3 KB)

Thank you for your suggestion, and the script. I’ll find a way to work with layouts - they’re much neater anyway.