Printer Settings issues

Hi Everyone,

I am working on creating a batch printing script however I am running across some issues that are stumping me. I am using rs.Command(…) to run the Layout Command and Print Command since I have not found them rhinoscriptsyntax. (Side note: If they could be implemented that would be awesome!!)

Here is the quick script I have written to test commandline printing

import rhinoscriptsyntax as rs

def _Print(printer,layout,height,width,scale):
    ##Disable Oversize Stamp##
    if height==11 and width==17:
        if rs.IsLayer("OVERSIZE")==True:
            rs.LayerVisible("OVERSIZE",False)
    
    
    ##Layout Properties##
    cmd="-_LayoutProperties "
    cmd+="Title "
    cmd+=layout+" "
    cmd+="Size "
    cmd+="Inches "
    cmd+=str(width)+" "         #Set Layout Width
    cmd+=str(height)+" "        #Set Layout Height
    cmd+="_Enter "
    ##Run Command##
    rs.Command(cmd)
    
    ##Printer Setup##
    cmd="-_Print "
    cmd+="Setup "
    cmd+="Destination "
    cmd+="Printer "
    cmd+=printer
    cmd+=" "
    
    ##Page Size##
    cmd+="PageSize "
    cmd+=str(25.4*width)+" "    #Width in mm
    cmd+=str(25.4*height)+" "   #Height in mm
    cmd+="_Enter "
    cmd+="View "
    cmd+="Scale "
    cmd+=str(scale)+" "
    cmd+="_Enter "
    cmd+="_Enter "
    cmd+="Go "
    
    rs.Command(cmd)
    
    ##Turn Oversize Back On##
    if height==11 and width==17:
        if rs.IsLayer("OVERSIZE")==True:
            rs.LayerVisible("OVERSIZE",True)
    
    ##Restore Layout Properties##
    cmd="-_LayoutProperties "
    cmd+="Title "
    cmd+=layout+" "
    cmd+="Size "
    cmd+="Inches "
    cmd+="17 "         #Set Layout Width
    cmd+="11 "        #Set Layout Height
    cmd+="_Enter"
    ##Run Command##
    rs.Command(cmd)


_Print("'Xerox WorkCentre 7655'",'DRAWING',8.5,11,1.565)

I am running into some interesting results when executing this script. My Command History is below. The printer name is not changing to the one I specify and the paper size is remaining set to the default size. It will not switch to landscape nor change to 11 x 17 if I was to specify that. However, The scale is changing…

If anyone has any insight into why this script is not changing certain values from the default values or has a different way for me to specify print options (i.e. via rhinocommon) that would be fantastic!

( Debugging=Off ): -_LayoutProperties
Property ( Title Size PaperTransparency ): Title
Layout Title : DRAWING
Property ( Title Size PaperTransparency ): Size
Units ( Inches Millimeters ): Inches
Width <17>: 11.0
Height <11>: 8.5
Property ( Title Size PaperTransparency ): _Enter
Property ( Title Size PaperTransparency ):
Command: -_Print
Print ( Go Setup Preview ): Setup
Setup ( Destination View Margins ObjectSizes Visibility ): Destination
Destination <Xerox WorkCentre 7655 rev 2.0> ( Printer PageSize OutputType=Raster OutputColor=PrintColor CalibrateXScale=1 CalibrateYScale=1 ): Printer
Printer Name: “Xerox Phaser 8550”
Destination <Xerox WorkCentre 7655 rev 2.0> ( Printer PageSize OutputType=Raster OutputColor=PrintColor CalibrateXScale=1 CalibrateYScale=1 ): PageSize
Width in mm <215.9>: 279.4
Height in mm <279.4>: 215.9
Destination <Xerox WorkCentre 7655 rev 2.0> ( Printer PageSize OutputType=Raster OutputColor=PrintColor CalibrateXScale=1 CalibrateYScale=1 ): _Enter
Destination <Xerox WorkCentre 7655 rev 2.0> ( Printer PageSize OutputType=Raster OutputColor=PrintColor CalibrateXScale=1 CalibrateYScale=1 ):
Setup ( Destination View Margins ObjectSizes Visibility ): View
View and output scale ( Viewport ViewportArea=Viewport MultipleLayouts AllLayouts ScaleToFit Scale ): Scale
Scale <1>: 1.565
View and output scale ( Viewport ViewportArea=Viewport MultipleLayouts AllLayouts ScaleToFit Scale ): _Enter
View and output scale ( Viewport ViewportArea=Viewport MultipleLayouts AllLayouts ScaleToFit Scale ):
Setup ( Destination View Margins ObjectSizes Visibility ): _Enter
Setup ( Destination View Margins ObjectSizes Visibility ):
Print ( Go Setup Preview ): Go

Thanks,
Andrew

I think this is a known bug with the -Print command that has been reported recently… I don’t think there is a workaround actually… @pascal ?

–Mitch

There were _-Print (dash version) _Setup problems reported the other day, and logged on our bug tracker… It looks like _-LayoutProperties might be broken as well, I’ll check it, thanks.

-Pascal

@pascal _-LayoutProperties does update the layout for me… I did not paste the command history where I change it back to the original page size (sorry about that). If you are running the script comment out line 59 and it will set and keep the layout values set in the script. I assume this is what makes you think LayoutProperties does not work. If I am incorrect…please ignore my comment lol

Thanks for looking into this!

-Andrew