Export Inventor DWG to AutoCAD dxf code problem?

Export Inventor DWG to AutoCAD dxf code problem?

Anonymous
Not applicable
618 Views
1 Reply
Message 1 of 2

Export Inventor DWG to AutoCAD dxf code problem?

Anonymous
Not applicable
HI!
i'm trying with the code bellow to export a inventor dwg to a Autocad dxf, but the code gives the error:
run time error'5'
invalide procedure call or argument
on the line:
Call DWGAddIn.SaveCopyAs(oDocument.Parent.ActiveDocument, oContext, oOptions, oDataMedium)
can someone check what is going wrong here???,Thanks.
Public Sub dxf_s()



' Get the DXF translator Add-In.
        Dim addIns As ApplicationAddIns

        Set addIns = ThisApplication.ApplicationAddIns
        
        Dim DWGAddIn As TranslatorAddIn

 
        Dim i As Integer
        For i = 1 To addIns.count

            If addIns(i).Description = "Autodesk Internal DXF Translator" Then
                Set DWGAddIn = addIns.Item(i)
                DWGAddIn.Activate
                Exit For
            End If
         
        Next i
        
'Set a reference to the active document (the document to be published).
Dim oDocument As Document
Set oDocument = ThisApplication.ActiveDocument

Dim oContext As TranslationContext
Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = kFileBrowseIOMechanism

' Create a NameValueMap object
Dim oOptions As NameValueMap
Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap

' Create a DataMedium object
Dim oDataMedium As DataMedium
Set oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

' Check whether the translator has 'SaveCopyAs' options
If DWGAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
    oOptions.value("Export_Acad_IniFile") = "c:\exportdxf.ini"
End If
 
'Set the destination file name
oDataMedium.FileName = "c:\temp\dwgout.dxf"

Call DWGAddIn.SaveCopyAs(oDocument.Parent.ActiveDocument, oContext, oOptions, oDataMedium)
End Sub

 

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

Anonymous
Not applicable

any ideas why this code doesn't work?

0 Likes