Python rs.command("-_print")

Hi,

Is there a way to use rs.command("-_print") in python and not having to select preview before accually printing the document?

I see three options in ths dialog:
Go, Setup, Preview.
What does Go stand for? (nothing hapens when pressing it except the function ends)

Also is there a way to use -_print to set name and destination of the printed document?

Hope this makes sence.
Best regards

-_Print _Go _Enter would try printing into your current print setup.

rs.Command("_-Print " + " _Enter " + newFilename + " _Enter", true);`

should work if you want to print into a new file with “newFilename” being the variable.

Hi, Thanks for the replys.

I get nor of the two options to work.

Seams like I can’t input name or path to where the file is suppose to be placed.
Shouldn’t the path+filename be possible to add under -_print -> _setup -> _destination menu?

More suggestions are welcome.

Best regards

@stevebaer is it only me who can’t get this to work, or is it not suppose to be possible to print pdf directly from rs.command("-_print")

Thanks in advance

Printing a Rhino document should work like described above. But since you’re printing a pdf you could try using System.Diagnostics.Process.
Something like:

from System.Diagnostics import Process, ProcessStartInfo
p = Process( );
psi = ProcessStartInfo( )
psi.CreateNoWindow = True
psi.Verb = "print"
filename = r"myfile.pdf"
psi.FileName = filename
p.StartInfo = psi
p.Start( )

Hi Alain,

Thanks for the help!
That bit of code is a bit to much for me to take in =)
Is that python language?
I tried it out in the python editor (where the rest of my code is) but it only gave me:
“The system cannot find the file specified”

The help is much appreciated!
Best regards

I noticed in How to print a pdf from python? that using
_-Print _Setup _Destination _Printer “Microsoft Print to PDF” _Enter _Enter _Go
gives a new promt to:
Save file name (browse):

But Changeing to:
_-Print _Setup _Destination _Printer “Rhino PDF” _Enter _Enter _Go
Gives no option, instead I get to “save Print output As” dialog.

I would like to have it as the “Microsoft Print to PDF” option but with “Rhino PDF” printer.
This way I don’t have to write a filename in the dialog box and pressing Enter.

Is this understandable?

Best regards

I would recommend using the following technique for saving with Rhino PDF

Thanks @stevebaer!
I knew I had read this somewhere.
Sorry for the double posts

Best regrads