<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Export Drawing File to Dxf in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-drawing-file-to-dxf/m-p/13212305#M174839</link>
    <description>&lt;P&gt;Hi All,.. I create a Code For External Rule In *.dwg File.&lt;/P&gt;&lt;P&gt;my case like this:&lt;/P&gt;&lt;P&gt;1. I have a Drawing file in autodesk inventor.&lt;BR /&gt;2. I want to create an external rule which will export the active sheet into a Dwg file with a ratio of 1: 1 Autocad File 2010&lt;BR /&gt;3. The location for storing the Dwg file is placed in the active document in a folder called "01.Data"&lt;BR /&gt;4. Name the file according to the name of the active sheet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;did anyone Have some reference?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 15 Dec 2024 14:16:47 GMT</pubDate>
    <dc:creator>drafter_sby2</dc:creator>
    <dc:date>2024-12-15T14:16:47Z</dc:date>
    <item>
      <title>Export Drawing File to Dxf</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-drawing-file-to-dxf/m-p/13212305#M174839</link>
      <description>&lt;P&gt;Hi All,.. I create a Code For External Rule In *.dwg File.&lt;/P&gt;&lt;P&gt;my case like this:&lt;/P&gt;&lt;P&gt;1. I have a Drawing file in autodesk inventor.&lt;BR /&gt;2. I want to create an external rule which will export the active sheet into a Dwg file with a ratio of 1: 1 Autocad File 2010&lt;BR /&gt;3. The location for storing the Dwg file is placed in the active document in a folder called "01.Data"&lt;BR /&gt;4. Name the file according to the name of the active sheet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;did anyone Have some reference?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Dec 2024 14:16:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-drawing-file-to-dxf/m-p/13212305#M174839</guid>
      <dc:creator>drafter_sby2</dc:creator>
      <dc:date>2024-12-15T14:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Export Drawing File to Dxf</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-drawing-file-to-dxf/m-p/13212651#M174842</link>
      <description>&lt;P&gt;Something like this?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Imports System.IO.Path
Imports System.IO
Imports System.Collections
Imports System.Windows.Forms

'Check it is an .idw
If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kDrawingDocumentObject Then
    MessageBox.Show("This is not a drawing. This rule can only be run in an .idw environment" &amp;amp; vbNewLine &amp;amp; "The rule will exit...", "Error Handling",MessageBoxButtons.OK,MessageBoxIcon.Error)
    Return
End If

' Check that this file has been saved and actually exists on disk
If String.IsNullOrEmpty(ThisDoc.Path) Then
    MessageBox.Show("This file has not yet been saved and doesn't exist on disk!" &amp;amp; vbLf &amp;amp; "Please save it first","Error Handling",MessageBoxButtons.OK,MessageBoxIcon.Error)
	Return
End If

strPath_Original = ThisDoc.Path
strExportPath = ThisDoc.Path &amp;amp; "\01.Data\"
If System.IO.Directory.Exists(strExportPath) = False Then
	System.IO.Directory.CreateDirectory(strExportPath)
End If

Dim strIniFile As String
strIniFile = "C:\path to export file\ExportDWG.ini"


'Check that the export configuration file is downloaded 
If System.IO.File.Exists(strIniFile) = False Then 
	MessageBox.Show("Cannot find the export configuration file: " &amp;amp; vbNewLine &amp;amp; strIniFile &amp;amp; vbNewLine &amp;amp; "The rule will exit...", "Error Handling", MessageBoxButtons.OK, MessageBoxIcon.Error)
	Return
End If

Dim oDDoc As DrawingDocument = ThisDrawing.Document
i = 0
For Each S As Sheet In oDDoc.Sheets
	i += 1
	If S Is oDDoc.ActiveSheet Then
		ExportFilename = strExportPath &amp;amp; "Sheet " &amp;amp; i &amp;amp; "_DWG 2D.dwg"
	End If
Next

' Get the DWG translator Add-In
Dim DXFAddIn As TranslatorAddIn
DXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")

Dim oDocument As Document
oDocument = ThisApplication.ActiveDocument

Dim oContext As TranslationContext
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism

Dim oOptions As NameValueMap
oOptions = ThisApplication.TransientObjects.CreateNameValueMap

Dim oDataMedium As DataMedium
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
oOptions.Value("Export_Acad_IniFile") = strIniFile
End If

'Set the DXF target file name
oDataMedium.FileName = ExportPath &amp;amp; ExportFilename
MessageBox.Show(oDataMedium.FileName, "Filename")

Try 
	'Publish document
	DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
Catch
	MessageBox.Show("Error writing out DWG", "Error Handling",MessageBoxButtons.OK,MessageBoxIcon.Error)
End Try&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Export file attached, just unzip and put it somewhere with your system files.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Dec 2024 20:20:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-drawing-file-to-dxf/m-p/13212651#M174842</guid>
      <dc:creator>william</dc:creator>
      <dc:date>2024-12-15T20:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: Export Drawing File to Dxf</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-drawing-file-to-dxf/m-p/13213279#M174850</link>
      <description>&lt;P&gt;hai&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6396632"&gt;@william&lt;/a&gt;&amp;nbsp; ,. yes u are right.&amp;nbsp; but &lt;SPAN&gt;The location for storing the Dwg file is placed in the &lt;STRONG&gt;active document&lt;/STRONG&gt; in a folder called "01. Data" (example name) this possible to do?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Because of many problem in me. for your code to run.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="drafter_sby2_0-1734335469101.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1446280i7FDE01F9EB3AA531/image-size/medium?v=v2&amp;amp;px=400" role="button" title="drafter_sby2_0-1734335469101.png" alt="drafter_sby2_0-1734335469101.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 07:51:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-drawing-file-to-dxf/m-p/13213279#M174850</guid>
      <dc:creator>drafter_sby2</dc:creator>
      <dc:date>2024-12-16T07:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Export Drawing File to Dxf</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-drawing-file-to-dxf/m-p/13214374#M174891</link>
      <description>&lt;P&gt;Have you unzipped the .ini file and set the correct path in the rule to find it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim strIniFile As String
strIniFile = "C:\path to export file\ExportDWG.ini"&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Beyond that, I'm not sure what to suggest. It is strange that you are getting errors from line 1 onwards.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Can you open the ilogic rule in the editor and send a screenshot through?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 18:16:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-drawing-file-to-dxf/m-p/13214374#M174891</guid>
      <dc:creator>william</dc:creator>
      <dc:date>2024-12-16T18:16:31Z</dc:date>
    </item>
  </channel>
</rss>

