ilogic to save model as DXF

ilogic to save model as DXF

bengee5454
Collaborator Collaborator
404 Views
2 Replies
Message 1 of 3

ilogic to save model as DXF

bengee5454
Collaborator
Collaborator

We have to save our models, from time to time, as DXF files. But....some companies can only read 2010 DXF and some companies 2018.

Is it possible to have a bit of code to save models as DXF and to choose the DXF year?

The DXFs are saved on a different drive, so being able to specify the location of the save would be nice.

 

Can anyone help please?

0 Likes
405 Views
2 Replies
Replies (2)
Message 2 of 3

hamza_khan1
Contributor
Contributor

Try using Matprops Publish Tool for Autodesk Inventor. 

0 Likes
Message 3 of 3

Curtis_Waguespack
Consultant
Consultant

Hi @bengee5454 

 

In the past I have just sent everyone R12 files, that way anything can open them, but you could create multiple *.ini files and then use something like this example to select which DXF version you'd like to export.

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

Imports System.Windows.Forms

' Define folder browse dialog
Dim Dialog = New FolderBrowserDialog()

' Set options for folder browser dialog
Dialog.SelectedPath = ThisDoc.Path
Dialog.ShowNewFolderButton = True
Dialog.Description = "Choose Folder"

' Show dialog box
If DialogResult.OK = Dialog.ShowDialog() Then
	oPath = Dialog.SelectedPath & "\"	
Else
	Return 'exit
End If

Dim DXF_Versions = New String(){"R12", "2010", "2018"}

oDXFVersion = InputListBox("Select a DXF Options", DXF_Versions, DXF_Versions(0), Title := "DXF Versions", ListName := "List")

Dim strIniFile As String	
'use the selected value to get the correct .ini file
'where there are multiple *.ini files previously setup, such as:
'		"C:\temp\dxfout_R12.ini"
'		"C:\temp\dxfout_2010.ini"
'		"C:\temp\dxfout_2018.ini"

strIniFile = "C:\temp\dxfout_" & oDXFVersion & ".ini"


' 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 = ThisApplication.ActiveDocument
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


' 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 = oPath & ThisDoc.FileName(False) & ".dxf"
'Publish document.
DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

EESignature