Is there a way to automatically export a pdf or vector graphic using captureView?

Hi all,

I love the captureView component, but want to export vector geometry not jpg or png. Can this be done?

Currently I can do this by manually baking geometry and manually exporting from Rhino, or by following the process outlined in this discussion:

http://www.grasshopper3d.com/forum/topics/print-layout-from-gh

However, my goal is to fully automate this process without having to click on anything, just like the captureView component allows. Can this be done by adjusting the code within the captureView component?

Thanks,

Leland

1 Like

@LelandCurtis ,

This is a good question and I’m sorry that it seems to have fallen through the cracks back in June. It’s probably one that was a bit more suited to the McNeel forum than this one.

A component that automatically exports the Rhino view to a vector PDF is only a few lines of python/Rhinoscript. This discussion on the McNeel forum has a short script that you can use or wrap inside a Grasshopper component:

So you can set the Ladybug component to automatically bake the output and then run a component with that Rhinoscript to capture the view to a PDF. The only difficulty, then, would be hiding/deleting the geometry from the Rhino scene after you have captured the view (so that you can take the next image). In this case, you could write another small component that deletes everything from a given layer (You basically just need to call the Rhinocommon LadyerTabl.Delete() method):
http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_DocObjects_Tables_LayerTable_Delete.htm

I know this solution is a bit hacky but it’s really the best that I can offer at the moment… When we re-write the visualization classes for Ladybug[+], we’ll be sure to make the workflows for iteratively baking then deleting more streamlined.

Thanks Chris,

It appears I can figure out how to print and then delete using the info you gave. Running through the thread, I think I may run into issues avoiding the “Save As” pdf dialog. I need a method that works for anyone, without requiring customized settings. I’ll keep at it. Thanks for your help.

I am sure that there are some ways around the suppression of the “Save As” dialog in you go through Rhinocommon (perhaps using the FilePDF class). That discussion at least includes a method that works with PDF printers.

Also, I realized that Human has a nifty component to delete all objects on a layer that could save you from writing a custom component yourself:
DeleteLayer

DeleteOnLayer is a nifty component. Might be essential for VR visualization engines that require rhino geometry, not grasshopper geometry.

What about Doodlebug for creating vector graphics? These components appaer to export directly to an Illustrator file. This has the advantage of creating updatable files (change font, shift text, etc) but doesn’t appear to create a ready-made images, which is problematic when generating large number sof files. Can illustrator be triggerred to save files?

@LelandCurtis ,
I had figured that someone had already written a GH plugin to export illustrator PDFs. I have never used doodlebug but it looks like it should help you here.

What do you mean by “ready-made images”? Are you talking about exporting the colored meshes as screenshots instead of hatches (colored polygons in Illustrator)? That would be asking a lot but it’s not impossible.

@chris,

By “ready-made” I mean an actual image file, like a jpg, png, tiff, etc. The illustrator file requires illustrator to be opened. I currently use the ladybug screen shot module to capture jpgs, but can’t get vector graphics. If we can fidn a way to trigger illustrator to save a pdf or svg automatically, that woudl be ideal.