I am trying to print a model space to a pdf by using rs.Command.
For some reason the following command does not do anything: _-Print _Go
Is this a bug? Does this mean that Rhino 6 does not allow to use the suppress dialog box Print
command?
The PDF dialog cannot be suppressed through macros. I believe that dialog box is technically a different program, so you canât interact with it through rhino. There are some options to make this work though.
First, you can now print to PDF through rhinocommon, though its options are limited and it only prints in wireframe view with sharp edges on everything: https://developer.rhino3d.com/api/RhinoCommon/html/Methods_T_Rhino_FileIO_FilePdf.htm
Iâve exposed this though my Sasquatch Plugin to grasshopper with an extra option of embedding raster views if you are using grasshopper. Disclaimer though - I havenât actually used this component in my own workflow yet, so I donât know what kind of issues might come up yet. Iâve been looking for a way to hack in rounded edges through other PDF libraries before I use it myself, but Iâve had no success yet:
Second, you can use an external pdf library to draw to a file. Something like iTextSharp for .NET development. This should work, but the conversion from 3D nurbs to 2D bezier curves that the PDF writers use would take some effort to write.
Last, and something that I have done before in c#, is to write your code so that it hijacks the print to pdf dialog after you run the macro to enter in the file name and hit print. This requires the dialog hijacking code to run on a thread parallel to the code running the macro and watch for the print dialog to pop up, which is a little bit complicated to write. The dialog hijacking also not a stable solution and only something you should be doing as a last resort. I donât have the code on me at the moment. If I can find it Iâll share.
Hi @sc_o,
Thank you for the detailed reply!
For some reason your Sasquatch Utilities plugin does not appear in the separate tab in the Grasshopper.
I unblocked both the âitextsharp.dllâ and âSasquatch.ghaâ and put them into the âComponents Folderâ (C:\Users*Username*\AppData\Roaming\Grasshopper\Libraries), restarted Rhino, but still the âSasquatchâ tab does not appear in Grasshopper.
Have you had this kind of case?
I have Rhino 6 SR11.
@djordje Hmm⌠this is the first Iâve heard of that happening. There should definitely be a Sasquatch Tab. That release of Sasquatch was written on SR12 and Iâm not sure if it is backward compatible to SR11 though. I donât have a machine running an older version to test it on myself right now.
If you can, try updating and let me know if it still doesnât work.
The next Sasquatch release will be using SDK commands introduced in SR13 which I know wonât be backward compatible with earlier service releases. Iâll add a disclaimer in the future.
Hi @sc_o,
I just updated to Rhino SR13, and your plugin works with no issues.
Thank you for the help!
Thanks for letting me know! Iâve added the disclaimer about service release versions to the download page. I hope the plugin can be of some help. Iâm hoping to look at the PDF writer again before the next release to see what can be done to improve it.
Thank you so much for the PDF printer in Sasquatch. I havenât been following the development of the Rhino PDF printer but Iâm highly impressed by itâs speed and efficiency.
At the moment, itâs a little hard to specify page dimensions in Sasquatch. When I try and print an A4 page at 300dpi, the result is not âexactlyâ A4 mm dimensions, which reduces itâs usefulness a bit for dimensioned drawings. Also control over the colour of the linework printed would be very helpful (Ideally this could be referenced in from whatever View Style the referenced Viewport uses- then setup could be entirely about defining viewports).
This is a separate idea entirely, but I wonder if a similar workflow could be integrated with the new Make2d Grasshopper components. If the PDF printer Component was able to print a set of reference curves with nothing else visible (from Make2D for example), and then combine it with a raster viewport style, I think the result could be a powerful tool. Unfortunately I think it might be a log time before Rhino is able to print Vectors with occlusion (or with solid hatches).
The Sasquatch PDF writer is using the Rhinocommon API to set page size. If it isnât coming out as the correct size then it would be a bug McNeel should be made aware of. Setting it by pixel dimensions and dpi is currently the only way to set the size in the API. Iâll have to try reproducing that myself.
Combining it with the Make 2D component is what I was planning to do as well in my own workflow eventually. Unfortunately, the current Make 2D component has a habit of âlosingâ curves - there are a few curve categories that it doesnât output that I am working on adding into a custom Make 2D component with a few extra controls to hopefully get better quality outputs.