I need to export about 1300 drawings, each A4 PDF in scale, contains some baked geometry. I was trying to use FabTools for Grasshopper but it’s crashing my Rhino as it’s not suitable for Rhino 6. Is there a way how to use RhinoScriptSyntax or some different workaround? Does anyone have an experience with that? How are you guys exporting data for fabrication if that requires piece-by-page layouts?
do you have the 1300 layouts already mapped out in Rhino?
(more like 1301 layouts here…)
if so you can try a SheetDump component in this
but I do notice that anything above 1000 in number is likely causing some major slow down, if not crash…
Thanks for suggestion. I will definitely try it. But my layouts are not mapped yet. I only were able to generate 1300 layouts using rs.AddLayout(), but now I am struggling with adding details (I am quite newbie in Python).
So far I am getting crash whenever I try to add detail to layout:
import rhinoscriptsyntax as rs
layouts = []
if run==True:
for i in range(len(target)):
layout = rs.AddLayout(title=str(i),size=[210,297])
layouts.append(str(layout))
for l in layouts:
detail = rs.AddDetail(l,(0,0),(210,297),title="D1",projection=1)
it seems that you can eliminate the str(layout) and simply add the Guid object into your layouts. rs.AddDetail() first input parameter is a Guid, not a str.
Also try doing 20 layouts first. Maybe it’s the sheer number that crashes Rhino.
I made a few components for this a while back. Let me know what you think of these. I haven’t found a way to reference layouts and details to modify them sensibly without deleting and recreating.
Thanks for sharing, @dharman, this works very well! I generated all 1356 of them.
As I tried to figure it out by myself, I guess there’s somethig wrong with AddDetail() of RhinoScriptSyntax. I am still curious how to make it work with AddDetail().
corner1 = rhutil.coerce2dpoint(corner1, True)
corner2 = rhutil.coerce2dpoint(corner2, True)
if projection<1 or projection>7: raise ValueError("projection must be a value between 1-7")
layout = scriptcontext.doc.Views.Find(layout_id)
if not layout: raise ValueError("no layout found for given layout_id")
projection = System.Enum.ToObject(Rhino.Display.DefinedViewportProjection, projection)
detail = layout.AddDetailView(title, corner1, corner2, projection)
if not detail: return scriptcontext.errorhandler()
scriptcontext.doc.Views.Redraw()
return detail.Id
Thank you for these components. Unfortunately, the first one doesn’t work for me : it creates the layout views but without considering the name and the size (They are all named “Viewport” and have a weird size of 21.6 x 27.9 cm). I tried to edit the component without success. (I’m on Rhino V7 Mac). Do you know how to solve this ? Thank you again
Hi @dharman thanks for sharing I tested your example on Mac too and the Layout-Python component doesn’t work properly, all layouts are named Viewport and use the default paper size(Letter). This happens even when N is empty. and also I tried with internal values
Rhino.RhinoDoc.ActiveDoc.Views.AddPageView(“A4_001”, 297, 210)
and again Viewport name and Letter size.
The other python works well after renaming it one by one.
On WINDOWS all run pretty fine, please could you help me to clone “n” times an existing Layout?
and your AddDetail could support perspective view? thank you!
Thanks for posting this! It was very helpful in learning how to automate layouts. Do you know if there is any way I can load a title block into these layouts? From what I can tell Rhino.RhinoDoc.ActiveDoc.Views.AddPageView method does not allow for this. I looked through the Rhino dev docs but did not seem to find anything.