submitprint gives error while printing IDW from weldment

submitprint gives error while printing IDW from weldment

mvvugt
Participant Participant
316 Views
1 Reply
Message 1 of 2

submitprint gives error while printing IDW from weldment

mvvugt
Participant
Participant

Hi,

 

A made a function wich prints the IDW from a myDoc as ApprenticeServerDrawingDocument.
All goes well, except when it is a drawing made from a weldment iam.

A COMExceptio is thrown with HRESULT: 0x8000FFFF (E_UNEXPECTED)), _COMPlusExceptionCode = -532462766

I'm completely stuck in finding a solution, is this perhaps a bug?

 

I would be very glad with any kind of help in solving this.

 

    Private Function PrintDocument(ByRef myDoc As ApprenticeServerDrawingDocument, _
            ByRef PS As PrintSheet, _
            ByVal myOrientation As PrintOrientationEnum, _
            ByVal SheetNumber As Integer) As Boolean
        Dim oDrgPrintMgr As ApprenticeDrawingPrintManager
        Dim printed As Boolean = False
        Dim ExtraPrint As Integer = 0
        Dim H As String
        Try

            If PS.NrOfCopies > 0 Then
                If PS.Department.Equals("AV") Then ' RL 20070323 extra prints for Arbeitsvorbereitung
                    H = GetCustProp(CType(myDoc, ApprenticeServerDocument), SharedFunctions.PROPERTY_EXTRA_PRINT, String.Empty)
                    If Not H.Equals(String.Empty) Then
                        Try
                            ExtraPrint = CInt(H)
                        Catch ex As Exception
                            ErrLog.Log("PrintDocument", ex.ToString, MsgType.Fault)
                        End Try
                    End If
                End If
                ErrLog.Log("Batch print", "printing " & myDoc.DisplayName & " " & PS.GetKey & " Sheet " & SheetNumber.ToString, ErrLog.MsgType.Info)
                Me.StatusBarPanelText.Text = "Printing: " & myDoc.FullFileName & " sheet: " & SheetNumber.ToString & " for " & PS.Department.ToString
                Me.StatusBarBP.Refresh()
                oDrgPrintMgr = DirectCast(myDoc.PrintManager, ApprenticeDrawingPrintManager)
                If Not oDrgPrintMgr Is Nothing Then
                    With oDrgPrintMgr
                        .Printer = PS.PrinterName
                        .PaperSize = CType(PS.InvPaperSize, PaperSizeEnum)
                        If .PaperSize = PaperSizeEnum.kPaperSizeCustom Then
                            .PaperHeight = PS.PaperHeight
                            .PaperWidth = PS.PaperWidth
                        End If

                        .PaperSource = PS.PaperSource
                        .Orientation = myOrientation
                        .NumberOfCopies = PS.NrOfCopies + ExtraPrint ' RL 20070323 extra print added
                        .AllColorsAsBlack = PS.AllColorsAsBlack
                        If PS.AllColorsAsBlack = False Then
                            If PS.IsColorPrinter = False Then
                                .ColorMode = PrintColorModeEnum.kPrintGrayScale
                            Else
                                .ColorMode = PrintColorModeEnum.kPrintColorPalette
                            End If
                        End If
                        .ScaleMode = PrintScaleModeEnum.kPrintBestFitScale
                        .PrintRange = PrintRangeEnum.kPrintSheetRange
                        .SetSheetRange(SheetNumber, SheetNumber)

                        Try
                            .SubmitPrint()
                            printed = True
                        Catch nrex As NullReferenceException
                            MsgBox(nrex.ToString, MsgBoxStyle.Exclamation, "PrintDocument")
                        Catch cex As Runtime.InteropServices.COMException
                            ErrLog.Log(cex.ToString, "PrintDocument")
                        Catch ex As Exception
                            ErrLog.Log(ex.ToString, "PrintDocument")
                        End Try
                    End With
                End If
            End If
        Catch ex As Exception
            ErrLog.Log("PrintDocument", ex.ToString, ErrLog.MsgType.Fault)
        Finally

End Try Return printed End Function

Regards,

Marcel

0 Likes
317 Views
1 Reply
Reply (1)
Message 2 of 2

chandra.shekar.g
Autodesk Support
Autodesk Support

@mvvugt,

 

I tried below code with 64 bit platform and working fine. Tested weldment assembly is attached with this post

 

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim oApprentice As Inventor.ApprenticeServerComponent
        oApprentice = New ApprenticeServerComponent

        Dim oDoc As ApprenticeServerDrawingDocument
        oDoc = oApprentice.Open("Path of drawing\WELD ASM.idw")

        Dim oPrintMng As ApprenticeDrawingPrintManager = oDoc.PrintManager
        oPrintMng.Printer = "XRX9C934E942350 PS"
        oPrintMng.NumberOfCopies = 1
        oPrintMng.SubmitPrint()

    End Sub

For further investigation, please provide non confidential weldment drawing.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes