Ilogic Print Rule

Ilogic Print Rule

Anonymous
Not applicable
8,471 Views
5 Replies
Message 1 of 6

Ilogic Print Rule

Anonymous
Not applicable

Hi all

 

i've just started out with Ilogic programing and i have run into my first hurdle

 

i'm trying to write a rule to print .idw's or .dwg's with the correct settings

i want the Drawing sheet size to be the paper size it prints in. but no matter wich printer i choose or what i change about the Rule it eihter gives an error or prints on the default paper size of the printer

 

this is what i have so far (no errors when i run it)

Dim oDrgDoc As DrawingDocument
oDrgDoc = ThisApplication.ActiveDocument

' Set reference to drawing print manager' DrawingPrintManager has more options than PrintManager' as it's specific to drawing document
Dim oDrgPrintMgr As DrawingPrintManager
oDrgPrintMgr = oDrgDoc.PrintManager
' Set the printer name' comment this line to use default printer or assign another one'oDrgPrintMgr.Printer = "\\S-BE-JTEC-DATA\P-BE-JTEC-020"'oDrgPrintMgr.Printer = "Bullzip PDF Printer"
oDrgPrintMgr.Printer = "\\S-BE-JTEC-DATA\P-BE-JTEC-006"

'Set the paper size , scale and orientation
oDrgPrintMgr.Scalemode = kCustomScale
oDrgPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintBestFitScale
oDrgPrintMgr.PaperSize = kPaperSizeA3
'oDrgPrintMgr.PaperSize = kcustomsize'oDrgPrintMgr.PaperHeight = 16.54'oDrgPrintMgr.PaperWidth = 23.39
oDrgPrintMgr.PrintRange = kPrintCurrentSheet
oDrgPrintMgr.Orientation = kLandscapeOrientation
oDrgPrintMgr.ColorMode = kPrintColorPalette
'oDrgPrintMgr.ColorMode = kPrintGrayScale'oDrgPrintMgr.AllColorsAsBlack = True
oDrgPrintMgr.SubmitPrint

one though i had was that the plotter uses the name "ISO A2" for an A2 page and that there is the problem but even the PDF printer gets the wrong format

 

Most of all i would like to have one button that prints the active sheet in the active sheets size with the correct orientation and the correct scale

 

Anyone have a good code to solve this enigma

 

thanks

0 Likes
8,472 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

I think your problem is that you need to use PrintSizeEnum to set the correct paper size. 

 

See my code below that works for me 

 

SyntaxEditor Code Snippet

Dim oDrgDoc As DrawingDocument
oDrgDoc = ThisApplication.ActiveDocument

' Set reference to drawing print manager' DrawingPrintManager has more options than PrintManager' as it's specific to drawing document
Dim oDrgPrintMgr As DrawingPrintManager
oDrgPrintMgr = oDrgDoc.PrintManager
' Set the printer name' comment this line to use default printer or assign another one
oDrgPrintMgr.Printer = "\\PRINTSERV\Upstairs Copier"

'Set the paper size , scale and orientation
oDrgPrintMgr.Scalemode = kCustomScale
oDrgPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintBestFitScale
oDrgPrintMgr.PaperSize = PaperSizeEnum.kPaperSizeA3
oDrgPrintMgr.PrintRange = kPrintCurrentSheet
oDrgPrintMgr.Orientation = kLandscapeOrientation
oDrgPrintMgr.AllColorsAsBlack = False
oDrgPrintMgr.SubmitPrint
Message 3 of 6

Anonymous
Not applicable

Hi

 

Thanks for the Reply

 

I added that and it printed perfectly on one printer but the plotter still didn't change it's paper size

And is there a way to make the sheet size the actual paper size during printing/plotting?

 

Dim oDrgDoc As DrawingDocument
        oDrgDoc = ThisApplication.ActiveDocument
        
        ' Set reference to drawing print manager
        ' DrawingPrintManager has more options than PrintManager
        ' as it's specific to drawing document
        Dim oDrgPrintMgr As DrawingPrintManager
        oDrgPrintMgr = oDrgDoc.PrintManager
        ' Set the printer name
        ' comment this line to use default printer or assign another one
        oDrgPrintMgr.Printer = "\\S-BE-JTEC-DATA\P-BE-JTEC-020"
        'oDrgPrintMgr.Printer = "\\S-BE-JTEC-DATA\P-BE-JTEC-006"

        'Set the paper size , scale and orientation
        oDrgPrintMgr.ScaleMode = kPrintBestFitScale
        oDrgPrintMgr.PaperSize = PaperSizeEnum.kPaperSizeA2
        oDrgPrintMgr.PrintRange = kPrintAllSheets
        oDrgPrintMgr.Orientation = kLandscapeOrientation
        oDrgPrintMgr.SubmitPrint

 thanks

 

 

0 Likes
Message 4 of 6

Anonymous
Not applicable

Instead of kPaperSizeA2 try using the value 

 

oDrgPrintMgr.PaperSize = PaperSizeEnum.14339

 

For a custom size you can try kPaperSizeCustom (or the value 14355) and then set the size 

 

 

oPrintMgr.PaperHeight = 15
oPrintMgr.PaperWidth = 10
Message 5 of 6

Anonymous
Not applicable

I've tried both those approaches and i keep comming up with the same result

Could it have to do with the fact that it has to change the paper setings on the printer and not in the printer manager?

 

All other criteria can be changed in the Printer manager except the paper size that is on the Properties of the printer itself

 

is there a way to get there?

0 Likes
Message 6 of 6

Anonymous
Not applicable

This is still bug in Inventor API! 

Now I have to use hardcoded PaperSizeEnum values when printing to laser!

Hey come on Autodesk! Please fix it!

 

Related post:

http://inventorhub.autodesk.com/discussions/threads/120/post/2539524

 

0 Likes