Message 1 of 2
Export Inventor DWG to AutoCAD dxf code problem?

Not applicable
06-07-2010
04:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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