"print" through running macro in GH

To continue the discussion here:

I am also looking for a way to automatically print with running macro in C# with RhinoApp.RunScript(macro, true);

now the macro I’m running is as below:

-_Print Setup View ViewportArea Window 0,0 Enter
50,50 Enter Destination PageSize 22.5778 22.5778
OutputColor DisplayColor Enter Enter Enter

however I don’t know where rhino is “printing” that file to. it seems the only way i can have control over the file path is by writing the macro like this:

-_Print Setup View ViewportArea Window 0,0 Enter
50,50 Enter Destination PageSize 22.5778 22.5778
OutputColor DisplayColor Enter Enter Preview

so this way the file selection pop up window shows up and I can select location and file name manually. However, I am looking for an automated way to do this in grasshopper…

In the discussion I’m linking above the conclusion is Rhino5 does not support this yet, I’m wondering is there is a way to do it in Rhino 6 as of now.

Thanks,
Demi

I am not exactly sure myself, but I think @stevebaer knows.

1 Like

The best way to do this is directly through code and not through RunScript. Here’s some sample python code that should help to get you started

thank you so much.
would exporting to a image be similar?

Similar, but different :slight_smile: You would use the ViewCapture class for this instead of the FilePdf class

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Display_ViewCapture_CaptureToBitmap_1.htm

Thankyou! I will look into it :smiley:

Update:

ended up setting view port window around my geometry by manipulating the Camera in rhino. and then running macro:

 -_ViewCaptureToFile Width 256 Height 256 <insert\file\path\iamgename.png>

Although it seems that your issue has been solved, just a quick FYI regarding PDF printing in Rhino 5. If you use a PDF printer such as Bullzip that allows you to predefine print location through an external settings file, you can get true dialogue free PDF printing in Rhino 5 using your RunScript approach.

I believe that you can achieve the same result using Acrobat DC drivers and writing some settings to the registry as well, but haven’t confirmed this yet.

wow cool. thanks