Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi.
I'm trying to create a iLogic code that prints my drawings and depending on what the sheetsize is, it sends it to diffrent printers (A4 & A3 same printer, A2 & A1 diffrent printer) and adjusts the printmanagers sheetsize.
Found a post regarding this but can't get it to work.
https://forums.autodesk.com/t5/inventor-customization/ilogic-print-to-active-sheet-size/td-p/5816292
I get the error "Can't convert the String A3 to Integer"
Here is my attempt.
Sub Main()
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
Dim PrinterPlotter = "\\OVO-PRINT01\OVB-HQ-Floor1-Construction-Plotter-01"
Dim PrinterCommon = "\\OVO-PRINT01\OVB-HQ-Floor1-Common-Color-01"
'MessageBox.Show(GetPaperSize(ActiveSheet.Size), "Title")
SheetSize = ActiveSheet.Size
MessageBox.Show(SheetSize, "Title")
If SheetSize = "A4" Then
oDrgPrintMgr.Printer = PrinterCommon
ElseIf SheetSize = "A3" Then
oDrgPrintMgr.Printer = PrinterCommon
ElseIf SheetSize = "A2" Then
oDrgPrintMgr.Printer = PrinterPlotter
ElseIf SheetSize = "A1" Then
oDrgPrintMgr.Printer = PrinterPlotter
End If
' Set the printer name' comment this line to use default printer or assign another one
'oDrgPrintMgr.Printer = PrinterCommon
'Set the paper size , scale and orientation
oDrgPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintBestFitScale
'oDrgPrintMgr.PaperSize = PaperSizeEnum.kPaperSizeA3
oDrgPrintMgr.PaperSize = GetPaperSize(ActiveSheet.Size)
oDrgPrintMgr.PrintRange = kPrintAllSheets
oDrgPrintMgr.Orientation = kLandscapeOrientation
oDrgPrintMgr.AllColorsAsBlack = True
oDrgPrintMgr.SubmitPrint
End Sub
Function GetPaperSize(shtSize As DrawingSheetSizeEnum) As PaperSizeEnum
'Add a line for each sheet and papersize combination
If shtSize = DrawingSheetSizeEnum.kA0DrawingSheetSize Then Return PaperSizeEnum.kPaperSizeA0
End Function
Thanks in advance
//Jesper
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Solved! Go to Solution.