<?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 Re: Another export to dxf from flat pattern with errors. (dxf is empty ) in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10913352#M40921</link>
    <description>&lt;P&gt;Thank you very much for spending time to help me!&lt;BR /&gt;&lt;BR /&gt;I only need to find those options now so i can hide bend lines e.t.c&lt;BR /&gt;&lt;BR /&gt;What did you think was the problem before? is it the .Ini file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jan 2022 13:38:25 GMT</pubDate>
    <dc:creator>K.TRYFONIDIS</dc:creator>
    <dc:date>2022-01-28T13:38:25Z</dc:date>
    <item>
      <title>Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10913062#M40918</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have combined several scripts in here and have read most of the scripts regarding the flat pattern.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal was to create a script so that it can export 2 identical dxfs to two separate defined by me, folder locations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In first place i wanted to export from the drawing environment the flat pattern in dxf but unfortunately it didn't worked out.&lt;BR /&gt;&lt;BR /&gt;Then i made the script bellow which works very good in sheet metal enviroment except from the fact that the generated dxf,s are empty inside and i get an error message. See attached dxf.&lt;BR /&gt;&lt;BR /&gt;Anyone has a clue why this is happening? Thanks a lot in advance.&lt;BR /&gt;&lt;BR /&gt;This is what shows up when i open the dxf file.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kTRIFONIDIS_1-1643370149955.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1017696i189E9EBD33732147/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kTRIFONIDIS_1-1643370149955.png" alt="kTRIFONIDIS_1-1643370149955.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this is what shows when i put it on autodesk viewer&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kTRIFONIDIS_0-1643374119685.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1017733i97A37641D7FAB991/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kTRIFONIDIS_0-1643374119685.png" alt="kTRIFONIDIS_0-1643374119685.png" /&gt;&lt;/span&gt;&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;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;()
	&lt;SPAN&gt;'query user&lt;/SPAN&gt;
&lt;SPAN&gt;question&lt;/SPAN&gt; = &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;" create DXF?"&lt;/SPAN&gt;, &lt;SPAN&gt;"attention"&lt;/SPAN&gt;,&lt;SPAN&gt;MessageBoxButtons&lt;/SPAN&gt;.&lt;SPAN&gt;YesNo&lt;/SPAN&gt;,&lt;SPAN&gt;MessageBoxIcon&lt;/SPAN&gt;.&lt;SPAN&gt;Question&lt;/SPAN&gt;)
&lt;SPAN&gt;'set condition based on answer&lt;/SPAN&gt;
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;question&lt;/SPAN&gt; = &lt;SPAN&gt;vbYes&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
	
	
  &lt;SPAN&gt;' Get the DXF translator Add-In.&lt;/SPAN&gt;
&lt;SPAN&gt;path_and_nameDXF&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;PathAndFileName&lt;/SPAN&gt;(&lt;SPAN&gt;False&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;DXFAddIn&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TranslatorAddIn&lt;/SPAN&gt;
&lt;SPAN&gt;DXFAddIn&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ApplicationAddIns&lt;/SPAN&gt;.&lt;SPAN&gt;ItemById&lt;/SPAN&gt;(&lt;SPAN&gt;"{C24E3AC4-122E-11D5-8E91-0010B541CD80}"&lt;/SPAN&gt;)
&lt;SPAN&gt;'Set a reference to the active document (the document to be published).&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDocument&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt;
&lt;SPAN&gt;oDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oContext&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TranslationContext&lt;/SPAN&gt;
&lt;SPAN&gt;oContext&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;.&lt;SPAN&gt;CreateTranslationContext&lt;/SPAN&gt;
&lt;SPAN&gt;oContext&lt;/SPAN&gt;.&lt;SPAN&gt;Type&lt;/SPAN&gt; = &lt;SPAN&gt;IOMechanismEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kFileBrowseIOMechanism&lt;/SPAN&gt;
&lt;SPAN&gt;' Create a NameValueMap object&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oOptions&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;NameValueMap&lt;/SPAN&gt;
&lt;SPAN&gt;oOptions&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;.&lt;SPAN&gt;CreateNameValueMap&lt;/SPAN&gt;
&lt;SPAN&gt;' Create a DataMedium object&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDataMedium3&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DataMedium&lt;/SPAN&gt;
&lt;SPAN&gt;oDataMedium3&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;.&lt;SPAN&gt;CreateDataMedium&lt;/SPAN&gt;

&lt;SPAN&gt;' Create a DataMedium object&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDataMedium4&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DataMedium&lt;/SPAN&gt;
&lt;SPAN&gt;oDataMedium4&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;.&lt;SPAN&gt;CreateDataMedium&lt;/SPAN&gt;

&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;DXFAddIn&lt;/SPAN&gt;.&lt;SPAN&gt;HasSaveCopyAsOptions&lt;/SPAN&gt;(&lt;SPAN&gt;oDocument&lt;/SPAN&gt;, &lt;SPAN&gt;oContext&lt;/SPAN&gt;, &lt;SPAN&gt;oOptions&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;strIniFile&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
&lt;SPAN&gt;strIniFile&lt;/SPAN&gt; = &lt;SPAN&gt;"C:\Work\DXF_EXPORT.ini"&lt;/SPAN&gt;
&lt;SPAN&gt;oOptions&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"Export_Acad_IniFile"&lt;/SPAN&gt;) = &lt;SPAN&gt;strIniFile&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;



    &lt;SPAN&gt;'Set the destination file name&lt;/SPAN&gt;
    &lt;SPAN&gt;oDataMedium3&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt; = &lt;SPAN&gt;"C:\Users\KTrifonidisNyfan\Documents\NyfanDXF\"&lt;/SPAN&gt; &amp;amp; (&lt;SPAN&gt;Left&lt;/SPAN&gt;(&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt;(&lt;SPAN&gt;False&lt;/SPAN&gt;), 11)) &amp;amp; &lt;SPAN&gt;".DXF"&lt;/SPAN&gt;
	&lt;SPAN&gt;oDataMedium4&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt; = &lt;SPAN&gt;"C:\Users\KTrifonidisNyfan\Documents\NyfanDXF2\"&lt;/SPAN&gt; &amp;amp; (&lt;SPAN&gt;Left&lt;/SPAN&gt;(&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt;(&lt;SPAN&gt;False&lt;/SPAN&gt;), 11)) &amp;amp; &lt;SPAN&gt;".DXF"&lt;/SPAN&gt;
	
	&lt;SPAN&gt;On&lt;/SPAN&gt; &lt;SPAN&gt;Error&lt;/SPAN&gt; &lt;SPAN&gt;GoTo&lt;/SPAN&gt; &lt;SPAN&gt;handleDXFLock&lt;/SPAN&gt;

    &lt;SPAN&gt;'Publish document.&lt;/SPAN&gt;
    &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;DXFAddIn&lt;/SPAN&gt;.&lt;SPAN&gt;SaveCopyAs&lt;/SPAN&gt;(&lt;SPAN&gt;oDocument&lt;/SPAN&gt;, &lt;SPAN&gt;oContext&lt;/SPAN&gt;, &lt;SPAN&gt;oOptions&lt;/SPAN&gt;, &lt;SPAN&gt;oDataMedium3&lt;/SPAN&gt;)
	&lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;DXFAddIn&lt;/SPAN&gt;.&lt;SPAN&gt;SaveCopyAs&lt;/SPAN&gt;(&lt;SPAN&gt;oDocument&lt;/SPAN&gt;, &lt;SPAN&gt;oContext&lt;/SPAN&gt;, &lt;SPAN&gt;oOptions&lt;/SPAN&gt;, &lt;SPAN&gt;oDataMedium4&lt;/SPAN&gt;)
	
	
		&lt;SPAN&gt;'Show message box&lt;/SPAN&gt;
&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"dxfs are ready at  C:\Users\KTrifonidisNyfan\Documents\NyfanDXF and C:\Users\KTrifonidisNyfan\Documents\NyfanDXF2 "&lt;/SPAN&gt;, &lt;SPAN&gt;"success !"&lt;/SPAN&gt;)
	
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
	

	
&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;


&lt;SPAN&gt;handleDXFLock&lt;/SPAN&gt;:&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"can't create dxf"&lt;/SPAN&gt;, &lt;SPAN&gt;"sorry "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;GeneralOptions&lt;/SPAN&gt;.&lt;SPAN&gt;UserName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"!"&lt;/SPAN&gt;)
&lt;SPAN&gt;Resume&lt;/SPAN&gt; &lt;SPAN&gt;Next&lt;/SPAN&gt;



&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 12:48:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10913062#M40918</guid>
      <dc:creator>K.TRYFONIDIS</dc:creator>
      <dc:date>2022-01-28T12:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10913294#M40919</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11943979"&gt;@K.TRYFONIDIS&lt;/a&gt;.&amp;nbsp; I'm not sure what all may be going on in that process for you, but if what you are after is a DXF of your sheet metal flat pattern, this may not be the best or most efficient route.&amp;nbsp; Have you considered using the DataIO object of the FlatPattern object itself to do this task?&amp;nbsp; &lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/ilogic-to-quot-save-copy-as-quot-dwg-from-ipt-flat-pattern-on/m-p/10905305/highlight/true#M133905" target="_blank" rel="noopener"&gt;Here is a link&lt;/A&gt; to a code I posted for a similar task the other day that you may like.&amp;nbsp; With a little alteration, you could probably use something similar to that.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 13:15:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10913294#M40919</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-01-28T13:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10913327#M40920</link>
      <description>&lt;P&gt;You could try it like this:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;()
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;question&lt;/SPAN&gt; = &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;" create DXF?"&lt;/SPAN&gt;, &lt;SPAN&gt;"attention"&lt;/SPAN&gt;, &lt;SPAN&gt;MessageBoxButtons&lt;/SPAN&gt;.&lt;SPAN&gt;YesNo&lt;/SPAN&gt;, &lt;SPAN&gt;MessageBoxIcon&lt;/SPAN&gt;.&lt;SPAN&gt;Question&lt;/SPAN&gt;)
    &lt;SPAN&gt;'set condition based on answer&lt;/SPAN&gt;
    &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;question&lt;/SPAN&gt; = &lt;SPAN&gt;vbYes&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;

        &lt;SPAN&gt;'Set the destination file name&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;FileName1&lt;/SPAN&gt; = &lt;SPAN&gt;"C:\Users\KTrifonidisNyfan\Documents\NyfanDXF\"&lt;/SPAN&gt; &amp;amp; (&lt;SPAN&gt;Left&lt;/SPAN&gt;(&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt;(&lt;SPAN&gt;False&lt;/SPAN&gt;), 11)) &amp;amp; &lt;SPAN&gt;".DXF"&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;FileName2&lt;/SPAN&gt; = &lt;SPAN&gt;"C:\Users\KTrifonidisNyfan\Documents\NyfanDXF2\"&lt;/SPAN&gt; &amp;amp; (&lt;SPAN&gt;Left&lt;/SPAN&gt;(&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt;(&lt;SPAN&gt;False&lt;/SPAN&gt;), 11)) &amp;amp; &lt;SPAN&gt;".DXF"&lt;/SPAN&gt;

        &lt;SPAN&gt;Export&lt;/SPAN&gt;(&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;, &lt;SPAN&gt;FileName1&lt;/SPAN&gt;)
		&lt;SPAN&gt;Export&lt;/SPAN&gt;(&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;, &lt;SPAN&gt;FileName2&lt;/SPAN&gt;)

        &lt;SPAN&gt;'Show message box&lt;/SPAN&gt;
        &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"dxfs are ready at  C:\Users\KTrifonidisNyfan\Documents\NyfanDXF and C:\Users\KTrifonidisNyfan\Documents\NyfanDXF2 "&lt;/SPAN&gt;, &lt;SPAN&gt;"success !"&lt;/SPAN&gt;)

    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;

&lt;SPAN&gt;Private&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Export&lt;/SPAN&gt;(&lt;SPAN&gt;doc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt;, &lt;SPAN&gt;newFileName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;)
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCompDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;SheetMetalComponentDefinition&lt;/SPAN&gt; = &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
    &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;HasFlatPattern&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
        &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;Unfold&lt;/SPAN&gt;()
    &lt;SPAN&gt;Else&lt;/SPAN&gt;
        &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;FlatPattern&lt;/SPAN&gt;.&lt;SPAN&gt;Edit&lt;/SPAN&gt;()
    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sOut&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;"FLAT PATTERN DXF?AcadVersion=2000&amp;amp;OuterProfileLayer=IV_INTERIOR_PROFILES"&lt;/SPAN&gt;
    &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;DataIO&lt;/SPAN&gt;.&lt;SPAN&gt;WriteDataToFile&lt;/SPAN&gt;(&lt;SPAN&gt;sOut&lt;/SPAN&gt;, &lt;SPAN&gt;newFileName&lt;/SPAN&gt;)
    &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;FlatPattern&lt;/SPAN&gt;.&lt;SPAN&gt;ExitEdit&lt;/SPAN&gt;()
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;With the sOut variable, it's possible to set all kinds of settings. (like line types on layers or not exporting them.) You can find those options in the help.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 13:28:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10913327#M40920</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2022-01-28T13:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10913352#M40921</link>
      <description>&lt;P&gt;Thank you very much for spending time to help me!&lt;BR /&gt;&lt;BR /&gt;I only need to find those options now so i can hide bend lines e.t.c&lt;BR /&gt;&lt;BR /&gt;What did you think was the problem before? is it the .Ini file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 13:38:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10913352#M40921</guid>
      <dc:creator>K.TRYFONIDIS</dc:creator>
      <dc:date>2022-01-28T13:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10913413#M40922</link>
      <description>&lt;P&gt;There was a link to the options within the post I provided a link to.&amp;nbsp; But here is the link again.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-451B918E-9374-442D-B9AE-31A8C83674B7" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-451B918E-9374-442D-B9AE-31A8C83674B7&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 14:03:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10913413#M40922</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-01-28T14:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10913425#M40923</link>
      <description>Thanks &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;</description>
      <pubDate>Fri, 28 Jan 2022 14:02:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10913425#M40923</guid>
      <dc:creator>K.TRYFONIDIS</dc:creator>
      <dc:date>2022-01-28T14:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10917665#M40924</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5011186"&gt;@JelteDeJong&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your script works perfect but i am not familiar with private subs and I would like to put 2 lines of code for an error prompt message in case someone has the dxf open but i cant figure out&amp;nbsp;&lt;/P&gt;&lt;P&gt;where to put those two lines to work properly. Any ideas?&amp;nbsp; Thanks in advance.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;On&lt;/SPAN&gt; &lt;SPAN&gt;Error&lt;/SPAN&gt; &lt;SPAN&gt;GoTo&lt;/SPAN&gt; &lt;SPAN&gt;handleDXFLock&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;handleDXFLock&lt;/SPAN&gt;:&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"message"&lt;/SPAN&gt;, &lt;SPAN&gt;"message 2"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;GeneralOptions&lt;/SPAN&gt;.&lt;SPAN&gt;UserName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"!"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 07:30:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10917665#M40924</guid>
      <dc:creator>K.TRYFONIDIS</dc:creator>
      <dc:date>2022-01-31T07:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10917750#M40925</link>
      <description>&lt;P&gt;I think you should avoid using functionslike:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;On&lt;/SPAN&gt; &lt;SPAN&gt;Error&lt;/SPAN&gt; &lt;SPAN&gt;GoTo&lt;/SPAN&gt; ....&lt;/PRE&gt;&lt;P&gt;and start using Try/Catch functions.&lt;/P&gt;&lt;P&gt;(more info on the site of Microsoft. "&lt;A href="https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/on-error-statement" target="_blank" rel="noopener"&gt;On Error Statement&lt;/A&gt;" and "&lt;A href="https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/try-catch-finally-statement" target="_blank" rel="noopener"&gt;Try/Catch&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is also what I implemented in the updated function below. (I could not test the code my self. If it doesn't work, then let me know. Later I will be having more time to check it out)&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Private Sub Export(doc As PartDocument, newFileName As String)
    Dim oCompDef As SheetMetalComponentDefinition = doc.ComponentDefinition
    If oCompDef.HasFlatPattern = False Then
        oCompDef.Unfold()
    Else
        oCompDef.FlatPattern.Edit()
    End If

    Dim sOut As String = "FLAT PATTERN DXF?AcadVersion=2000&amp;amp;OuterProfileLayer=IV_INTERIOR_PROFILES"
try
    oCompDef.DataIO.WriteDataToFile(sOut, newFileName)
catch ex as Exception
    MessageBox.Show("message", "message 2" &amp;amp; ThisApplication.GeneralOptions.UserName &amp;amp; "!")
end try
    oCompDef.FlatPattern.ExitEdit()

End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 08:15:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10917750#M40925</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2022-01-31T08:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10917763#M40926</link>
      <description>&lt;P&gt;Thank you for the information.&lt;BR /&gt;&lt;BR /&gt;Although i didn't provoke the error, the error message still shows.&lt;BR /&gt;&lt;BR /&gt;i think it needs an " exit sub " somewhere.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kTRIFONIDIS_0-1643617336984.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1018606i6CD62B07FAB6F98D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kTRIFONIDIS_0-1643617336984.png" alt="kTRIFONIDIS_0-1643617336984.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 08:25:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10917763#M40926</guid>
      <dc:creator>K.TRYFONIDIS</dc:creator>
      <dc:date>2022-01-31T08:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10918664#M40927</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11943979"&gt;@K.TRYFONIDIS&lt;/a&gt; , &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5011186"&gt;@JelteDeJong&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi guys.&amp;nbsp; Just a tip.&amp;nbsp; As you can see in the example I posted at the link (within 'Message 2' above), if you use the DataIO of the FlatPattern object directly, instead of using the DataIO of the SheetMetalComponentDefinition, you do not have to enter into the Edit mode of the FlatPattern before you use it, and then you don't have to exit back out of Edit mode when your done with it.&amp;nbsp; It's just cleaner, and more efficient that way, because it's like I mentioned before, the FlatPattern is like its own ComponentDefinition.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 15:28:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10918664#M40927</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-01-31T15:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10919219#M40928</link>
      <description>&lt;P&gt;Hey &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is a good advice, thank you. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 18:49:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10919219#M40928</guid>
      <dc:creator>K.TRYFONIDIS</dc:creator>
      <dc:date>2022-01-31T18:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10919538#M40929</link>
      <description>&lt;P&gt;I could only reproduce your problem once. After that, I could not reproduce errors anymore. But I got a general idea and it looks like an Inventor message and not so much an API exception that we can cath. We can check if the file is locked or read-only. If so we can inform the user and abort the save before we run into problems. Try the rule below.&lt;/P&gt;&lt;P&gt;It also incorporates the advice from &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt; although there is still a unfold action if there is none FlatPattern.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;()
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;question&lt;/SPAN&gt; = &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;" create DXF?"&lt;/SPAN&gt;, &lt;SPAN&gt;"attention"&lt;/SPAN&gt;, &lt;SPAN&gt;MessageBoxButtons&lt;/SPAN&gt;.&lt;SPAN&gt;YesNo&lt;/SPAN&gt;, &lt;SPAN&gt;MessageBoxIcon&lt;/SPAN&gt;.&lt;SPAN&gt;Question&lt;/SPAN&gt;)
    &lt;SPAN&gt;'set condition based on answer&lt;/SPAN&gt;
    &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;question&lt;/SPAN&gt; = &lt;SPAN&gt;vbYes&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;

        &lt;SPAN&gt;'Set the destination file name&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;FileName1&lt;/SPAN&gt; = &lt;SPAN&gt;"C:\Users\KTrifonidisNyfan\Documents\NyfanDXF\"&lt;/SPAN&gt; &amp;amp; (&lt;SPAN&gt;Left&lt;/SPAN&gt;(&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt;(&lt;SPAN&gt;False&lt;/SPAN&gt;), 11)) &amp;amp; &lt;SPAN&gt;".DXF"&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;FileName2&lt;/SPAN&gt; = &lt;SPAN&gt;"C:\Users\KTrifonidisNyfan\Documents\NyfanDXF2\"&lt;/SPAN&gt; &amp;amp; (&lt;SPAN&gt;Left&lt;/SPAN&gt;(&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt;(&lt;SPAN&gt;False&lt;/SPAN&gt;), 11)) &amp;amp; &lt;SPAN&gt;".DXF"&lt;/SPAN&gt;

        &lt;SPAN&gt;Export&lt;/SPAN&gt;(&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;, &lt;SPAN&gt;FileName1&lt;/SPAN&gt;)
        &lt;SPAN&gt;Export&lt;/SPAN&gt;(&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;, &lt;SPAN&gt;FileName2&lt;/SPAN&gt;)

        &lt;SPAN&gt;'Show message box&lt;/SPAN&gt;
        &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"dxfs are ready at  C:\Users\KTrifonidisNyfan\Documents\NyfanDXF and C:\Users\KTrifonidisNyfan\Documents\NyfanDXF2 "&lt;/SPAN&gt;, &lt;SPAN&gt;"success !"&lt;/SPAN&gt;)

    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;

&lt;SPAN&gt;Private&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Export&lt;/SPAN&gt;(&lt;SPAN&gt;doc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt;, &lt;SPAN&gt;newFileName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;)

    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;fileInfo&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;New&lt;/SPAN&gt; &lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;FileInfo&lt;/SPAN&gt;(&lt;SPAN&gt;newFileName&lt;/SPAN&gt;)
    &lt;SPAN&gt;If&lt;/SPAN&gt; (&lt;SPAN&gt;fileInfo&lt;/SPAN&gt;.&lt;SPAN&gt;Exists&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
        &lt;SPAN&gt;If&lt;/SPAN&gt; (&lt;SPAN&gt;fileInfo&lt;/SPAN&gt;.&lt;SPAN&gt;IsReadOnly&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
            &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"Target file is readonly!"&lt;/SPAN&gt;)
            &lt;SPAN&gt;Return&lt;/SPAN&gt;
        &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
        &lt;SPAN&gt;If&lt;/SPAN&gt; (&lt;SPAN&gt;IsFileLocked&lt;/SPAN&gt;(&lt;SPAN&gt;fileInfo&lt;/SPAN&gt;)) &lt;SPAN&gt;Then&lt;/SPAN&gt;
            &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"Target file is Locked!"&lt;/SPAN&gt;)
            &lt;SPAN&gt;Return&lt;/SPAN&gt;
        &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCompDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;SheetMetalComponentDefinition&lt;/SPAN&gt; = &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
    &lt;SPAN&gt;Try&lt;/SPAN&gt;
        &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;HasFlatPattern&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
            &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;Unfold&lt;/SPAN&gt;()
            &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;FlatPattern&lt;/SPAN&gt;.&lt;SPAN&gt;ExitEdit&lt;/SPAN&gt;()
        &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
    &lt;SPAN&gt;Catch&lt;/SPAN&gt;
        &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"Unable to create a FlatPattern"&lt;/SPAN&gt;)
    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;

    &lt;SPAN&gt;Try&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sOut&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;"FLAT PATTERN DXF?AcadVersion=2000&amp;amp;OuterProfileLayer=IV_INTERIOR_PROFILES"&lt;/SPAN&gt;
        &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;FlatPattern&lt;/SPAN&gt;.&lt;SPAN&gt;DataIO&lt;/SPAN&gt;.&lt;SPAN&gt;WriteDataToFile&lt;/SPAN&gt;(&lt;SPAN&gt;sOut&lt;/SPAN&gt;, &lt;SPAN&gt;newFileName&lt;/SPAN&gt;)
    &lt;SPAN&gt;Catch&lt;/SPAN&gt; &lt;SPAN&gt;ex&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Exception&lt;/SPAN&gt;
        &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"Unable to export the FlatPattern"&lt;/SPAN&gt;)
    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;

&lt;SPAN&gt;Public&lt;/SPAN&gt; &lt;SPAN&gt;Function&lt;/SPAN&gt; &lt;SPAN&gt;IsFileLocked&lt;/SPAN&gt;(&lt;SPAN&gt;file&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;FileInfo&lt;/SPAN&gt;) &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Boolean&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;stream&lt;/SPAN&gt; = &lt;SPAN&gt;DirectCast&lt;/SPAN&gt;(&lt;SPAN&gt;Nothing&lt;/SPAN&gt;, &lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;FileStream&lt;/SPAN&gt;)
    &lt;SPAN&gt;Try&lt;/SPAN&gt;
        &lt;SPAN&gt;stream&lt;/SPAN&gt; = &lt;SPAN&gt;file&lt;/SPAN&gt;.&lt;SPAN&gt;Open&lt;/SPAN&gt;(&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;FileMode&lt;/SPAN&gt;.&lt;SPAN&gt;Open&lt;/SPAN&gt;, &lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;FileAccess&lt;/SPAN&gt;.&lt;SPAN&gt;ReadWrite&lt;/SPAN&gt;, &lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;FileShare&lt;/SPAN&gt;.&lt;SPAN&gt;None&lt;/SPAN&gt;)
    &lt;SPAN&gt;Catch&lt;/SPAN&gt; &lt;SPAN&gt;Ex&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Exception&lt;/SPAN&gt;
        &lt;SPAN&gt;Return&lt;/SPAN&gt; &lt;SPAN&gt;True&lt;/SPAN&gt;
    &lt;SPAN&gt;Finally&lt;/SPAN&gt;
        &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;stream&lt;/SPAN&gt; &lt;SPAN&gt;IsNot&lt;/SPAN&gt; &lt;SPAN&gt;Nothing&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
            &lt;SPAN&gt;stream&lt;/SPAN&gt;.&lt;SPAN&gt;Close&lt;/SPAN&gt;()
        &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
    &lt;SPAN&gt;Return&lt;/SPAN&gt; &lt;SPAN&gt;False&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Function&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 21:40:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/10919538#M40929</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2022-01-31T21:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/13161252#M40930</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&amp;amp;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5011186"&gt;@JelteDeJong&lt;/a&gt;&amp;nbsp;is there a reason why the translator add-in is not used? I'm also trying to export to DXF for a sheet metal part &amp;amp; getting the empty/corrupted DXF file when using the translator add-in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If using the DataIO.WriteDataToFile method like you showed above, is there a way to incorporate an existing '.ini' file into it or just use System.IO.File.ReadAllText() for the first parameter of&amp;nbsp;DataIO.WriteDataToFile()?&lt;BR /&gt;&lt;BR /&gt;Edit: New link to documentation: &lt;A href="https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=WriteFlatPatternAsDXF_Sample" target="_blank"&gt;https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=WriteFlatPatternAsDXF_Sample&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 21:16:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/13161252#M40930</guid>
      <dc:creator>TylerWarner33</dc:creator>
      <dc:date>2024-11-19T21:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/13162906#M40931</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14832699"&gt;@TylerWarner33&lt;/a&gt;.&amp;nbsp; This is just a logical assumption, but I don't think that using the TranslatorAddIn to export an entire PartDocument object out, and expecting to get only the flat pattern profile will work, because when I have a sheet metal part open, and manually try to use the File &amp;gt; Save As &amp;gt; Save Copy As route, or try to use the File &amp;gt; Export &amp;gt; CAD Format route, the DXF file type is not available in either 'Save as type' list.&amp;nbsp; DWG, DWF, and others are available though.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As far as I know, there is no 'simple/easy' way to 'use' an existing INI file in a way that will 'fill in' that Format String needed for the &lt;A href="https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=DataIO_WriteDataToFile" target="_blank" rel="noopener"&gt;DataIO.WriteDataToFile&lt;/A&gt;&amp;nbsp;method.&amp;nbsp; However, it does seem like I have seen some folks attempt (if not succeed) at creating a code based routine for 'extracting' the needed data from one of those INI files, and use that to piece together their Format String from that data.&amp;nbsp; I do not have a link to that discussion or I would share it here, so you may have to search the forum for it.&amp;nbsp; I don't recall it being that simple looking though, and may have included some XML code language interpretation.&amp;nbsp; It would be nice to have a custom Function like that though.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may already be aware of this, but while in a sheet metal part, and in flat pattern edit mode, when you right-click on the top model browser node on the flat pattern side, then choose 'Edit Flat Pattern Definition' option from the right-click menu, you modify its orientation, punch reps, and flip bend angle reports.&amp;nbsp; And also in that same right-click menu is 'Save Copy As'.&amp;nbsp; At first, the Options button is greyed out, making folks thing that you can not specify any options.&amp;nbsp; However, if you follow through with specifying path, name, and clicking the Save button, that will open a whole new 'Flat Pattern DXF Export Options', where you can manually specify pretty much all of these settings, which are not found anywhere else, and even offers to save out the INI file (configuration) for you.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 13:12:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/13162906#M40931</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-11-20T13:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/13163220#M40932</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;, you are correct, it doesn't seem like the part file can use the translator. I require the customization specified in a '.ini' file so &lt;A href="https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=DataIO_WriteDataToFile" target="_blank" rel="noopener"&gt;DataIO.WriteDataToFile()&lt;/A&gt; doesn't work great in this case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apparently, putting the flat pattern on a drawing sheet &amp;amp; then using the translator does the trick. C# code sample shown below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;PartDocument partDocument = (PartDocument)_inventorApplication.ActiveDocument;

string dxfFileName = System.IO.Path.Combine(@"path\to\folder", System.IO.Path.GetFileNameWithoutExtension(partDocument.FullDocumentName) + $".dxf");
string iniFileName = @"path\to\file.ini";

SheetMetalComponentDefinition componentDefinition = (SheetMetalComponentDefinition)partDocument.ComponentDefinition;
if (componentDefinition.HasFlatPattern is false)
{
	componentDefinition.Unfold();
	componentDefinition.FlatPattern.ExitEdit();
}

DrawingDocument drawingDocument = (DrawingDocument)_inventorApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject, CreateVisible: true);
drawingDocument.UnitsOfMeasure.LengthUnits = partDocument.UnitsOfMeasure.LengthUnits;

Sheet sheet = drawingDocument.ActiveSheet; // drawingDocument.Sheets[1];

Point2d viewPosition = _inventorApplication.TransientGeometry.CreatePoint2d(sheet.Width / 2, sheet.Height / 2);

NameValueMap viewOptions = _inventorApplication.TransientObjects.CreateNameValueMap();
viewOptions.Add("SheetMetalFoldedModel", false);

DrawingView drawingView = sheet.DrawingViews.AddBaseView(
		(Inventor._Document)partDocument,
		viewPosition,
		1,
		ViewOrientationTypeEnum.kDefaultViewOrientation,
		DrawingViewStyleEnum.kHiddenLineDrawingViewStyle,
		AdditionalOptions: viewOptions
);

TranslatorAddIn translatorAddIn = (TranslatorAddIn)_inventorApplication.ApplicationAddIns.ItemById["{C24E3AC4-122E-11D5-8E91-0010B541CD80}"];
translatorAddIn?.Activate();
if (translatorAddIn is null || translatorAddIn.Activated is false)
{
	throw new Exception("Failed to activate DXF Translator Add-In.");
}

TranslationContext translationContext = _inventorApplication.TransientObjects.CreateTranslationContext();
translationContext.Type = IOMechanismEnum.kFileBrowseIOMechanism;

NameValueMap options = _inventorApplication.TransientObjects.CreateNameValueMap();
if (translatorAddIn.HasSaveCopyAsOptions[drawingDocument, translationContext, options])
{
	options.Value["Export_Acad_IniFile"] = iniFileName;
}

DataMedium dataMedium = _inventorApplication.TransientObjects.CreateDataMedium();
dataMedium.FileName = dxfFileName;

if (System.IO.File.Exists(dxfFileName))
{
	System.IO.File.Delete(dxfFileName);
}
translatorAddIn.SaveCopyAs(drawingDocument, translationContext, options, dataMedium);
			
drawingDocument.Close(true);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 15:07:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/13163220#M40932</guid>
      <dc:creator>TylerWarner33</dc:creator>
      <dc:date>2024-11-20T15:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Another export to dxf from flat pattern with errors. (dxf is empty )</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/13163267#M40933</link>
      <description>&lt;P&gt;Yep, the flat pattern drawing view route is the other most popular route to go, and offers the ability to do some customization to the view, bend lines, and annotations before the export also.&amp;nbsp; I pretty much never use that route myself though, because most of my DXF exports are relatively simple, and do not have many 'custom' requirements.&amp;nbsp; By the way, at some point in the past, I had also looked into just exporting a single 'Sheet' object, using its DataIO, but DWF is the only export format available.&amp;nbsp; Also looked into exporting just a single DrawingView, using its DataIO, but it only works from 'Apprentice', and only for a 'Bitmap' type, and only when that is 'available'.&amp;nbsp; Just to be thorough.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&amp;nbsp; The method for exporting DXF's that I use most are 'export face as DXF', and 'export sketch to DXF'.&amp;nbsp; The traditional way of exporting a face to DXF by code is to 'select' the face by code, then execute the command that is usually found in the right-click menu.&amp;nbsp; But I generally do not like doing selections and command executions from my rules, so I tend to favor the process of creating a temporary PlanarSketch on a face, projecting all its edges, then using its DataIO to export it to DXF, then 'UNDO' that transaction, to get rid of the temporary sketch.&amp;nbsp; No options can be specified either of those two ways, so it tends to use 'last used' settings for the export, which is usually just fine for me.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 15:25:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/another-export-to-dxf-from-flat-pattern-with-errors-dxf-is-empty/m-p/13163267#M40933</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-11-20T15:25:49Z</dc:date>
    </item>
  </channel>
</rss>

