Thank Mike
I have somthing funny happen now. The scrips runs and i see it saves the dxf but the file never shows.
So I tried the Export IDW to DXF scrip that is under My Snippets and now I get a zip file with the DXF in it.
here is the code that I have
Dim oDoc As DrawingDocument
Dim oSheet As Sheet
Dim oSheets As Sheets
Try
oDoc = ThisDrawing.Document
Catch
' MsgBox("Must be ran on a drawing document!",vbOKOnly,"Error")
Exit Sub
End Try
oSheets = oDoc.Sheets
For Each oSheet In oSheets
Try
If oSheet.DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
Try
'oDoc.SaveAs(ThisDoc.FileName & ".dxf", True)
' Get the DXF translator Add-In.
Dim DXFAddIn As TranslatorAddIn
DXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")
'Set a reference to the active document (the document to be published).
Dim oDocument As Document
oDocument = ThisDoc.Document
Dim oContext As TranslationContext
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
' Create a NameValueMap object
Dim oOptions As NameValueMap
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
' Create a DataMedium object
Dim oDataMedium As DataMedium
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
' Check whether the translator has 'SaveCopyAs' options
If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
Dim strIniFile As String
strIniFile = "dxfout.ini"
' Create the name-value that specifies the ini file to use.
oOptions.Value("Export_Acad_IniFile") = strIniFile
End If
'Set the destination file name
oDataMedium.FileName = ThisDoc.PathAndFileName(False) & ".dxf"
MsgBox(oDataMedium.FileName)
'Publish document.
DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
Catch
MsgBox("Error saving file",vbOKOnly,"Error")
Exit Sub
End Try
End If
Catch
'MsgBox("Error detecting file type - probably no views on sheet: " & oSheet.Name,vbOKOnly,"Error")
End Try
Next