Export DXF

Export DXF

ryangilesZELTN
Explorer Explorer
1,380 Views
3 Replies
Message 1 of 4

Export DXF

ryangilesZELTN
Explorer
Explorer

I have the follow iLogic rule to prompt for a DXF export when saving. It ran fine untill I updated to 2022, now I am getting the following error. I'm not familiar with iLogic code, anyone have any ideas?

ryangilesZELTN_0-1651085203685.png

ryangilesZELTN_1-1651085217395.png

 

'query user

question = MessageBox.Show(".DXF Export Required?", "DXF Export",MessageBoxButtons.YesNo,MessageBoxIcon.Question)

          'set condition based on answer
            If question = vbYes Then
			
' Get the DXF translator Add-In.
path_and_nameDXF = ThisDoc.PathAndFileName(False)
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

If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
Dim strIniFile As String
strIniFile = "C:\Users\Farr\Documents\Inventor\DXF_EXPORT_INI\DXF_EXPORT.ini"
oOptions.Value("Export_Acad_IniFile") = strIniFile
End If

oDataMedium.FileName = path_and_nameDXF & ".dxf"

Call DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
End If 
0 Likes
Accepted solutions (1)
1,381 Views
3 Replies
Replies (3)
Message 2 of 4

Ralf_Krieg
Advisor
Advisor

Hello

 

Is this path already correct?

C:\Users\Farr\Documents\Inventor\DXF_EXPORT_INI\DXF_EXPORT.ini

R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 3 of 4

ryangilesZELTN
Explorer
Explorer

I changed that path to what's in the following code. It runs now, however it is exporting it into a .ZIP file under the part number, rather than into the directory as all the other files. Any ideas as to why that maybe happening?

 

'query user

question = MessageBox.Show(".DXF Export Required?", "DXF Export",MessageBoxButtons.YesNo,MessageBoxIcon.Question)

          'set condition based on answer
            If question = vbYes Then
			
' Get the DXF translator Add-In.
path_and_nameDXF = ThisDoc.PathAndFileName(False)
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

If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
Dim strIniFile As String
strIniFile = "C:\Users\Public\Documents\Autodesk\Inventor 2022\Design Data\DWG-DXF\exportdxf.ini"
oOptions.Value("Export_Acad_IniFile") = strIniFile
End If

oDataMedium.FileName = path_and_nameDXF & ".dxf"

Call DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
End If 
0 Likes
Message 4 of 4

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

Check exportdxf.ini for the option set USE TRANSMITTAL=No


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes