Message 1 of 4
Print function freezes for a couple of minutes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I made the following print function. It works fine on my computer, but it freezes for a few minutes on another user's computer. I put dialog boxes in there so we would know which step locks it up, and the 11th one is the last one we see until it unfreezes. This means "Printr.SubmitPrint()" is the culprit. Both of us can manually print (using the same settings as in the code) and it prints fine. Has anyone had an issue like this? What was your resolution?
PS-Just checking; in AutoCAD there's a print in the background setting, is there an equivalent in Inventor?
#Region " Btn_Print_C_BestFit_OnExecute"
Private Sub Btn_Print_C_BestFit_OnExecute(Context As Inv.NameValueMap) Handles Btn_Print_C_BestFit.OnExecute
MsgBox("1" & vbNewLine & "Started!", MsgBoxStyle.Information, "Debugging Info")
' Get the active document
Dim DrwDoc As Inv.DrawingDocument
' Exit if the active document isn't a drawing
Try : DrwDoc = g_InvApp.ActiveDocument : MsgBox("2" & vbNewLine & "Got the Drawing Document.", MsgBoxStyle.Information, "Debugging Info") : Catch ex As Exception : MsgBox("This isn't a drawing document", MsgBoxStyle.Information, "Document warning") : Exit Sub : End Try
' Setup an empty Print Manager (printer) for the drawing
Dim Printr As Inv.DrawingPrintManager = DrwDoc.PrintManager
MsgBox("3" & vbNewLine & "Made a Printer Manager.", MsgBoxStyle.Information, "Debugging Info")
' Set the printer
Printr.Printer = g_Plotter_DD
MsgBox("4" & vbNewLine & "Set our plotter as the destination.", MsgBoxStyle.Information, "Debugging Info")
'orientation
If DrwDoc.ActiveSheet.Width > DrwDoc.ActiveSheet.Height Then : Printr.Orientation = Inv.PrintOrientationEnum.kLandscapeOrientation
Else : Printr.Orientation = Inv.PrintOrientationEnum.kPortraitOrientation
End If
MsgBox("5" & vbNewLine & "Set the drawing orientation.", MsgBoxStyle.Information, "Debugging Info")
' Set paper size
'Printr.PaperSize = Inv.PaperSizeEnum.kPaperSizeCSheet
Printr.PaperSize = Inv.PaperSizeEnum.kPaperSizeCustom
Printr.PaperWidth = SheetSize.Arch.C.Width_cm
Printr.PaperHeight = SheetSize.Arch.C.Height_cm
MsgBox("6" & vbNewLine & "Set the Paper Size, Width, and Height.", MsgBoxStyle.Information, "Debugging Info")
' Set number of copies
Printr.NumberOfCopies = 1
MsgBox("7" & vbNewLine & "Set the # of copies.", MsgBoxStyle.Information, "Debugging Info")
' Set Print Range
Printr.PrintRange = Inv.PrintRangeEnum.kPrintCurrentSheet
MsgBox("8" & vbNewLine & "Set the current sheet as the print range.", MsgBoxStyle.Information, "Debugging Info")
' Rotate 90 deg
Printr.Rotate90Degrees = True
MsgBox("9" & vbNewLine & "Set to rotate the sheet 90 deg.", MsgBoxStyle.Information, "Debugging Info")
' Set the source
Printr.PaperSource = 1
MsgBox("10" & vbNewLine & "Printing to paper source 1.", MsgBoxStyle.Information, "Debugging Info")
' Set Scale
'Printr.Scale = 0.125
Printr.ScaleMode = Inv.PrintScaleModeEnum.kPrintBestFitScale
MsgBox("11" & vbNewLine & "Set the plot scale.", MsgBoxStyle.Information, "Debugging Info")
' Send to printer
Printr.SubmitPrint()
MsgBox("12" & vbNewLine & "Submitted plot to the plotter." & vbNewLine & "END OF PRINT COMMAND", MsgBoxStyle.Information, "Debugging Info")
End Sub
#End Region
If I'm missing any code or info please ask. My brain is frazzled!