I was wondering if someone could help me write a script to automate a very tedious workflow.
I want to keep this simple. I work by organizing multiple 2D drawings inside a grid on one single Rhino file.
What I need to do is automate the printing of each of these drawings to separate PDFs files (one for each grid cell).
Not sure which is the best direction to take: To use “Layouts” or “Print Window”.
Using Layout offers no advantage to me for this specific workflow.
Each cell should be a different pdf. You can imagine doing this with the Ctrl + P and “moving” the “Print Window” form its center to the center of each cell and saving and naming each PDF gets quite tedious. (Not to mention the select > invert > hide combo to get each individual drawing alone).
Maybe to simplify things I could first print 1 pdf with all correct settings (given that Rhino remembers used settings) and then run the script.
Any insight would mean a tremendous help!
Thanks in advance,
Hi @Mahdiyar I tried to run your script on another file and it seems it crashed.
I realized you check for all objects in the document, and then test if these are curves or polylines. On my working files I have many Make2Ds that have thousands of curves and a lot of these are polylines… So I am guessing thats why it crashed.
Maybe it is easier to just select the objects of “x” layer, say “Bounding Curves” ?
Edit: I modified the script like so and the layer selection works:
objs = rs.ObjectsByLayer("Curves", True)
for obj in objs:
i = i +1
Still, for some reason the createLayout def is generating some weird results (even if using it without modifications) where objects are not properly zoomed at, or not zoomed at all.
Edit02: Nvm, it works if the Layout Unit is set to the same Unit as the File before running the script, for example both in meters.