My hope is that the SDK becomes rich enough in this area that ‘unusual’ cases can be dealt with through relatively simple scripts. I’ll keep this case that you are describing in mind while putting the SDK together. It is also a nice way to prototype functionality that can later be integrated into the user interface.
Thanks Steve!
Oh, and another wish for PDF export: to be able to append to an existing file. So when an existing name is given, the user is asked to either overwrite or append.
(Does anybody actually use that interface to get a PNG out of Rhino??)
I do!
Interesting.
What are the advantages over using -ViewCaptureToFile
or rendering to an image file?
And how do you deal with the aspect ratio of the window?
This is a lot like the HP printer drivers work with Office applications - it’s basically a great system. As far as custom papers go, the HP system is sloppy. If you do it, please put your normal high usability standards and programming effort into making the creation of custom paper sizes effortless for the user and easy to add to the drop-down. Maybe remove, too.
Hi Steve,
FWIW
I’m chiming in from a scripters perspective to give some feedback on the type of API functionality I’d likely use.
For exporting layouts to pdf, I imagine passing the layout object would suffice to generate the PDF. So without the need to e.g. specify pagesize as that is already set in the layout and assuming defaults like dpi and various scalings.
However defaults could be overwritten (line thicknesses handling of dots etc etc) and set in the pdf writing object beforehand.
So I’d setup a pdf writing object with customized settings and then pass an array of layouts views to export as pdf.
As for non layout prints I’d need a way to specify the viewpoint to export and pass that to a pdf writing object.
I imaging being able to pass rhino viewport objects to define both perspective and parallel projected views and allow also for 3D planar rectangles to be passed that assume parallel projections through the rectangle with righthand rule normal. These would export geometry only (no shading) much like the current .AI exporter as opposed to with viewport objects where it’s displaymode is leading for the type of export (bitmap or lines/hatches etc)
Size/scale for the exports would by default be realworld but can be overwritten again in de pdf writing object to be a fixed “paper size” and/or scale. To mimic a physical printer than can “scale to fit”.
So much for my initial thoughts on this.
Thanks
-Willem
Here is how you would export every layout page to a PDF in python
import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs
filename = rs.SaveFileName()
pages = sc.doc.Views.GetPageViews()
pdf = Rhino.FileIO.FilePdf.Create()
dpi = 300
for page in pages:
capture = Rhino.Display.ViewCaptureSettings(page, dpi)
pdf.AddPage(capture)
pdf.Write(filename)
Does that work for you?
The ViewCaptureSettings class is the key here. This is where all of the adjustments will be set for producing a page of output. This same class will be used for the upcoming SVG exporter too.
Hi Steve
That looks straightforward indeed. Im on my phone so I’ll have to check the ViewCaptureSettings class later. Thanks for the swift reply.
-Willem
The ViewCaptureSettings class will get a bunch of properties and functions over time. Right now it is still pretty simple
It makes sense that the credits runs out after 20 years of use…
Hi Brian
The Untiled4.pdf is saveas with 300 dot/ inch and Untiled5.pdf is saveas with 400 dot/ inch. The result is correct?
To me it seems not
Vittorio
Untitled5.pdf (6.0 KB)
Untitled4.pdf (5.8 KB)
Ciao @vittorio
I can’t tell what you’re reporting here.
Please:
- Attach your original 3DM file
- Describe the steps you took to get each of the PDF files
- Describe what is wrong with one or both of the PDF files
- Describe what you expect instead
Brian was referring to a different bug posted on this thread about closed curves appearing closed. Could you attach the original model that you created your PDFs from so I can debug what you are seeing?
Hi Brian
I get two different results if i saveas pdf with 300 dot / inch or 450 dots / inch as in the attached images. 450 dot / inc text out of the sheet. Fine by me PDF_1 wrong PDF_2. I hope i was clear.
Vittorio
Here there is a file .3dm :
PDF_1_small.3dm (1022.1 KB)
PDF_1.pdf (5.8 KB)
PDF_2.pdf (5.8 KB)
Tried to save as a raster image and got this:
Hi Dennis, exporting to raster works here now I think should be working in the next WIP release.
thanks,
-Pascal