AnsweredAssumed Answered

The object invoked has disconnected from its clients

Question asked by Thomas Hotchkin on Jan 21, 2018
Latest reply on Jan 22, 2018 by Thomas Hotchkin

Hi all,

 

Thanks to the great help here my PDM task worked great for a few weeks, until we updated to Solidworks 2018, which no longer supports ExportFlatPatternView.

 

I now have to use ExportToDWG2 which is much more complicated to use.

 

I have attached the relevant code below, which is mostly copied from the example provided in the API help. It seems to mostly be okay, except the last line bRet = swModel.ExportToDWG2 which gets an error "The object invoked has disconnected from its clients". From my understanding this is because swModel no longer exists, but I am not sure why or how to fix it.

 

Would anyone be able to suggest how to get this working again?

 

Thank a lot,

Tom.

If sheetMetal <> 0 Then
            Dim bRet As Boolean
            Dim sfilePath As String
            sfilePath = swModel.GetPathName
            Dim varAlignment As Variant
            Dim dataAlignment(11) As Double
            dataAlignment(0) = 0#
            dataAlignment(1) = 0#
            dataAlignment(2) = 0#
            dataAlignment(3) = 1#
            dataAlignment(4) = 0#
            dataAlignment(5) = 0#
            dataAlignment(6) = 0#
            dataAlignment(7) = 1#
            dataAlignment(8) = 0#
            dataAlignment(9) = 0#
            dataAlignment(10) = 0#
            dataAlignment(11) = 1#
            varAlignment = dataAlignment
            Dim options As Long
            options = 1
            bRet = swModel.ExportToDWG2(savePath, sfilePath, 1, True, varAlignment, False, False, options, Null)
        End If

Outcomes