<?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: iLogic to Batch Export PDF and DXF in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/12083313#M49154</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would you be able to alter this code so that I can pick the save destination / file path each time rather than it automatically saving to a specified location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jul 2023 11:04:36 GMT</pubDate>
    <dc:creator>ryan_holtonVREQV</dc:creator>
    <dc:date>2023-07-06T11:04:36Z</dc:date>
    <item>
      <title>iLogic to Batch Export PDF and DXF</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10363893#M49143</link>
      <description>&lt;P&gt;Good morning everyone,&lt;/P&gt;&lt;P&gt;I found this great code (shown below) at:&amp;nbsp;&lt;A href="https://magazine.thingimajigs.com/autodesk-inventor-batch-exporting-pdfs-dxfs-with-ilogic/" target="_blank" rel="noopener"&gt;AutoDesk Inventor - Batch Exporting PDFs &amp;amp; DXFs with iLogic - Thingimajigs,&lt;/A&gt;&lt;/P&gt;&lt;P&gt;done by Lance:&amp;nbsp;&lt;A href="https://grabcad.com/lance.skelly-1" target="_blank"&gt;Lance Skelly | GrabCAD&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Is really good, and saving me a lot of time when exporting,&lt;/P&gt;&lt;P&gt;the question I have is if there is a way to export only the profile of my parts when exporting to DXF's and not the whole title block and dimensions? any suggestions are welcome.&lt;/P&gt;&lt;P&gt;Thanks you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;code:&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;myDate&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;Now&lt;/SPAN&gt;().&lt;SPAN&gt;ToString&lt;/SPAN&gt;(&lt;SPAN&gt;"yyyy-MM-dd HHmmss"&lt;/SPAN&gt;)
  &lt;SPAN&gt;myDate&lt;/SPAN&gt; = &lt;SPAN&gt;myDate&lt;/SPAN&gt;.&lt;SPAN&gt;Replace&lt;/SPAN&gt;(&lt;SPAN&gt;":"&lt;/SPAN&gt;,&lt;SPAN&gt;""&lt;/SPAN&gt;)  &lt;SPAN&gt;' &amp;amp; " - " &amp;amp; TypeString&lt;/SPAN&gt;
 &lt;SPAN&gt;userChoice&lt;/SPAN&gt; = &lt;SPAN&gt;InputRadioBox&lt;/SPAN&gt;(&lt;SPAN&gt;"Defined the scope"&lt;/SPAN&gt;, &lt;SPAN&gt;"This Document"&lt;/SPAN&gt;, &lt;SPAN&gt;"All Open Documents"&lt;/SPAN&gt;, &lt;SPAN&gt;True&lt;/SPAN&gt;, &lt;SPAN&gt;Title&lt;/SPAN&gt; := &lt;SPAN&gt;"Defined the scope"&lt;/SPAN&gt;)
 &lt;SPAN&gt;UserSelectedActionList&lt;/SPAN&gt; = &lt;SPAN&gt;New&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;(){&lt;SPAN&gt;"DXF &amp;amp; PDF"&lt;/SPAN&gt;, &lt;SPAN&gt;"PDF Only"&lt;/SPAN&gt;, &lt;SPAN&gt;"DXF Only"&lt;/SPAN&gt;}
  &lt;SPAN&gt;UserSelectedAction&lt;/SPAN&gt; = &lt;SPAN&gt;InputListBox&lt;/SPAN&gt;(&lt;SPAN&gt;"What action must be performed with selected views?"&lt;/SPAN&gt;, _
          &lt;SPAN&gt;UserSelectedActionList&lt;/SPAN&gt;, &lt;SPAN&gt;UserSelectedActionList&lt;/SPAN&gt;(0), &lt;SPAN&gt;Title&lt;/SPAN&gt; := &lt;SPAN&gt;"Action to Perform"&lt;/SPAN&gt;, &lt;SPAN&gt;ListName&lt;/SPAN&gt; := &lt;SPAN&gt;"Options"&lt;/SPAN&gt;)
      &lt;SPAN&gt;Select&lt;/SPAN&gt; &lt;SPAN&gt;UserSelectedAction&lt;/SPAN&gt;
   &lt;SPAN&gt;Case&lt;/SPAN&gt; &lt;SPAN&gt;"DXF &amp;amp; PDF"&lt;/SPAN&gt;: &lt;SPAN&gt;UserSelectedAction&lt;/SPAN&gt; = 3
   &lt;SPAN&gt;Case&lt;/SPAN&gt; &lt;SPAN&gt;"PDF Only"&lt;/SPAN&gt;: &lt;SPAN&gt;UserSelectedAction&lt;/SPAN&gt; = 1
   &lt;SPAN&gt;Case&lt;/SPAN&gt; &lt;SPAN&gt;"DXF Only"&lt;/SPAN&gt;:    &lt;SPAN&gt;UserSelectedAction&lt;/SPAN&gt; = 2
   &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Select&lt;/SPAN&gt;
 &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;userChoice&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
   &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;MakePDFFromDoc&lt;/SPAN&gt;(&lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;, &lt;SPAN&gt;myDate&lt;/SPAN&gt;, &lt;SPAN&gt;UserSelectedAction&lt;/SPAN&gt;)
  &lt;SPAN&gt;Else&lt;/SPAN&gt;
   &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;
    &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; = &lt;SPAN&gt;kDrawingDocumentObject&lt;/SPAN&gt;
     &lt;SPAN&gt;Try&lt;/SPAN&gt;
      &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Len&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;File&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;)&amp;gt;0 &lt;SPAN&gt;Then&lt;/SPAN&gt;
       &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;MakePDFFromDoc&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;, &lt;SPAN&gt;myDate&lt;/SPAN&gt;, &lt;SPAN&gt;UserSelectedAction&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;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
   &lt;SPAN&gt;Next&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;Sub&lt;/SPAN&gt; &lt;SPAN&gt;MakePDFFromDoc&lt;/SPAN&gt;(&lt;SPAN&gt;ByRef&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;DateString&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;, &lt;SPAN&gt;UserSelectedAction&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Integer&lt;/SPAN&gt;)
 &lt;SPAN&gt;' oPath = oDocument.Path&lt;/SPAN&gt;
 &lt;SPAN&gt;' oFileName = oDocument.FileName(False) 'without extension&lt;/SPAN&gt;
  &lt;SPAN&gt;'oDocument = ThisApplication.ActiveDocument&lt;/SPAN&gt;
  &lt;SPAN&gt;oPDFAddIn&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;"{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}"&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;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;oDataMedium&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;oFullFileName&lt;/SPAN&gt; = &lt;SPAN&gt;oDocument&lt;/SPAN&gt;.&lt;SPAN&gt;File&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;
  &lt;SPAN&gt;oPath&lt;/SPAN&gt; = &lt;SPAN&gt;Left&lt;/SPAN&gt;(&lt;SPAN&gt;oFullFileName&lt;/SPAN&gt;, &lt;SPAN&gt;InStrRev&lt;/SPAN&gt;(&lt;SPAN&gt;oFullFileName&lt;/SPAN&gt;, &lt;SPAN&gt;"\"&lt;/SPAN&gt;)-1)
  &lt;SPAN&gt;oFileName&lt;/SPAN&gt; = &lt;SPAN&gt;Right&lt;/SPAN&gt;(&lt;SPAN&gt;oFullFileName&lt;/SPAN&gt;, &lt;SPAN&gt;Len&lt;/SPAN&gt;(&lt;SPAN&gt;oFullFileName&lt;/SPAN&gt;)-&lt;SPAN&gt;InStrRev&lt;/SPAN&gt;(&lt;SPAN&gt;oFullFileName&lt;/SPAN&gt;, &lt;SPAN&gt;"\"&lt;/SPAN&gt;))
  &lt;SPAN&gt;oFilePart&lt;/SPAN&gt; = &lt;SPAN&gt;Left&lt;/SPAN&gt;(&lt;SPAN&gt;oFileName&lt;/SPAN&gt;, &lt;SPAN&gt;InStrRev&lt;/SPAN&gt;(&lt;SPAN&gt;oFileName&lt;/SPAN&gt;, &lt;SPAN&gt;"."&lt;/SPAN&gt;)-1)
 &lt;SPAN&gt;'oRevNum = oDocument.iProperties.Value("Project", "Revision Number")&lt;/SPAN&gt;
  &lt;SPAN&gt;'oDocument = ThisApplication.ActiveDocument&lt;/SPAN&gt;
 &lt;SPAN&gt;' If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then&lt;/SPAN&gt;
  &lt;SPAN&gt;oOptions&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"All_Color_AS_Black"&lt;/SPAN&gt;) = 0
  &lt;SPAN&gt;oOptions&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"Remove_Line_Weights"&lt;/SPAN&gt;) = 0
  &lt;SPAN&gt;oOptions&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"Vector_Resolution"&lt;/SPAN&gt;) = 400
  &lt;SPAN&gt;oOptions&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"Sheet_Range"&lt;/SPAN&gt;) = &lt;SPAN&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;PrintRangeEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kPrintAllSheets&lt;/SPAN&gt;
  &lt;SPAN&gt;'oOptions.Value("Custom_Begin_Sheet") = 2&lt;/SPAN&gt;
  &lt;SPAN&gt;'oOptions.Value("Custom_End_Sheet") = 4&lt;/SPAN&gt;
 &lt;SPAN&gt;' End If&lt;/SPAN&gt;
 &lt;SPAN&gt;'get PDF target folder path&lt;/SPAN&gt;
  &lt;SPAN&gt;'oFolder = Left(oPath, InStrRev(oPath, "\")) &amp;amp; "PDF"&lt;/SPAN&gt;
  &lt;SPAN&gt;oFolder&lt;/SPAN&gt; = &lt;SPAN&gt;oPath&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\iLogic PDF's ("&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;DateString&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;")"&lt;/SPAN&gt;
 &lt;SPAN&gt;'Check for the PDF folder and create it if it does not exist&lt;/SPAN&gt;
  &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Not&lt;/SPAN&gt; &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Directory&lt;/SPAN&gt;.&lt;SPAN&gt;Exists&lt;/SPAN&gt;(&lt;SPAN&gt;oFolder&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
   &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Directory&lt;/SPAN&gt;.&lt;SPAN&gt;CreateDirectory&lt;/SPAN&gt;(&lt;SPAN&gt;oFolder&lt;/SPAN&gt;)
  &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
 &lt;SPAN&gt;'Set the PDF target file name&lt;/SPAN&gt;
  &lt;SPAN&gt;oDataMedium&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt; = &lt;SPAN&gt;oFolder&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oFilePart&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;".pdf"&lt;/SPAN&gt;
 &lt;SPAN&gt;'Publish document&lt;/SPAN&gt;
  &lt;SPAN&gt;If&lt;/SPAN&gt; (&lt;SPAN&gt;UserSelectedAction&lt;/SPAN&gt; = 1) &lt;SPAN&gt;Or&lt;/SPAN&gt; (&lt;SPAN&gt;UserSelectedAction&lt;/SPAN&gt; = 3) &lt;SPAN&gt;Then&lt;/SPAN&gt;
   &lt;SPAN&gt;oPDFAddIn&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;oDataMedium&lt;/SPAN&gt;)&lt;SPAN&gt;'For PDF's&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;UserSelectedAction&lt;/SPAN&gt; = 2) &lt;SPAN&gt;Or&lt;/SPAN&gt; (&lt;SPAN&gt;UserSelectedAction&lt;/SPAN&gt; = 3) &lt;SPAN&gt;Then&lt;/SPAN&gt;
   &lt;SPAN&gt;oDocument&lt;/SPAN&gt;.&lt;SPAN&gt;SaveAs&lt;/SPAN&gt;(&lt;SPAN&gt;oFolder&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oFilePart&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;".dxf"&lt;/SPAN&gt;, &lt;SPAN&gt;True&lt;/SPAN&gt;) &lt;SPAN&gt;'For DXF's&lt;/SPAN&gt;
  &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
  &lt;SPAN&gt;'oDocument.SaveAs(oFolder &amp;amp; "\" &amp;amp; ThisDoc.ChangeExtension(".dxf"), True) 'For DXF's&lt;/SPAN&gt;
  &lt;SPAN&gt;'------end of iLogic-------&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, 04 Jun 2021 13:03:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10363893#M49143</guid>
      <dc:creator>esaldana</dc:creator>
      <dc:date>2021-06-04T13:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to Batch Export PDF and DXF</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364099#M49144</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/330459"&gt;@esaldana&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can turn off the layers of the objects you don't want to include and then do the export, then turn the layers back on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a PDF export example that demonstrates this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;BR /&gt;Best of luck to you in all of your Inventor pursuits,&lt;BR /&gt;Curtis&lt;BR /&gt;&lt;A href="http://inventortrenches.blogspot.com" target="_blank"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;oPath = ThisDoc.Path
oFileName = ThisDoc.FileName(False) 'without extension

oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _
("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

oOptions.Value("All_Color_AS_Black") = 0
oOptions.Value("Remove_Line_Weights") = 0
oOptions.Value("Vector_Resolution") = 400
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets

'get PDF target folder path
oFolder = Left(oPath, InStrRev(oPath, "\")) &amp;amp; "PDF"


'add layers to collection
Dim oCollection As ObjectCollection
oCollection = ThisApplication.TransientObjects.CreateObjectCollection
oLayers = ThisApplication.ActiveDocument.StylesManager.Layers
oCollection.Add(oLayers(("Title (ANSI)")))
oCollection.Add(oLayers(("Border (ANSI)")))
oCollection.Add(oLayers(("Dimension (ANSI)")))

'turn layers off
For Each oLayer In oCollection
	oLayer.visible = False 
Next
ThisApplication.ActiveView.Update()

'Check for the PDF folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
System.IO.Directory.CreateDirectory(oFolder)
End If
'Set the PDF target file name
oDataMedium.FileName = oFolder &amp;amp; "\" &amp;amp; oFileName &amp;amp; ".pdf"
oPDFAddIn.SaveCopyAs(ThisApplication.ActiveDocument, oContext, oOptions, oDataMedium)'For PDF's

MessageBox.Show("PDF saved to: " &amp;amp; oFolder, "iLogic")
Process.Start(oFolder) 

'turn layers back on
For Each oLayer In oCollection
	oLayer.visible = True 
Next

&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 14:15:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364099#M49144</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2021-06-04T14:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to Batch Export PDF and DXF</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364218#M49145</link>
      <description>&lt;P&gt;Thank you Curtis,&lt;/P&gt;&lt;P&gt;I applied the section of the layers on/off to the existing code and it works really well,&lt;/P&gt;&lt;P&gt;Not to be too demanding this morning, but is there any way to instead of cancelling the layers that I don't want, just export to dxf the flatten portion , I'm using exclusively sheet metal and all that I always need is the flat pattern to be either lasered or punched. Usually I used the export from the actual sheet metal part but that way I have to go one by one, while this code is batching from the drawings which is nice.&lt;/P&gt;&lt;P&gt;thanks for you help,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 14:57:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364218#M49145</guid>
      <dc:creator>esaldana</dc:creator>
      <dc:date>2021-06-04T14:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to Batch Export PDF and DXF</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364241#M49146</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/330459"&gt;@esaldana&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;So you want to run the rule from the assembly file and export DXFs for all sheet metal part flat patterns?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you want to run the rule from a drawing file of the assembly&amp;nbsp;and export DXFs for all sheet metal part flat patterns?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you want to run the rule from drawing file that contains views of multiple flat patterns and&amp;nbsp;export DXFs for all sheet metal part flat patterns?&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>Fri, 04 Jun 2021 15:08:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364241#M49146</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2021-06-04T15:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to Batch Export PDF and DXF</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364291#M49147</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_Waguespack&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;really appreciate your attention to this message,&lt;/P&gt;&lt;P&gt;Wherever is the easiest, I will always have a single file (DWG) with several sheets (assembly drawing firs, then the sub-assemblies and finally all the parts) and need to create a single PDF with all those sheets included, finally I need to create DXFs' for all the parts having a flat pattern on them.&lt;/P&gt;&lt;P&gt;What do you suggest me?&amp;nbsp; It could be from either the top assembly or top drawing.&lt;/P&gt;&lt;P&gt;Honestly what I liked it from that original code was being able to select from either export only PDF or DXF or both and also the creation of folder with time stamp, so I could know my latest output.&lt;/P&gt;&lt;P&gt;But it can be different as soon it accomplish the tasks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 15:26:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364291#M49147</guid>
      <dc:creator>esaldana</dc:creator>
      <dc:date>2021-06-04T15:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to Batch Export PDF and DXF</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364623#M49148</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/330459"&gt;@esaldana&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would run this from the top level drawing, but you can run it from the top level assembly...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if you run it from the assembly, you get a PDF of the assembly, which I'm not sure sure is useful...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This runs through all the referenced files and DXFs out the sheet metal flat patterns... if there is no flat pattern it will create it, so you might see the model open and close in that case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just set it to output to a temp folder, but you can set the folder as needed... there are a few examples commented out for this also.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post back if it's not exactly what you're after, it can likely be tweaked to be what you're after.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;BR /&gt;Best of luck to you in all of your Inventor pursuits,&lt;BR /&gt;Curtis&lt;BR /&gt;&lt;A href="http://inventortrenches.blogspot.com" target="_blank"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main()
	
  	Dim myDate As String = Now().ToString("yyyy-MM-dd HH:mm:ss")	
	myDate = myDate.Replace(":", ".")  

	'change this as needed
	oRoot = "C:\Temp\"
'	oRoot = ThisDoc.Path 'use the document's containing folder path

	'change this as needed
	oSuffix = "Outputs" 
	'oSuffix = iProperties.Value("Project", "Project") 'use the document's Project#
	'oSuffix = iProperties.Value("Project", "Part Number") 'use the document's Part#
	
	'get target folder path
	oFolder = oRoot &amp;amp; "\" &amp;amp; oSuffix &amp;amp; " (" &amp;amp; myDate &amp;amp; ")"
	
	'Check for the PDF folder and create it if it does not exist
	If Not System.IO.Directory.Exists(oFolder) Then
		System.IO.Directory.CreateDirectory(oFolder)
	End If
	
	'open the folder
	Process.Start(oFolder) 
	
	Dim oDoc As Document
	oDoc = ThisApplication.ActiveDocument	
	
	'PDF of the file you're running it this from
	Call PDF_Out(oDoc, oFolder)
	
	'Loop through all referenced documents
	j= 1
	For Each oDoc In ThisApplication.ActiveDocument.AllReferencedDocuments	
		oName = oDoc.DisplayName
		ck = j Mod 2 
		If ck = 0 Then 
			oFlicker = ".......... "
		Else
			oFlicker = ".... "	
		End If
		ThisApplication.StatusBarText = "Processing DXF" &amp;amp; oFlicker &amp;amp; oName
		j = j + 1 

		'created DXF's of sheetmetal parts
		Call DXF_Out(oDoc, oFolder)
	
	Next

	
	ThisApplication.StatusBarText = "Done!!!!!"
End Sub
 
 
 Sub DXF_Out(ByRef oDoc As Document, oFolder As String)
	
	oFullFileName = oDoc.FullFileName
	oFileName = Right(oFullFileName, Len(oFullFileName) - InStrRev(oFullFileName, "\"))
	oName = Left(oFileName, InStrRev(oFileName, ".") - 1) 'name without extension

	'look at only Sheet metal parts
	If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then

		Dim oCompDef As SheetMetalComponentDefinition
		oCompDef = oDoc.ComponentDefinition		
		
		i = 0
		For Each oBody In oCompDef.SurfaceBodies
			If oBody.IsSolid = True Then
				i = i +1
			End If
		Next

		If i &amp;gt; 1 Then
		 	Exit Sub
		End If 

		'check for flat pattern	
		If oCompDef.HasFlatPattern = False Then 
			oCompDef.Unfold 
			oCreated_Flat = True
		Else 'if flat pattern exists		
			oCompDef.FlatPattern.Edit 
		End If
		
		sOut = "FLAT PATTERN DXF?AcadVersion=2000&amp;amp;OuterProfileLayer=IV_INTERIOR_PROFILES"
		sFullDXFname = oFolder &amp;amp; "\" &amp;amp; oName &amp;amp; ".dxf"
		
		'Output the DXF
		oCompDef.DataIO.WriteDataToFile(sOut, sFullDXFname)
		
		oCompDef.FlatPattern.ExitEdit
		Try
		If oCreated_Flat = True Then oDoc.Save
		Catch
		End Try
		oDoc.Close
	End If


 End Sub

Sub PDF_Out(ByRef oDocument As Document, oFolder As String)

	ThisApplication.StatusBarText = "Processing PDF.........." &amp;amp; oDocument.displayname
	oFullFileName = oDocument.FullFilename	
	oFileName = Right(oFullFileName, Len(oFullFileName) - InStrRev(oFullFileName, "\"))
	oName = Left(oFileName, InStrRev(oFileName, ".") -1) 'name without extension
	sFullPDFname = oFolder &amp;amp; "\" &amp;amp; oName &amp;amp; ".pdf"	
	
	oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _
	("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
	oContext = ThisApplication.TransientObjects.CreateTranslationContext
	oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
	oOptions = ThisApplication.TransientObjects.CreateNameValueMap
	oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

	oOptions.Value("All_Color_AS_Black") = 0
	oOptions.Value("Remove_Line_Weights") = 0
	oOptions.Value("Vector_Resolution") = 400
	oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets

	'Set the PDF target file name
	oDataMedium.FileName = sFullPDFname
	'output the PDF
	oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)		
End Sub
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 17:47:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364623#M49148</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2021-06-04T17:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to Batch Export PDF and DXF</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364653#M49149</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_Waguespack&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The PDF goes really well and fast,&amp;nbsp;&lt;/P&gt;&lt;P&gt;but is the only file in that temp folder,&lt;/P&gt;&lt;P&gt;I have the following error message:&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="esaldana_0-1622829311750.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/926766iB74B08507B861CD9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="esaldana_0-1622829311750.png" alt="esaldana_0-1622829311750.png" /&gt;&lt;/span&gt;&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="esaldana_1-1622829381482.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/926767iE5FE3B6D74C3710C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="esaldana_1-1622829381482.png" alt="esaldana_1-1622829381482.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have absolutely no idea of the error meaning,&lt;/P&gt;&lt;P&gt;Do you see something there?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you Curtis,&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>Fri, 04 Jun 2021 17:57:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364653#M49149</guid>
      <dc:creator>esaldana</dc:creator>
      <dc:date>2021-06-04T17:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to Batch Export PDF and DXF</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364733#M49150</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/330459"&gt;@esaldana&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just ran this on one of Autodesk's sample assemblies and the DXF part hit an error with that assembly in trying to access the sheet metal part files... so I added a missing line to open the files... it was probably accessing files in Inventor's memory when I ran this earlier.... so the error didn't happen...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Give this a try and see if that resolved it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not, What version of Inventor are you using?.... and can you provide a simple file set that demonstrates the problem, to test?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;BR /&gt;Best of luck to you in all of your Inventor pursuits,&lt;BR /&gt;Curtis&lt;BR /&gt;&lt;A href="http://inventortrenches.blogspot.com" target="_blank" rel="noopener"&gt;http://inventortrenches.blogspot.com&lt;/A&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;LI-CODE lang="markup"&gt;Sub Main()
	
  	Dim myDate As String = Now().ToString("yyyy-MM-dd HH:mm:ss")	
	myDate = myDate.Replace(":", ".")  

	'change this as needed
	oRoot = "C:\Temp"
	'oRoot = ThisDoc.Path 'use the document's containing folder path

	'change this as needed
	oSuffix = "Outputs" 
	'oSuffix = iProperties.Value("Project", "Project") 'use the document's Project#
	'oSuffix = iProperties.Value("Project", "Part Number") 'use the document's Part#
	
	'get target folder path
	oFolder = oRoot &amp;amp; "\" &amp;amp; oSuffix &amp;amp; " (" &amp;amp; myDate &amp;amp; ")"
	
	'Check for the PDF folder and create it if it does not exist
	If Not System.IO.Directory.Exists(oFolder) Then
		System.IO.Directory.CreateDirectory(oFolder)
	End If
	
	'open the folder
	Process.Start(oFolder) 
	
	Dim oDoc As Document
	oDoc = ThisApplication.ActiveDocument	
	
	'PDF of the file you're running it this from
	Call PDF_Out(oDoc, oFolder)
	
	'Loop through all referenced documents
	j= 1
	For Each oDoc In ThisApplication.ActiveDocument.AllReferencedDocuments	
		oName = oDoc.DisplayName
		ck = j Mod 2 
		If ck = 0 Then 
			oFlicker = ".......... "
		Else
			oFlicker = ".... "	
		End If
		ThisApplication.StatusBarText = "Processing DXF" &amp;amp; oFlicker &amp;amp; oName
		j = j + 1 

		'created DXF's of sheetmetal parts
		Call DXF_Out(oDoc, oFolder)
	
	Next

	
	ThisApplication.StatusBarText = "Done!!!!!"
End Sub
 
 
 Sub DXF_Out(ByRef oDoc As Document, oFolder As String)
	oCreated_Flat = False
	oFullFileName = oDoc.FullFileName
	oFileName = Right(oFullFileName, Len(oFullFileName) - InStrRev(oFullFileName, "\"))
	oName = Left(oFileName, InStrRev(oFileName, ".") - 1) 'name without extension
	Logger.Info("oName: " &amp;amp; oName)
	'look at only Sheet metal parts
	If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
		Logger.Info("Is Sheetmetal")
		Dim oCompDef As SheetMetalComponentDefinition
		oCompDef = oDoc.ComponentDefinition		
		
		i = 0
		For Each oBody In oCompDef.SurfaceBodies
			If oBody.IsSolid = True Then
				i = i +1
			End If
		Next

		If i &amp;gt; 1 Then
		 	Exit Sub
		End If 

		'check for flat pattern	
		If oCompDef.HasFlatPattern = False Then 
			Logger.Info("HasFlatPattern: " &amp;amp; HasFlatPattern)
			oCompDef.Unfold 
			oCreated_Flat = True
		Else 'if flat pattern exists
			Logger.Info("Trying to get flatpattern...")
			ThisApplication.Documents.Open(oFullFileName, True)
			oCompDef.FlatPattern.Edit 
		End If
		
		sOut = "FLAT PATTERN DXF?AcadVersion=2000&amp;amp;OuterProfileLayer=IV_INTERIOR_PROFILES"
		sFullDXFname = oFolder &amp;amp; "\" &amp;amp; oName &amp;amp; ".dxf"
		Logger.Info("sFullDXFname: " &amp;amp; sFullDXFname)
		'Output the DXF
		oCompDef.DataIO.WriteDataToFile(sOut, sFullDXFname)
		
		oCompDef.FlatPattern.ExitEdit
		Try
		If oCreated_Flat = True Then oDoc.Save
		Catch
		End Try
		oDoc.Close
	End If


 End Sub

Sub PDF_Out(ByRef oDocument As Document, oFolder As String)

	ThisApplication.StatusBarText = "Processing PDF.........." &amp;amp; oDocument.displayname
	oFullFileName = oDocument.FullFilename	
	oFileName = Right(oFullFileName, Len(oFullFileName) - InStrRev(oFullFileName, "\"))
	oName = Left(oFileName, InStrRev(oFileName, ".") -1) 'name without extension
	sFullPDFname = oFolder &amp;amp; "\" &amp;amp; oName &amp;amp; ".pdf"	
	
	oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _
	("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
	oContext = ThisApplication.TransientObjects.CreateTranslationContext
	oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
	oOptions = ThisApplication.TransientObjects.CreateNameValueMap
	oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

	oOptions.Value("All_Color_AS_Black") = 0
	oOptions.Value("Remove_Line_Weights") = 0
	oOptions.Value("Vector_Resolution") = 400
	oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets

	'Set the PDF target file name
	oDataMedium.FileName = sFullPDFname
	'output the PDF
	oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)		
End Sub

&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 18:43:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364733#M49150</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2021-06-04T18:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to Batch Export PDF and DXF</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364771#M49151</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_Waguespack&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;so close.&lt;/P&gt;&lt;P&gt;This time one of the DXF's was created (the 3rd one in the drawing, see attached PDF),&amp;nbsp; but not the others, got an error message after creating the first DXF.&lt;/P&gt;&lt;P&gt;I'm using Inventor 2020&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you Curtis,&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="esaldana_0-1622832825122.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/926773i5616B869A6DE052E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="esaldana_0-1622832825122.png" alt="esaldana_0-1622832825122.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 18:55:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364771#M49151</guid>
      <dc:creator>esaldana</dc:creator>
      <dc:date>2021-06-04T18:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to Batch Export PDF and DXF</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364807#M49152</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/330459"&gt;@esaldana&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note sure what the issue is, but I added some debugging and error catching to this version, so maybe you can figure out what it's tripping on...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Go to the View tab , User Interface button/pulldown, and check the iLogic Log option, they you can watch the log and see if you can tell what the issue is with the part file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not, I'd need to have the files to test, if you can share them, you can zip them and attach them here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;BR /&gt;Best of luck to you in all of your Inventor pursuits,&lt;BR /&gt;Curtis&lt;BR /&gt;&lt;A href="http://inventortrenches.blogspot.com" target="_blank" rel="noopener"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&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="Curtis_W_0-1622833870784.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/926777iA24C3A0960529253/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Curtis_W_0-1622833870784.png" alt="Curtis_W_0-1622833870784.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;LI-CODE lang="general"&gt;Sub Main()
	
  	Dim myDate As String = Now().ToString("yyyy-MM-dd HH:mm:ss")	
	myDate = myDate.Replace(":", ".")  

	'change this as needed
	oRoot = "C:\Temp"
	'oRoot = ThisDoc.Path 'use the document's containing folder path

	'change this as needed
	oSuffix = "Outputs" 
	'oSuffix = iProperties.Value("Project", "Project") 'use the document's Project#
	'oSuffix = iProperties.Value("Project", "Part Number") 'use the document's Part#
	
	'get target folder path
	oFolder = oRoot &amp;amp; "\" &amp;amp; oSuffix &amp;amp; " (" &amp;amp; myDate &amp;amp; ")"
	
	'Check for the PDF folder and create it if it does not exist
	If Not System.IO.Directory.Exists(oFolder) Then
		System.IO.Directory.CreateDirectory(oFolder)
	End If
	
	'open the folder
	Process.Start(oFolder) 
	
	Dim oDoc As Document
	oDoc = ThisApplication.ActiveDocument	
	
	'PDF of the file you're running it this from
	Call PDF_Out(oDoc, oFolder)
	
	'Loop through all referenced documents
	j= 1
	For Each oDoc In ThisApplication.ActiveDocument.AllReferencedDocuments	
		oName = oDoc.DisplayName
		ck = j Mod 2 
		If ck = 0 Then 
			oFlicker = ".......... "
		Else
			oFlicker = ".... "	
		End If
		ThisApplication.StatusBarText = "Processing DXF" &amp;amp; oFlicker &amp;amp; oName
		j = j + 1 

		'created DXF's of sheetmetal parts
		Call DXF_Out(oDoc, oFolder)
	
	Next

	
	ThisApplication.StatusBarText = "Done!!!!!"
End Sub
 
 
 Sub DXF_Out(ByRef oDoc As Document, oFolder As String)
	oCreated_Flat = False
	oFullFileName = oDoc.FullFileName
	oFileName = Right(oFullFileName, Len(oFullFileName) - InStrRev(oFullFileName, "\"))
	oName = Left(oFileName, InStrRev(oFileName, ".") - 1) 'name without extension	
	'look at only Sheet metal parts
	If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
		Logger.Info("File Name: " &amp;amp; oFileName)
		Logger.Info("Is Sheetmetal")
		Dim oCompDef As SheetMetalComponentDefinition
		oCompDef = oDoc.ComponentDefinition		
		
		i = 0
		Logger.Info("Looking at solid bodies....")
		For Each oBody In oCompDef.SurfaceBodies
			If oBody.IsSolid = True Then
				i = i +1
			End If
		Next

		If i &amp;gt; 1 Then
		 	Exit Sub
		End If 
		Logger.Info(".....solid bodies ok")

		'check for flat pattern	
		If oCompDef.HasFlatPattern = False Then 
			Logger.Info("HasFlatPattern: " &amp;amp; oCompDef.HasFlatPattern)
			Logger.Info("/////////////\\\\\\\\\\\\ Trying to create flatpattern...")
			Try
				oCompDef.Unfold 
				oCreated_Flat = True
			Catch ex As Exception
				oCreated_Flat = False
				Logger.Info("Problem creating flat!!!!")
				Logger.Info(ex.Message)
			End Try
		Else 'if flat pattern exists
			Logger.Info("HasFlatPattern: " &amp;amp; oCompDef.HasFlatPattern)
			Logger.Info("Trying to get flatpattern...")
			ThisApplication.Documents.Open(oFullFileName, True)
			Try
				oCompDef.FlatPattern.Edit 
			Catch ex As Exception
				Logger.Info("Problem editing flat!!!!")
				Logger.Info(ex.Message)
			End Try
		End If
		
		sOut = "FLAT PATTERN DXF?AcadVersion=2000&amp;amp;OuterProfileLayer=IV_INTERIOR_PROFILES"
		sFullDXFname = oFolder &amp;amp; "\" &amp;amp; oName &amp;amp; ".dxf"
		'Output the DXF
		oCompDef.DataIO.WriteDataToFile(sOut, sFullDXFname)
		Try
			Logger.Info("DXF created!!!:  " &amp;amp; sFullDXFname)
		Catch ex As Exception
			Logger.Info("Problem creating DXF!!!!")
			Logger.Info(ex.Message)
		End Try		
		
		oCompDef.FlatPattern.ExitEdit
		
		Try
			If oCreated_Flat = True Then oDoc.Save
		Catch ex As Exception
			Logger.Info("Saving the file.")
			Logger.Info(ex.Message)
		End Try
		
		oDoc.Close
		Logger.Info("*******************")
	End If


 End Sub

Sub PDF_Out(ByRef oDocument As Document, oFolder As String)

	ThisApplication.StatusBarText = "Processing PDF.........." &amp;amp; oDocument.displayname
	oFullFileName = oDocument.FullFilename	
	oFileName = Right(oFullFileName, Len(oFullFileName) - InStrRev(oFullFileName, "\"))
	oName = Left(oFileName, InStrRev(oFileName, ".") -1) 'name without extension
	sFullPDFname = oFolder &amp;amp; "\" &amp;amp; oName &amp;amp; ".pdf"	
	
	oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _
	("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
	oContext = ThisApplication.TransientObjects.CreateTranslationContext
	oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
	oOptions = ThisApplication.TransientObjects.CreateNameValueMap
	oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

	oOptions.Value("All_Color_AS_Black") = 0
	oOptions.Value("Remove_Line_Weights") = 0
	oOptions.Value("Vector_Resolution") = 400
	oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets

	'Set the PDF target file name
	oDataMedium.FileName = sFullPDFname
	'output the PDF
	oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)		
End Sub

&lt;/LI-CODE&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>Fri, 04 Jun 2021 19:14:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/10364807#M49152</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2021-06-04T19:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to Batch Export PDF and DXF</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/11485746#M49153</link>
      <description>&lt;DIV class=""&gt;&lt;SPAN&gt;Thank you for this rule, it´s really amazing.&lt;/SPAN&gt; &lt;SPAN&gt;I´ve been trying to modify the rule in order to get the "Title" ipropertie from the part file as a PDF file name and adding the revision number at the end but I´ve not get it.&lt;/SPAN&gt; &lt;SPAN&gt;Im realatively new in iLogic and programming, doy you have any ideas guys?&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 16 Oct 2022 07:02:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/11485746#M49153</guid>
      <dc:creator>ErnestoGL</dc:creator>
      <dc:date>2022-10-16T07:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to Batch Export PDF and DXF</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/12083313#M49154</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would you be able to alter this code so that I can pick the save destination / file path each time rather than it automatically saving to a specified location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 11:04:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/12083313#M49154</guid>
      <dc:creator>ryan_holtonVREQV</dc:creator>
      <dc:date>2023-07-06T11:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to Batch Export PDF and DXF</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/12988964#M49155</link>
      <description>&lt;P&gt;can i pleaswe get the code to save the pdf and dxf file in same folder where the original drawing file is ?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 12:12:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-batch-export-pdf-and-dxf/m-p/12988964#M49155</guid>
      <dc:creator>ALadZ339U</dc:creator>
      <dc:date>2024-08-29T12:12:26Z</dc:date>
    </item>
  </channel>
</rss>

