<?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: Help with saving copy as iges or step of part within assembly in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11331555#M39125</link>
    <description>&lt;P&gt;OKAY&lt;/P&gt;&lt;P&gt;So again sorry for all the back and forth on this, again , BUT, i had A LOT of time this weekend to experiment and test some things out, so i think i have successfully figured it out. I ended up finding a thread you were commenting on, using a message box to return a boolean value, so after alot of trial and error i got it to work that way. If you could maybe skim over it, and see if you see anything wrong with it, as far as i can tell across the couple smaller assemblies i have tested it on, it seems to work 100%, and now the code steps through a yes no process, asking if you want to save each found component with a referenced IDW, and also to print, if yes to print it goes through the print settings, if print settings are incorrect and NO is selected cancels the whole rule. If yes on any of the save as variables, creates the needed folder and continues, and ANY visible component found without an IDW, it will add the name to a list at the end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;----------------------IM SO EXCITED, AND THANK YOU SO MUCH FOR THE HELP!!!!!! If you see anything that should be added, or any kind of fail proofing or anything that would help let me know.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*EDIT, if and when you get a moment, i have been trying to get this same code to work, but from a part file instead of assembly.. Say for example the code is ran and batch sent all the needed files, later on i find a missing hole on a part, so now i need a new STP, and new drawing, i would like to set this same rule, but only run from one part, having a hard time getting the code to recognize the reference drawing from the component i think, something isnt communicating properly. But essentially i would change each of the save as parameters so save over an existing instead of exiting sub. If you could work the definition into finding the reference drawing instead of doing it from as assembly that would be great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Full working code with all the Yes No variables&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;'Rule only finds visible components within main assembly that have a referenced IDW, so will only process a file if an IDW of a visible component is found&lt;/SPAN&gt;
	&lt;SPAN&gt;'If sub-assembly is found, only finds visible components from the default saved assembly of said sub-assembly, can set visibily and save assembly of needed components&lt;/SPAN&gt;
	&lt;SPAN&gt;'If no referenced IDW is found for any visible component, add name to list and export list to Notepad&lt;/SPAN&gt;
	&lt;SPAN&gt;'Export list is to verify if a needed component was missed that needs an IDW and export&lt;/SPAN&gt;
	&lt;SPAN&gt;'If export file is found with the same name, skip save as process of component and or IDW&lt;/SPAN&gt;
	&lt;SPAN&gt;'Due to this rule only finding visible components and their referenced drawings, it will not print or export any assembly files or IDWs&lt;BR /&gt;&lt;/SPAN&gt;        'This rule expects the reference IDWs are in "DRAWINGS" folder in the root workspace folder of the project
	&lt;SPAN&gt;'dschulte 07/31/2022&lt;/SPAN&gt;
	
&lt;SPAN&gt;'Make sure ASM document is active'&lt;/SPAN&gt;
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; &amp;lt;&amp;gt; &lt;SPAN&gt;DocumentTypeEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kAssemblyDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
&lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;"An Assembly Document must be active for this rule to work. Exiting."&lt;/SPAN&gt;, &lt;SPAN&gt;vbCritical&lt;/SPAN&gt;, &lt;SPAN&gt;""&lt;/SPAN&gt;)
&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

&lt;SPAN&gt;'Set export file paths&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oWSPath&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;DesignProjectManager&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDesignProject&lt;/SPAN&gt;.&lt;SPAN&gt;WorkspacePath&lt;/SPAN&gt;
&lt;SPAN&gt;oSTEPFilesFolder&lt;/SPAN&gt; = &lt;SPAN&gt;oWSPath&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\STEP FILES"&lt;/SPAN&gt;
&lt;SPAN&gt;oPDFFilesFolder&lt;/SPAN&gt; = &lt;SPAN&gt;oWSPath&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\PDF FILES"&lt;/SPAN&gt;
&lt;SPAN&gt;oDXFFilesFolder&lt;/SPAN&gt; = &lt;SPAN&gt;oWSPath&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\DXF FILES"&lt;/SPAN&gt;

&lt;SPAN&gt;'Yes or No selection to save as and print&lt;/SPAN&gt;
&lt;SPAN&gt;'If yes, create folder for each export, and prompt to verify printer settings&lt;/SPAN&gt;
&lt;SPAN&gt;'If System Printer Settings are incorrect and select No, will cancel the rule all together&lt;/SPAN&gt;
&lt;SPAN&gt;STP&lt;/SPAN&gt; = &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"Would you like to create a .STP for every visible component?"&lt;/SPAN&gt;, &lt;SPAN&gt;"Create .STP?"&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;MessageBoxDefaultButton&lt;/SPAN&gt;.&lt;SPAN&gt;Button1&lt;/SPAN&gt;)
				&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;STP&lt;/SPAN&gt; = &lt;SPAN&gt;vbNo&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
				&lt;SPAN&gt;oSTP&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;
				&lt;SPAN&gt;Else&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;oSTEPFilesFolder&lt;/SPAN&gt;)
				&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
				
&lt;SPAN&gt;PDF&lt;/SPAN&gt; = &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"Would you like to create a .PDF of each reference drawing?"&lt;/SPAN&gt;, &lt;SPAN&gt;"Create .PDF?"&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;MessageBoxDefaultButton&lt;/SPAN&gt;.&lt;SPAN&gt;Button1&lt;/SPAN&gt;)
				&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;PDF&lt;/SPAN&gt; = &lt;SPAN&gt;vbNo&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
				&lt;SPAN&gt;oPDF&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;
				&lt;SPAN&gt;Else&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;oPDFFilesFolder&lt;/SPAN&gt;)
				&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
				
&lt;SPAN&gt;DXF&lt;/SPAN&gt; = &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"Would you like to create a .DXF of each reference drawing?"&lt;/SPAN&gt;, &lt;SPAN&gt;"Create .DXF?"&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;MessageBoxDefaultButton&lt;/SPAN&gt;.&lt;SPAN&gt;Button1&lt;/SPAN&gt;)
				&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;DXF&lt;/SPAN&gt; = &lt;SPAN&gt;vbNo&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
				&lt;SPAN&gt;oDXFF&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;
				&lt;SPAN&gt;Else&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;oDXFFilesFolder&lt;/SPAN&gt;)
				&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
				
&lt;SPAN&gt;PRINTS&lt;/SPAN&gt; = &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"Would you like to print each IDW?"&lt;/SPAN&gt;, &lt;SPAN&gt;"Create PRINT?"&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;MessageBoxDefaultButton&lt;/SPAN&gt;.&lt;SPAN&gt;Button1&lt;/SPAN&gt;)
				&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;PRINTS&lt;/SPAN&gt; = &lt;SPAN&gt;vbNo&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
				&lt;SPAN&gt;oPRINT&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;
				&lt;SPAN&gt;Else&lt;/SPAN&gt;
				&lt;SPAN&gt;PrintSetup&lt;/SPAN&gt;(&lt;SPAN&gt;Setup&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;oPrintSettings&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
				&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&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;oADoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;

&lt;SPAN&gt;'Loop through visible components and define the save as criteria'&lt;/SPAN&gt;
&lt;SPAN&gt;oOccs&lt;/SPAN&gt; = &lt;SPAN&gt;oADoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;
&lt;SPAN&gt;IterateComponentsRecursively&lt;/SPAN&gt;(&lt;SPAN&gt;oOccs&lt;/SPAN&gt;)

&lt;SPAN&gt;'Show number of found referenced drawings&lt;/SPAN&gt;
&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt; (&lt;SPAN&gt;"There were "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;numFiles&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;" referenced drawings found."&lt;/SPAN&gt;,&lt;SPAN&gt;" Job Complete "&lt;/SPAN&gt;)


&lt;SPAN&gt;'Close any referenced documents'&lt;/SPAN&gt;
&lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;.&lt;SPAN&gt;CloseAll&lt;/SPAN&gt;(&lt;SPAN&gt;True&lt;/SPAN&gt;)

&lt;SPAN&gt;'Open workspace folder'&lt;/SPAN&gt;
&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Launch&lt;/SPAN&gt;(&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;WorkspacePath&lt;/SPAN&gt;)

&lt;SPAN&gt;'Export list of missing IDWs to text'&lt;/SPAN&gt;
&lt;SPAN&gt;WriteListOfStringsToTextFile&lt;/SPAN&gt;(&lt;SPAN&gt;oNames&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;PrintSetup&lt;/SPAN&gt;(&lt;SPAN&gt;Setup&lt;/SPAN&gt;)	
&lt;SPAN&gt;'Show default printer and print settings&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPrintMgr&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PrintManager&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;.&lt;SPAN&gt;PrintManager&lt;/SPAN&gt;
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;"Using Printer "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oPrintMgr&lt;/SPAN&gt;.&lt;SPAN&gt;Printer&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;", Letter Size, 1:1 Scale, Landscape Mode."&lt;/SPAN&gt; _
&amp;amp; &lt;SPAN&gt;vbLf&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;" "&lt;/SPAN&gt; _
&amp;amp; &lt;SPAN&gt;vbLf&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;" Do you want to continue?"&lt;/SPAN&gt; _
, &lt;SPAN&gt;vbYesNo&lt;/SPAN&gt; + &lt;SPAN&gt;vbQuestion&lt;/SPAN&gt;, &lt;SPAN&gt;"System Printer Settings "&lt;/SPAN&gt;) = &lt;SPAN&gt;vbNo&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; 
&lt;SPAN&gt;oPrintSettings&lt;/SPAN&gt; = &lt;SPAN&gt;True&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;oPrintSettings&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
				&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
				&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;	
				
&lt;SPAN&gt;'Determine if the prints should be in color or black and white&lt;/SPAN&gt;
&lt;SPAN&gt;oColorAsBlack&lt;/SPAN&gt;=&lt;SPAN&gt;"False"&lt;/SPAN&gt;
&lt;SPAN&gt;RUsure&lt;/SPAN&gt; = &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt; ( &lt;SPAN&gt;"Do you want to print in COLOR?"&lt;/SPAN&gt;&amp;amp; &lt;SPAN&gt;vbLf&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;""&lt;/SPAN&gt;, &lt;SPAN&gt;"Color or B/W Prints"&lt;/SPAN&gt;,&lt;SPAN&gt;MessageBoxButtons&lt;/SPAN&gt;.&lt;SPAN&gt;YesNo&lt;/SPAN&gt;)
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;RUsure&lt;/SPAN&gt; = &lt;SPAN&gt;vbNo&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
&lt;SPAN&gt;oColorAsBlack&lt;/SPAN&gt;=&lt;SPAN&gt;"True"&lt;/SPAN&gt; : &lt;SPAN&gt;Else&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;'Write list of missing IDWs to text'&lt;/SPAN&gt;
&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;WriteListOfStringsToTextFile&lt;/SPAN&gt;(&lt;SPAN&gt;oStrings&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;List&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;))
	&lt;SPAN&gt;'write List contents (Strings) to a Text file&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oTxtFile&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;"C:\Temp\MISSINGS IDWs.txt"&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oWriter&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;StreamWriter&lt;/SPAN&gt; = &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;File&lt;/SPAN&gt;.&lt;SPAN&gt;CreateText&lt;/SPAN&gt;(&lt;SPAN&gt;oTxtFile&lt;/SPAN&gt;)
	&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oString&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oStrings&lt;/SPAN&gt;
		&lt;SPAN&gt;oWriter&lt;/SPAN&gt;.&lt;SPAN&gt;WriteLine&lt;/SPAN&gt;(&lt;SPAN&gt;oString&lt;/SPAN&gt;)
	&lt;SPAN&gt;Next&lt;/SPAN&gt;
	&lt;SPAN&gt;oWriter&lt;/SPAN&gt;.&lt;SPAN&gt;Close&lt;/SPAN&gt;
	&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Launch&lt;/SPAN&gt;(&lt;SPAN&gt;oTxtFile&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSTEPFilesFolder&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;oDXFFilesFolder&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;oPDFFilesFolder&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;oNames&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;New&lt;/SPAN&gt; &lt;SPAN&gt;List&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;) 	
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oProcessedDocs&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;List&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt;) 
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;numFiles&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Integer&lt;/SPAN&gt; = 0
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSTP&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Boolean&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPDF&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Boolean&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDXFF&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Boolean&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPRINT&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Boolean&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPrintSettings&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Boolean&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt;
		
	&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;IterateComponentsRecursively&lt;/SPAN&gt;(&lt;SPAN&gt;oComps&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrences&lt;/SPAN&gt;)
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;IsNothing&lt;/SPAN&gt;(&lt;SPAN&gt;oComps&lt;/SPAN&gt;) &lt;SPAN&gt;OrElse&lt;/SPAN&gt; &lt;SPAN&gt;oComps&lt;/SPAN&gt;.&lt;SPAN&gt;Count&lt;/SPAN&gt; = 0 &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
	&lt;SPAN&gt;'initialize the List(Of PartDocument) if it has not already been initialized&lt;/SPAN&gt;
	&lt;SPAN&gt;'when initialized (using New), variable's Value will no longer be Nothing, but List will not contain any items yet)&lt;/SPAN&gt;
	&lt;SPAN&gt;'if previously initialized (using New), the List may already contain items, so don't re-create the List&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;IsNothing&lt;/SPAN&gt;(&lt;SPAN&gt;oProcessedDocs&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;oProcessedDocs&lt;/SPAN&gt; = &lt;SPAN&gt;New&lt;/SPAN&gt; &lt;SPAN&gt;List&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt;)
	&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oComp&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oComps&lt;/SPAN&gt;
		&lt;SPAN&gt;'Only process Visible components'&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oComp&lt;/SPAN&gt;.&lt;SPAN&gt;Visible&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;Continue&lt;/SPAN&gt; &lt;SPAN&gt;For&lt;/SPAN&gt;
		&lt;SPAN&gt;'If component is Visible, and an Assembly, recursively process its components'&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oComp&lt;/SPAN&gt;.&lt;SPAN&gt;DefinitionDocumentType&lt;/SPAN&gt; = &lt;SPAN&gt;DocumentTypeEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kAssemblyDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
			&lt;SPAN&gt;IterateComponentsRecursively&lt;/SPAN&gt;(&lt;SPAN&gt;oComp&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;)
		&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
			&lt;SPAN&gt;'Make sure it is a Part'&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oComp&lt;/SPAN&gt;.&lt;SPAN&gt;DefinitionDocumentType&lt;/SPAN&gt; &amp;lt;&amp;gt; &lt;SPAN&gt;DocumentTypeEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kPartDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;Continue&lt;/SPAN&gt; &lt;SPAN&gt;For&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Not&lt;/SPAN&gt; &lt;SPAN&gt;TypeOf&lt;/SPAN&gt; &lt;SPAN&gt;oComp&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt; &lt;SPAN&gt;Is&lt;/SPAN&gt; &lt;SPAN&gt;PartComponentDefinition&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;Continue&lt;/SPAN&gt; &lt;SPAN&gt;For&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN&gt;oComp&lt;/SPAN&gt;.&lt;SPAN&gt;ReferencedDocumentDescriptor&lt;/SPAN&gt;.&lt;SPAN&gt;ReferencedDocument&lt;/SPAN&gt;
		&lt;SPAN&gt;'If we have already processed this referenced document, skip to next component&lt;/SPAN&gt;
		&lt;SPAN&gt;'(this next line will only work properly if you are adding the PartDocument to the List after 'processing' it)&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oProcessedDocs&lt;/SPAN&gt;.&lt;SPAN&gt;Contains&lt;/SPAN&gt;(&lt;SPAN&gt;oPDoc&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;Continue&lt;/SPAN&gt; &lt;SPAN&gt;For&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oFileName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt;.&lt;SPAN&gt;GetFileNameWithoutExtension&lt;/SPAN&gt;(&lt;SPAN&gt;oPDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;)
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oWSPath&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;DesignProjectManager&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDesignProject&lt;/SPAN&gt;.&lt;SPAN&gt;WorkspacePath&lt;/SPAN&gt;
	
		&lt;SPAN&gt;'Find component referenced drawing file&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDrawDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DrawingDocument&lt;/SPAN&gt; = &lt;SPAN&gt;GetDrawing&lt;/SPAN&gt;(&lt;SPAN&gt;oPDoc&lt;/SPAN&gt;)
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Not&lt;/SPAN&gt; &lt;SPAN&gt;IsNothing&lt;/SPAN&gt;(&lt;SPAN&gt;oDrawDoc&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;numFiles&lt;/SPAN&gt; = &lt;SPAN&gt;numFiles&lt;/SPAN&gt; + 1
			
			
			&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSTEPFullFileName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;oSTEPFilesFolder&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oFileName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;".stp"&lt;/SPAN&gt;
			&lt;SPAN&gt;ExportToSTEP&lt;/SPAN&gt;(&lt;SPAN&gt;oPDoc&lt;/SPAN&gt;, &lt;SPAN&gt;oSTEPFullFileName&lt;/SPAN&gt;)
			
			&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oPRINT&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
			&lt;SPAN&gt;PrintIDW&lt;/SPAN&gt;(&lt;SPAN&gt;oDrawDoc&lt;/SPAN&gt;)
			&lt;SPAN&gt;Else&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;oDXFFullFileName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;oDXFFilesFolder&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oFileName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;".dxf"&lt;/SPAN&gt;
			&lt;SPAN&gt;ExportIDWtoDXF&lt;/SPAN&gt;(&lt;SPAN&gt;oDrawDoc&lt;/SPAN&gt;, &lt;SPAN&gt;oDXFFullFileName&lt;/SPAN&gt;)
			
			&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPDFFullFileName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;oPDFFilesFolder&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oFileName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;".pdf"&lt;/SPAN&gt;
			&lt;SPAN&gt;ExportIDWtoPDF&lt;/SPAN&gt;(&lt;SPAN&gt;oDrawDoc&lt;/SPAN&gt;, &lt;SPAN&gt;oPDFFullFileName&lt;/SPAN&gt;)
			&lt;SPAN&gt;oDrawDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Close&lt;/SPAN&gt;(&lt;SPAN&gt;True&lt;/SPAN&gt;)
			
		&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
		&lt;SPAN&gt;'now that this PartDocument has been 'processed', add it to the List(Of PartDocument)&lt;/SPAN&gt;
		&lt;SPAN&gt;'so that it will be found in our check above and will not be processed again&lt;/SPAN&gt;
		&lt;SPAN&gt;oProcessedDocs&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;oPDoc&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;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;PrintIDW&lt;/SPAN&gt;(&lt;SPAN&gt;oDrawing&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DrawingDocument&lt;/SPAN&gt;)
		&lt;SPAN&gt;oDrawing&lt;/SPAN&gt;.&lt;SPAN&gt;Activate&lt;/SPAN&gt;
		&lt;SPAN&gt;oDrawing&lt;/SPAN&gt;.&lt;SPAN&gt;Save&lt;/SPAN&gt;
	    &lt;SPAN&gt;oDrgPrintMgr&lt;/SPAN&gt; = &lt;SPAN&gt;oDrawing&lt;/SPAN&gt;.&lt;SPAN&gt;PrintManager&lt;/SPAN&gt;
	    &lt;SPAN&gt;oDrgPrintMgr&lt;/SPAN&gt;.&lt;SPAN&gt;AllColorsAsBlack&lt;/SPAN&gt; = &lt;SPAN&gt;oColorAsBlack&lt;/SPAN&gt;
	    &lt;SPAN&gt;oPrintMgr&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;.&lt;SPAN&gt;PrintManager&lt;/SPAN&gt;
	    &lt;SPAN&gt;oPrintMgr&lt;/SPAN&gt;.&lt;SPAN&gt;PrintRange&lt;/SPAN&gt; = &lt;SPAN&gt;kPrintAllSheets&lt;/SPAN&gt; &lt;SPAN&gt;'Prints all sheets in the idw.&lt;/SPAN&gt;
	    &lt;SPAN&gt;oPrintMgr&lt;/SPAN&gt;.&lt;SPAN&gt;NumberOfCopies&lt;/SPAN&gt; = 1 &lt;SPAN&gt;' Set to print one copies.&lt;/SPAN&gt;
		&lt;SPAN&gt;oPrintMgr&lt;/SPAN&gt;.&lt;SPAN&gt;PaperSize&lt;/SPAN&gt; = &lt;SPAN&gt;kPaperSizeCustom&lt;/SPAN&gt;
		&lt;SPAN&gt;oPrintMgr&lt;/SPAN&gt;.&lt;SPAN&gt;PaperHeight&lt;/SPAN&gt; = 27.94 &lt;SPAN&gt;'11.0 in&lt;/SPAN&gt;
		&lt;SPAN&gt;oPrintMgr&lt;/SPAN&gt;.&lt;SPAN&gt;PaperWidth&lt;/SPAN&gt; = 21.59 &lt;SPAN&gt;'8.5 in&lt;/SPAN&gt;
	    &lt;SPAN&gt;oPrintMgr&lt;/SPAN&gt;.&lt;SPAN&gt;Scalemode&lt;/SPAN&gt; = 13825 &lt;SPAN&gt;'Full Scale print @1:1&lt;/SPAN&gt;
	    &lt;SPAN&gt;oPrintMgr&lt;/SPAN&gt;.&lt;SPAN&gt;SubmitPrint&lt;/SPAN&gt; &lt;SPAN&gt;' Submit the print.&lt;/SPAN&gt;
	
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt; 
	
&lt;SPAN&gt;'Export to STP sub'&lt;/SPAN&gt;
&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;ExportToSTEP&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt;, &lt;SPAN&gt;oNewFileName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;)

&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oSTP&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; : &lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&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;oSTEP&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TranslatorAddIn&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;"{90AF7F40-0C01-11D5-8E83-0010B541CD80}"&lt;/SPAN&gt;)
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;IsNothing&lt;/SPAN&gt;(&lt;SPAN&gt;oSTEP&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
&lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;"STEP Translator Add-in not found. Exiting."&lt;/SPAN&gt;, &lt;SPAN&gt;vbCritical&lt;/SPAN&gt;, &lt;SPAN&gt;""&lt;/SPAN&gt;)
&lt;SPAN&gt;'Logger.Debug("STEP Translator Add-in not found.")&lt;/SPAN&gt;
&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;



&lt;SPAN&gt;'Create needed variables for translator'&lt;/SPAN&gt;
&lt;SPAN&gt;oTO&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;
&lt;SPAN&gt;oContext&lt;/SPAN&gt; = &lt;SPAN&gt;oTO&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;oTO&lt;/SPAN&gt;.&lt;SPAN&gt;CreateNameValueMap&lt;/SPAN&gt;
&lt;SPAN&gt;oDataMedium&lt;/SPAN&gt; = &lt;SPAN&gt;oTO&lt;/SPAN&gt;.&lt;SPAN&gt;CreateDataMedium&lt;/SPAN&gt;

&lt;SPAN&gt;'Exit sub if file extension exists otherwise continue save as process"&lt;/SPAN&gt;
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;File&lt;/SPAN&gt;.&lt;SPAN&gt;Exists&lt;/SPAN&gt;(&lt;SPAN&gt;oNewFileName&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt; 

&lt;SPAN&gt;oDataMedium&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt; = &lt;SPAN&gt;oNewFileName&lt;/SPAN&gt;
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oSTEP&lt;/SPAN&gt;.&lt;SPAN&gt;HasSaveCopyAsOptions&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&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;' Set application protocol.&lt;/SPAN&gt;
&lt;SPAN&gt;' 2 = AP 203 - Configuration Controlled Design&lt;/SPAN&gt;
&lt;SPAN&gt;' 3 = AP 214 - Automotive Design&lt;/SPAN&gt;
&lt;SPAN&gt;'oOptions.Value("ApplicationProtocolType") = 3&lt;/SPAN&gt;
&lt;SPAN&gt;'oOptions.Value("IncludeSketches") = True&lt;/SPAN&gt;
&lt;SPAN&gt;'oOptions.Value("export_fit_tolerance") = .000393701 'minimum&lt;/SPAN&gt;
&lt;SPAN&gt;'oOptions.Value("Author") = ThisApplication.GeneralOptions.UserName&lt;/SPAN&gt;
&lt;SPAN&gt;'oOptions.Value("Authorization") = ""&lt;/SPAN&gt;
&lt;SPAN&gt;'oOptions.Value("Description") = iProperties.Value("Summary", "Title")&lt;/SPAN&gt;
&lt;SPAN&gt;'oOptions.Value("Organization") = iProperties.Value("Summary", "Company")&lt;/SPAN&gt;
&lt;SPAN&gt;Try&lt;/SPAN&gt;
&lt;SPAN&gt;oSTEP&lt;/SPAN&gt;.&lt;SPAN&gt;SaveCopyAs&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&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;Catch&lt;/SPAN&gt;
&lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;"Your attempt to export this document as a STEP file FAILED!"&lt;/SPAN&gt;, &lt;SPAN&gt;vbExclamation&lt;/SPAN&gt;, &lt;SPAN&gt;"Export to STEP Error"&lt;/SPAN&gt;)
&lt;SPAN&gt;'Logger.Error("Export to STEP failed.")&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;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;

&lt;SPAN&gt;'Find referenced IDW and continue save as process'&lt;/SPAN&gt;
&lt;SPAN&gt;Function&lt;/SPAN&gt; &lt;SPAN&gt;GetDrawing&lt;/SPAN&gt;(&lt;SPAN&gt;oModelDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt;) &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DrawingDocument&lt;/SPAN&gt;
	&lt;SPAN&gt;oWSPath&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;DesignProjectManager&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDesignProject&lt;/SPAN&gt;.&lt;SPAN&gt;WorkspacePath&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDrawingsFolder&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;oWSPath&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\DRAWINGS"&lt;/SPAN&gt;
	&lt;SPAN&gt;oFileName&lt;/SPAN&gt; = &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt;.&lt;SPAN&gt;GetFileNameWithoutExtension&lt;/SPAN&gt;(&lt;SPAN&gt;oModelDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;)
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDrawingFile&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;oDrawingsFolder&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oFileName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;".idw"&lt;/SPAN&gt;
&lt;SPAN&gt;'Reference IDW, needs to open to be able to print'&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;File&lt;/SPAN&gt;.&lt;SPAN&gt;Exists&lt;/SPAN&gt;(&lt;SPAN&gt;oDrawingFile&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDrawingDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DrawingDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;.&lt;SPAN&gt;Open&lt;/SPAN&gt;(&lt;SPAN&gt;oDrawingFile&lt;/SPAN&gt;, &lt;SPAN&gt;True&lt;/SPAN&gt;)
		&lt;SPAN&gt;Return&lt;/SPAN&gt; &lt;SPAN&gt;oDrawingDoc&lt;/SPAN&gt;
	&lt;SPAN&gt;Else&lt;/SPAN&gt;
&lt;SPAN&gt;'Add name of component with no IDW to list'&lt;/SPAN&gt;
	&lt;SPAN&gt;oNames&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;oFileName&lt;/SPAN&gt;)
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
	&lt;SPAN&gt;Return&lt;/SPAN&gt; &lt;SPAN&gt;Nothing&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Function&lt;/SPAN&gt;

&lt;SPAN&gt;'Start IDW to DXF'&lt;/SPAN&gt;
&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;ExportIDWtoDXF&lt;/SPAN&gt;(&lt;SPAN&gt;oDrawing&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DrawingDocument&lt;/SPAN&gt;, &lt;SPAN&gt;oNewFullFileName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;)

&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oDXFF&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; : &lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&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;oDXF&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TranslatorAddIn&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;If&lt;/SPAN&gt; &lt;SPAN&gt;IsNothing&lt;/SPAN&gt;(&lt;SPAN&gt;oDXF&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
&lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;"DXF Translator Add-in not found. Exiting."&lt;/SPAN&gt;, &lt;SPAN&gt;vbCritical&lt;/SPAN&gt;, &lt;SPAN&gt;""&lt;/SPAN&gt;)
&lt;SPAN&gt;'Logger.Debug("DXF Translator Add-in not found.")&lt;/SPAN&gt;
&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

&lt;SPAN&gt;'Create needed variables for translator'&lt;/SPAN&gt;
&lt;SPAN&gt;oTO&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;
&lt;SPAN&gt;oContext&lt;/SPAN&gt; = &lt;SPAN&gt;oTO&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;oTO&lt;/SPAN&gt;.&lt;SPAN&gt;CreateNameValueMap&lt;/SPAN&gt;
&lt;SPAN&gt;oDataMedium&lt;/SPAN&gt; = &lt;SPAN&gt;oTO&lt;/SPAN&gt;.&lt;SPAN&gt;CreateDataMedium&lt;/SPAN&gt;

&lt;SPAN&gt;'Exit sub if file extension exists otherwise continue save as process"&lt;/SPAN&gt;
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;File&lt;/SPAN&gt;.&lt;SPAN&gt;Exists&lt;/SPAN&gt;(&lt;SPAN&gt;oNewFullFileName&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

&lt;SPAN&gt;oDataMedium&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt; = &lt;SPAN&gt;oNewFullFileName&lt;/SPAN&gt;
&lt;SPAN&gt;'&amp;lt;&amp;lt;&amp;lt;&amp;lt; CHANGE THIS IF NEEDED, INI FILE CONFIGURATION LOCATION &amp;gt;&amp;gt;&amp;gt;&amp;gt;'&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oINI_File&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;"C:\Users\Public\Documents\Autodesk\Inventor 2021\Design Data\DWG-DXF\exportdxf.ini"&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;File&lt;/SPAN&gt;.&lt;SPAN&gt;Exists&lt;/SPAN&gt;(&lt;SPAN&gt;oINI_File&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
&lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;"Couldn't find this INI file: "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oINI_File&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;". Exiting."&lt;/SPAN&gt;, &lt;SPAN&gt;vbExclamation&lt;/SPAN&gt;, &lt;SPAN&gt;""&lt;/SPAN&gt;)
&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

&lt;SPAN&gt;'Set save as options'&lt;/SPAN&gt;
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oDXF&lt;/SPAN&gt;.&lt;SPAN&gt;HasSaveCopyAsOptions&lt;/SPAN&gt;(&lt;SPAN&gt;oDrawing&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;oOptions&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"Export_Acad_IniFile"&lt;/SPAN&gt;) = &lt;SPAN&gt;oINI_File&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;Try&lt;/SPAN&gt;
		&lt;SPAN&gt;oDXF&lt;/SPAN&gt;.&lt;SPAN&gt;SaveCopyAs&lt;/SPAN&gt;(&lt;SPAN&gt;oDrawing&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;Catch&lt;/SPAN&gt; &lt;SPAN&gt;oEx&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Exception&lt;/SPAN&gt;
		&lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;"SaveCopyAs method of the ExportIDWtoDXF Sub routine failed."&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;vbCrLf&lt;/SPAN&gt; &amp;amp; _
		&lt;SPAN&gt;"While trying to export the following Drawing file:  "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;vbCrLf&lt;/SPAN&gt; &amp;amp; _
		&lt;SPAN&gt;oDrawing&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;vbCrLf&lt;/SPAN&gt; &amp;amp; _
		&lt;SPAN&gt;"as the following dxf file:  "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;vbCrLf&lt;/SPAN&gt; &amp;amp; _
		&lt;SPAN&gt;oNewFileName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;vbCrLf&lt;/SPAN&gt; &amp;amp; _
		&lt;SPAN&gt;oEx&lt;/SPAN&gt;.&lt;SPAN&gt;Message&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;vbCrLf&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oEx&lt;/SPAN&gt;.&lt;SPAN&gt;StackTrace&lt;/SPAN&gt;, &lt;SPAN&gt;vbExclamation&lt;/SPAN&gt;, &lt;SPAN&gt;""&lt;/SPAN&gt;)
		&lt;SPAN&gt;'Logger.Error(oEx.Message &amp;amp; vbCrLf &amp;amp; oEx.StackTrace)&lt;/SPAN&gt;
		&lt;SPAN&gt;oDrawing&lt;/SPAN&gt;.&lt;SPAN&gt;ReleaseReference&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;'Start IDW to PDF'&lt;/SPAN&gt;
&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;ExportIDWtoPDF&lt;/SPAN&gt;(&lt;SPAN&gt;oDrawing&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DrawingDocument&lt;/SPAN&gt;, &lt;SPAN&gt;oNewFullFileName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;)

&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oPDF&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; : &lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt; : &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
	
	&lt;SPAN&gt;'get the PDF Translator Add-in&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPDFAddin&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TranslatorAddIn&lt;/SPAN&gt;
	&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oAddin&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ApplicationAddIn&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ApplicationAddIns&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oAddin&lt;/SPAN&gt;.&lt;SPAN&gt;DisplayName&lt;/SPAN&gt; = &lt;SPAN&gt;"Translator: PDF"&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
			&lt;SPAN&gt;oPDFAddin&lt;/SPAN&gt; = &lt;SPAN&gt;oAddin&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;'Create the variables needed by the Translator Add-in&lt;/SPAN&gt;
	&lt;SPAN&gt;oTO&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;
	&lt;SPAN&gt;oContext&lt;/SPAN&gt; = &lt;SPAN&gt;oTO&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;oTO&lt;/SPAN&gt;.&lt;SPAN&gt;CreateNameValueMap&lt;/SPAN&gt;
	&lt;SPAN&gt;oDataMedium&lt;/SPAN&gt; = &lt;SPAN&gt;oTO&lt;/SPAN&gt;.&lt;SPAN&gt;CreateDataMedium&lt;/SPAN&gt;
	&lt;SPAN&gt;oDataMedium&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt; = &lt;SPAN&gt;oNewFullFileName&lt;/SPAN&gt;
	
&lt;SPAN&gt;'Exit sub if file extension exists otherwise continue save as process"&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;File&lt;/SPAN&gt;.&lt;SPAN&gt;Exists&lt;/SPAN&gt;(&lt;SPAN&gt;oNewFullFileName&lt;/SPAN&gt;) = &lt;SPAN&gt;True&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
	&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
	&lt;SPAN&gt;oDataMedium&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt; = &lt;SPAN&gt;oNewFullFileName&lt;/SPAN&gt;
	
	&lt;SPAN&gt;'The following If-Then statement defines the Options available, and their Values.&lt;/SPAN&gt;
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oPDFAddin&lt;/SPAN&gt;.&lt;SPAN&gt;HasSaveCopyAsOptions&lt;/SPAN&gt;(&lt;SPAN&gt;oDrawing&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;oOptions&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"Publish_All_Sheets"&lt;/SPAN&gt;) = 1 &lt;SPAN&gt;' 0 = False, 1 = True&lt;/SPAN&gt;
		&lt;SPAN&gt;'oOptions.Value("Sheet_Range") = PrintRangeEnum.kPrintAllSheets&lt;/SPAN&gt;
		&lt;SPAN&gt;'oOptions.Value("Custom_Begin_Sheet") = 1&lt;/SPAN&gt;
		&lt;SPAN&gt;'oOptions.Value("Custom_End_Sheet") = 4&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;' 0 = False, 1 = True&lt;/SPAN&gt;
		&lt;SPAN&gt;oOptions&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"Vector_Resolution"&lt;/SPAN&gt;) = 720 &lt;SPAN&gt;'150, 200, 400, 600, 720, 1200, 2400, 4800 ' DPI&lt;/SPAN&gt;
		&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;' 0 = False, 1 = True&lt;/SPAN&gt;
		&lt;SPAN&gt;oOptions&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"Launch_Viewer"&lt;/SPAN&gt;) = 1 &lt;SPAN&gt;' 0 = False, 1 = True&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

	&lt;SPAN&gt;'Publish PDF&lt;/SPAN&gt;
	&lt;SPAN&gt;oPDFAddin&lt;/SPAN&gt;.&lt;SPAN&gt;SaveCopyAs&lt;/SPAN&gt;(&lt;SPAN&gt;oDrawing&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;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 31 Jul 2022 21:52:15 GMT</pubDate>
    <dc:creator>dschulteHR4D5</dc:creator>
    <dc:date>2022-07-31T21:52:15Z</dc:date>
    <item>
      <title>Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11027867#M39079</link>
      <description>&lt;P&gt;Hello all, I am looking for some assistance with iLogic coding... Let me try to explain what i am looking for here, bear with me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For my workflow, i am designing one-off tooling that trims plastic blow molded parts. We have an in house tool room where we design and build most of the tooling we use. With that being said, we build some of the parts, some times some of them get sent out to other companies to build then we assemble depending on the job.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So i will design an entire project for say a trim station, and the parts we build i will save as an igs for our cnc department to use. Then some of the companies need the files as a stp and the drawings as a dxf.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What i am trying to do essentially is take the entire assembly, and hide the parts i do not want to convert to say an iges. But when i use this code it saves everything in the assembly, and i believe it saves assemblies within the assembly as an iges as well, whereas i want each individual part saved as an iges, not the whole assembly. So it seems i need to add something to recognize only visible items, and to only select parts, not assemblies within the assembly. Is this possible? This is the current code i am using right now.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;'Define the open document&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;openDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt;
&lt;SPAN&gt;openDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;


&lt;SPAN&gt;'path from current file&lt;/SPAN&gt;
&lt;SPAN&gt;oFolder&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;WorkspacePath&lt;/SPAN&gt;() &amp;amp; &lt;SPAN&gt;"\CNC FILES"&lt;/SPAN&gt;

 &lt;SPAN&gt;'Check for the destination 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;'Look at all of the files referenced in the open document&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;docFile&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt;
&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;docFile&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;openDoc&lt;/SPAN&gt;.&lt;SPAN&gt;AllReferencedDocuments&lt;/SPAN&gt;                
&lt;SPAN&gt;'format  file name                   &lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;FNamePos&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Long&lt;/SPAN&gt;
&lt;SPAN&gt;'postion of last back slash&lt;/SPAN&gt;
&lt;SPAN&gt;FNamePos&lt;/SPAN&gt; = &lt;SPAN&gt;InStrRev&lt;/SPAN&gt;(&lt;SPAN&gt;docFile&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;, &lt;SPAN&gt;"\"&lt;/SPAN&gt;, -1)                        
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;docFName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; 
&lt;SPAN&gt;'file name with extension&lt;/SPAN&gt;
&lt;SPAN&gt;docFName&lt;/SPAN&gt; = &lt;SPAN&gt;Right&lt;/SPAN&gt;(&lt;SPAN&gt;docFile&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;, &lt;SPAN&gt;Len&lt;/SPAN&gt;(&lt;SPAN&gt;docFile&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;) - &lt;SPAN&gt;FNamePos&lt;/SPAN&gt;) 
&lt;SPAN&gt;'file name without extension&lt;/SPAN&gt;
&lt;SPAN&gt;shortname&lt;/SPAN&gt; = &lt;SPAN&gt;Left&lt;/SPAN&gt;(&lt;SPAN&gt;docFName&lt;/SPAN&gt;, &lt;SPAN&gt;Len&lt;/SPAN&gt;(&lt;SPAN&gt;docFName&lt;/SPAN&gt;) -4) 

	&lt;SPAN&gt;' Get the IGES translator Add-In.&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oIGESTranslator&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TranslatorAddIn&lt;/SPAN&gt;
	&lt;SPAN&gt;oIGESTranslator&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;"{90AF7F44-0C01-11D5-8E83-0010B541CD80}"&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;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;If&lt;/SPAN&gt; &lt;SPAN&gt;oIGESTranslator&lt;/SPAN&gt;.&lt;SPAN&gt;HasSaveCopyAsOptions&lt;/SPAN&gt;(&lt;SPAN&gt;docFile&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;' Set geometry type for wireframe.&lt;/SPAN&gt;
	   &lt;SPAN&gt;' 0 = Surfaces, 1 = Solids, 2 = Wireframe&lt;/SPAN&gt;
	   &lt;SPAN&gt;'oOptions.Value("GeometryType") = 1&lt;/SPAN&gt;
	   &lt;SPAN&gt;' To set other translator values:&lt;/SPAN&gt;
	   &lt;SPAN&gt;' oOptions.Value("SolidFaceType") = n&lt;/SPAN&gt;
	   &lt;SPAN&gt;' 0 = NURBS, 1 = Analytic&lt;/SPAN&gt;
	   &lt;SPAN&gt;' oOptions.Value("SurfaceType") = n&lt;/SPAN&gt;
	   &lt;SPAN&gt;' 0 = 143(Bounded), 1 = 144(Trimmed)&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;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oData&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DataMedium&lt;/SPAN&gt;
	&lt;SPAN&gt;oData&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;'set file path for IGS file&lt;/SPAN&gt;
	&lt;SPAN&gt;oData&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;shortname&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;".igs"&lt;/SPAN&gt;
	&lt;SPAN&gt;oIGESTranslator&lt;/SPAN&gt;.&lt;SPAN&gt;SaveCopyAs&lt;/SPAN&gt;(&lt;SPAN&gt;docFile&lt;/SPAN&gt;, &lt;SPAN&gt;oContext&lt;/SPAN&gt;, &lt;SPAN&gt;oOptions&lt;/SPAN&gt;, &lt;SPAN&gt;oData&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;/PRE&gt;&lt;P&gt;&amp;nbsp;This code also checks and makes a folder for CNC FILES if there isnt one there, as mentioned, i use this for our CNC department so it works, but it seems like it saves subassemblies as one igs file, and not the individual parts within a subassembly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also i would like to map out how to reference if i translate to an step file, to find a reference drawing of that part and also save the drawing as a dxf if this would be possible.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help!! Ill take anything i can get for knowledge of this, i am pretty new to ilogic but have made this code from cross referencing a number of posts and different codes and eventually got it to work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2022 04:03:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11027867#M39079</guid>
      <dc:creator>dschulteHR4D5</dc:creator>
      <dc:date>2022-03-25T04:03:18Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11028149#M39080</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is nothing in a part where an existing drawing is stored. You can find an existing drawing if, for instance the drawing file is in the same (or another known) folder and the filename is the same as part or something rule based.&lt;/P&gt;&lt;P&gt;If the drawing is in the same folder and file name is the same, then you can try this one:&lt;/P&gt;&lt;P&gt;(It's untested, so there can be some bugs.)&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub main
	
'Define the open document
Dim openDoc As Document
openDoc = ThisDoc.Document


'path from current file
oFolder = ThisDoc.WorkspacePath() &amp;amp; "\CNC FILES"

 'Check for the destination folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
    System.IO.Directory.CreateDirectory(oFolder)
End If

'Look at all of the files referenced in the open document
Dim docFile As Document
For Each docFile In openDoc.AllReferencedDocuments                
	If docFile.DocumentType=DocumentTypeEnum.kPartDocumentObject Then
		'file name without extension
		shortname = System.IO.Path.GetFileNameWithoutExtension(docFile)
		
		ExportIGES(docFile, oFolder, shortname)
		
		ExportSTEP(docFile, oFolder, shortname)
		
		ExportDrawingDXF(docFile, oFolder, shortname)
	End If
Next

End Sub

Private Sub ExportIGES(ByVal oDoc As PartDocument, ByVal sFileName As String, sFolder As String)
	' Get the IGES translator Add-In.
		Dim oIGESTranslator As TranslatorAddIn
		oIGESTranslator = ThisApplication.ApplicationAddIns.ItemById _ 
		("{90AF7F44-0C01-11D5-8E83-0010B541CD80}")
		Dim oContext As TranslationContext
		oContext = ThisApplication.TransientObjects.CreateTranslationContext
		Dim oOptions As NameValueMap
		oOptions = ThisApplication.TransientObjects.CreateNameValueMap
		If oIGESTranslator.HasSaveCopyAsOptions(docFile, oContext, oOptions) Then
		   ' Set geometry type for wireframe.
		   ' 0 = Surfaces, 1 = Solids, 2 = Wireframe
		   'oOptions.Value("GeometryType") = 1
		   ' To set other translator values:
		   ' oOptions.Value("SolidFaceType") = n
		   ' 0 = NURBS, 1 = Analytic
		   ' oOptions.Value("SurfaceType") = n
		   ' 0 = 143(Bounded), 1 = 144(Trimmed)
		oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
		Dim oData As DataMedium
		oData = ThisApplication.TransientObjects.CreateDataMedium
		oData.FileName =  sFolder &amp;amp; "\" &amp;amp; sFileName &amp;amp; ".igs"
		oIGESTranslator.SaveCopyAs(docFile, oContext, oOptions, oData)
		End If
End Sub

Sub ExportSTEP(ByVal oDoc As PartDocument, ByVal sFileName As String, sFolder As String)
	
	Dim oSTEPTranslator As TranslatorAddIn
	oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById( _
	"{90AF7F40-0C01-11D5-8E83-0010B541CD80}")
	Dim oContext As TranslationContext
	oContext = ThisApplication.TransientObjects.CreateTranslationContext
	Dim oOptions As NameValueMap
	oOptions = ThisApplication.TransientObjects.CreateNameValueMap
	If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then
		' Set application protocol.
		' 2 = AP 203 - Configuration Controlled Design
		' 3 = AP 214 - Automotive Design
		oOptions.Value("ApplicationProtocolType") = 3
		' Other options...
		'oOptions.Value("Author") = ""
		'oOptions.Value("Authorization") = ""
		'oOptions.Value("Description") = ""
		'oOptions.Value("Organization") = ""
		oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
		oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

		oDataMedium.FileName =  sFolder &amp;amp; "\" &amp;amp; sFileName &amp;amp; ".stp"
		oSTEPTranslator.SaveCopyAs(docFile, oContext, oOptions, oData)
	End If
End Sub

Sub ExportDrawingDXF(ByVal oDoc As PartDocument,ByVal sFilename As String, ByVal sFolder As String)
	
	Dim sDrawName As String = sFolder &amp;amp; "\" &amp;amp; sFilename 
	Dim oDrawDoc As DrawingDocument
	If System.IO.File.Exists(sDrawName &amp;amp; ".idw") Then
		oDrawDoc = ThisApplication.Documents.Open(sDrawName &amp;amp; ".idw")
	ElseIf System.IO.File.Exists(sDrawName &amp;amp; ".dwg") Then
		oDrawDoc = ThisApplication.Documents.Open(sDrawName &amp;amp; ".dwg")
	Else
		'no drawing found
		Exit Sub
	End If
	
    Dim oDXFTranslator As TranslatorAddIn
    oDXFTranslator = ThisApplication.ApplicationAddIns.ItemById( _
	"{C24E3AC4-122E-11D5-8E91-0010B541CD80}")

    Dim oContext As TranslationContext
    oContext = ThisApplication.TransientObjects.CreateTranslationContext
    oContext.Type = kFileBrowseIOMechanism
    Dim oOptions As NameValueMap
    oOptions = ThisApplication.TransientObjects.CreateNameValueMap
    Dim oDataMedium As DataMedium
    oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
    If oDXFTranslator.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
        Dim strIniFile As String
        strIniFile = "C:\tempDXFOut.ini"
        oOptions.Value("Export_Acad_IniFile") = strIniFile
    End If
    oDataMedium.FileName = sFolder &amp;amp; "\" &amp;amp; sFilename &amp;amp; ".dxf"

    Call oDXFTranslator.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
	
End Sub





&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2022 08:22:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11028149#M39080</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2022-03-25T08:22:00Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11067798#M39081</link>
      <description>&lt;P&gt;Sorry for the late reply, will try this tonight when i get back at work. But yes I normally make the drawings off the part first, print, then save, and then depending on our workflow some go out and some we do in house. So im trying to sort of automate it to where, if i need a STP of the part, i also need a DXF of the print, so if i could do both at once that would be a win. Same thing with the assembly, ill have the whole finished assembly, say 50 different parts, we might make 10 of them, other 10 are purchased, 30 go out to another shop to get finished. So if i could hide everything except those 30, and then just run the rule and be done with it, it would save a tremendous amount of time clicking 5,000 times opening different parts, prints, save as, save as etc etc&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 10:11:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11067798#M39081</guid>
      <dc:creator>dschulteHR4D5</dc:creator>
      <dc:date>2022-03-29T10:11:16Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11068390#M39082</link>
      <description>&lt;P&gt;So...you never need to export all three formats from the same model file, right?&amp;nbsp; And you only want this routine to work on a select set of components (or referenced documents), right?&amp;nbsp; Do you want to use component '&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-E81F1362-07E1-41C0-9152-29377F86C717" target="_blank" rel="noopener"&gt;Visibility&lt;/A&gt;' and '&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-BE5C88B1-5883-4609-985D-9D461560DF8C" target="_blank" rel="noopener"&gt;DesignViewRepresentations&lt;/A&gt;', or do you want to use component Suppression (&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-75CCD20D-728B-4B77-B950-263E297A68EC" target="_blank" rel="noopener"&gt;Link1&lt;/A&gt;, &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-B9F92E01-2E5B-4B4F-81E8-04A10A361C3D" target="_blank" rel="noopener"&gt;Link2&lt;/A&gt;, &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-02D7757C-331E-406F-A1B7-89154E86EF41" target="_blank" rel="noopener"&gt;Link3&lt;/A&gt;) and &lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-03B0662D-3478-4495-A58B-0CD5F834AFB3" target="_blank" rel="noopener"&gt;LevelOfDetailRepresentations&lt;/A&gt; (pre-2022) or ModelStates (2022)?&amp;nbsp; If you will be using component Visible or Suppressd as the main means of identifying which ones to work with, then the code needs to know which formats you want those components that remain visible or un-suppressed to be exported as, if not all 3.&amp;nbsp; Maybe a single question that prompts the user each time the main code starts, asking you which format's to export the visible/un-suppressed components as?&amp;nbsp; If we do something like that, we would then have to change up our loop to looking at components, instead of referenced documents. &amp;nbsp;&amp;nbsp; Or maybe you would want to use an iProperty to identify/differentiate which ones to export one way, or the other?&amp;nbsp; If you do it that way, then we could continue to loop the referenced documents, which would likely be faster, easier, and more efficient.&amp;nbsp; Whichever way you plan on identifying which ones to export in which ways, the main loop in the code would have to change so that if the component (or document) is identified as 'in-house', then it should only get exported as an IGES file, while those that are identified as 'purchased' or 'outsourced' should be exported as STEP file and its drawing as DXF, right?&amp;nbsp; You will likely have to inform us of these details before we can properly fix the code to suit your exact needs.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 13:51:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11068390#M39082</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-03-29T13:51:51Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11069644#M39083</link>
      <description>&lt;P&gt;That is correct, typically i dont need all 3, normally it would be something like, i have all the part models within the assembly, drawings for each part unless its a purchased component. Then normally the iges ones we use in house and the step files are the ones i need to make the drawing also a dxf.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My idea was to look at the master assembly and turn the visibility off to the components i need. I'm still newer to finding my workflow on how i do things, but as of now thats how i have done it is to have the master assembly, hide the things i dont need, then open each one at a time, drawings are already made at this point, and then click, save as, open drawing, save as, close, close, open the next, repeat.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do it that way i guess so as i go through the parts i need i can see which ones i need to do yet, so after i transfer to step/dxf i just hide it and go to the next.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have thought about adding something to the description but havent put too much thought into it yet. I like the idea of a prompt tho, but i could also have two separate rules, the current one i have for IGS specifically to save as IGS, only issue right now is i would like to get the rule to only tag visible components in the assembly and sub assemblies. I think if i could get the IGS rule to do this, then could transfer that to the STP rule, which would be the same thing, only tag visible components, but also find the reference drawing and also save a copy of that to a DXF. I guess initially, i like playing around with the code myself even though alot of the time i am guessing to get it to work, but if for now i could get the original rule to only tag visible parts i would have a good start. Also to be able to identify parts within a sub assembly, like i mentioned i was having issues with it saving a whole subassembly of say 3 parts constrained together as an iges, whereas i needed all 3 of those individually as an iges not the whole thing in one file.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 23:48:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11069644#M39083</guid>
      <dc:creator>dschulteHR4D5</dc:creator>
      <dc:date>2022-03-29T23:48:32Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11071241#M39084</link>
      <description>&lt;P&gt;OK.&amp;nbsp; Well here is an example of an iLogic rule that will loop through all components in every level of the assembly, check if the component is Visible, check if it is a Part, and export those that past those tests to IGES file format.&amp;nbsp; When looping through the components to export, you have to keep track of which source documents you have already processed, so you don't attempt to export the same one multiple times, when there may be multiple components representing that same document throughout the assembly's structure, so I've incorporated a List(Of PartDocument) object variable to help with that part of the task.&amp;nbsp; I have not tested this, because I generally don't have any need to export IGES files, and usually export files to the same location as the original files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main
	If ThisDoc.Document.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kAssemblyDocumentObject Then
		MsgBox("An Assembly Document must be active for this rule to work. Exiting.", vbCritical, "")
		Exit Sub
	End If
	Dim oADoc As AssemblyDocument = ThisDoc.Document
	oOccs = oADoc.ComponentDefinition.Occurrences
	IterateComponentsRecursively(oOccs)
	MsgBox("All Exports Complete.", vbInformation, "")
End Sub

Dim oProcessedDocs As List(Of PartDocument)

Sub IterateComponentsRecursively(oComps As ComponentOccurrences)
	If IsNothing(oComps) Then Exit Sub
	For Each oComp As ComponentOccurrence In oComps
		If oComp.Visible = False Then Continue For
		If oComp.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
			'it is a sub-assembly, so run it back through this same Sub again (recursive processing)
			IterateComponentsRecursively(oComp.Definition.Occurrences)
		End If
		If oComp.DefinitionDocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kPartDocumentObject Then Continue For
		If Not TypeOf oComp.Definition Is PartComponentDefinition Then Continue For
		Dim oPDoc As PartDocument = oComp.ReferencedDocumentDescriptor.ReferencedDocument
		If IsNothing(oProcessedDocs) Then oProcessedDocs = New List(Of PartDocument)
		If oProcessedDocs.Contains(oPDoc) Then Continue For
		oFolder = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath
		oFolder = oFolder &amp;amp; "\CNC FILES"
		If Not System.IO.Directory.Exists(oFolder) Then
			System.IO.Directory.CreateDirectory(oFolder)
		End If
		oFileName = System.IO.Path.GetFileNameWithoutExtension(oPDoc.FullFileName)
		oIGESFullFileName = oFolder &amp;amp; "\" &amp;amp; oFileName &amp;amp; ".igs"
		'run other custom Sub routine here that does main work of rule
		ExportToIGES(oPDoc, oIGESFullFileName)
		'check if it represents an assembly (sub-assembly)
	Next
End Sub

Sub ExportToIGES(oPartDoc As PartDocument, oNewFullFileName As String)
	If IsNothing(oPartDoc) Or oNewFullFileName = "" Then Exit Sub
	Dim oIGES As TranslatorAddIn = ThisApplication.ApplicationAddIns.ItemById( _
	"{90AF7F44-0C01-11D5-8E83-0010B541CD80}")
	If IsNothing(oIGES) Then Exit Sub
	Dim oTO As TransientObjects = ThisApplication.TransientObjects
	oContext = oTO.CreateTranslationContext
	oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
	oOptions = oTO.CreateNameValueMap
	oDataMedium = oTO.CreateDataMedium
	'check to see if the exported file already exists, to avoid overwriting it
	If System.IO.File.Exists(oNewFullFileName) Then
		oAns = MsgBox("An IGES file with this name already exists." &amp;amp; vbCrLf &amp;amp;
		"Do you want to overwrite it with this new one?",vbYesNo + vbQuestion + vbDefaultButton2, "IGES FILE EXISTS")
		If oAnswer = vbNo Then Exit Sub
	End If
	oDataMedium.FileName = oNewFullFileName
	If oIGES.HasSaveCopyAsOptions(oPartDoc, oContext, oOptions) Then
		'oOptions.Value("GeometryType") = 1 '0=Surfaces, 1=Solids, 2=WireFrame
		'oOptions.Value("SolidFaceType") = '0=Nurbs, 1=Analytic
		'oOptions.Value("SurfaceType") =  '0=143(Bounded), 1=144(Trimmed)
		Try
			oIGES.SaveCopyAs(oPartDoc, oContext, oOptions, oDataMedium)
			If IsNothing(oProcessedDocs) Then oProcessedDocs = New List(Of PartDocument)
			oProcessedDocs.Add(oPartDoc)
		Catch oEx As Exception
			MsgBox(oEx.Message &amp;amp; vbCrLf &amp;amp; oEx.StackTrace, vbExclamation, "")
			'Logger.Error(oEx.Message &amp;amp; vbCrLf &amp;amp; oEx.StackTrace)
		End Try
	End If
End Sub&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 14:24:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11071241#M39084</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-03-30T14:24:32Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11115299#M39085</link>
      <description>&lt;P&gt;Hello there again, sorry for the long delay. Have been waiting on my workflow to bring this back to surface, until i needed to use the code... Have been busy with other things as of late. But, i did try this last code you posted and so far so good, the only thing i dont have yet nailed down is the design view representations, i am starting to understand this more as i work with it but basically what i found, the main assembly file i use this code on, the design view has to match each sub assembly within the assembly. So if i hide the things i dont want on the main final assembly, they will export to iges, so each individual sub assembly model tree has to be hidden in order for this to work. And this is completely fine, i usually thumb through the assemblies anyways and verify components for the build list i make for the project.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am still to try out anything to translate to STP and pull a reference drawing and export that as well. Soon i will try that out and comb through that. But so far so good, thank you very much for your help so far. Much appreciated, your code is also really nice and well put together btw.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 22:59:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11115299#M39085</guid>
      <dc:creator>dschulteHR4D5</dc:creator>
      <dc:date>2022-04-19T22:59:01Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11115307#M39086</link>
      <description>&lt;P&gt;Ideally, with this last code you posted, could you make a version of this code but instead of CNC FILES folder, would it be possible to have the one code, to translate to step in the same manner as the iges code to a specified folder, and pull reference drawing of each, translate that print to dxf and put it in a seperate specified folder? They could go in one folder but if possible i would like to keep them seperated when i send them out. Looking back n forth between the first couple codes this last one looks a little different so not sure if theres much change to add these steps to the current code or not. I cant tell if the first code you posted would do this.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 23:05:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11115307#M39086</guid>
      <dc:creator>dschulteHR4D5</dc:creator>
      <dc:date>2022-04-19T23:05:00Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11115333#M39087</link>
      <description>Okay so i did try the first code and came up with this error.&lt;BR /&gt;&lt;BR /&gt;Error in rule: export, in document: 29242 RIVNUT ASM.iam&lt;BR /&gt;&lt;BR /&gt;Unable to cast COM object of type 'System.__ComObject' to class type 'System.String'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.&lt;BR /&gt;&lt;BR /&gt;This is the first code you posted with iges stp and dxf in it. The last one you posted with just the iges works perfectly.</description>
      <pubDate>Tue, 19 Apr 2022 23:19:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11115333#M39087</guid>
      <dc:creator>dschulteHR4D5</dc:creator>
      <dc:date>2022-04-19T23:19:13Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11117037#M39088</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11172607"&gt;@dschulteHR4D5&lt;/a&gt;.&amp;nbsp; I may still not be 100% clear on all the folder location requirements, but I made an attempt to create a similar code to the last one I posted, but this one being for exporting the referenced Part document behind every 'Visible' component out as a STEP file, then attempt to get its Drawing and export that to DXF.&amp;nbsp; I'm not sure if you prefer the TranslatorAddIn route for exporting the DXF's or if you prefer using the DataIO.WriteDataToFile() method, but my example is using the TranslatorAddIn route.&amp;nbsp; The only option you can specify when exporting using the TranslatorAddIn route is the .ini file for it to use, so you may need to change that file location within the code before you try to use it.&amp;nbsp; It is currently pointing to somewhat of a default location for that .ini file.&amp;nbsp; Also, the way it is currently set-up, it is looking for the drawing documents in the same location and same file name as the model file, but with the .idw file extension, so if that is not how you have your drawings set-up, that will not work.&lt;/P&gt;
&lt;P&gt;Here is what I have so far (untested):&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main
	If ThisDoc.Document.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kAssemblyDocumentObject Then
		MsgBox("An Assembly Document must be active for this rule to work. Exiting.", vbCritical, "")
		Exit Sub
	End If
	Dim oADoc As AssemblyDocument = ThisDoc.Document
	
	Dim oWSPath As String = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath
	oSTEPFilesFolder = oWSPath &amp;amp; "\STEP FILES"
	If Not System.IO.Directory.Exists(oSTEPFilesFolder) Then
		System.IO.Directory.CreateDirectory(oSTEPFilesFolder)
	End If
	oDXFFilesFolder = oWSPath &amp;amp; "\DXF FILES"
	If Not System.IO.Directory.Exists(oDXFFilesFolder) Then
		System.IO.Directory.CreateDirectory(oDXFFilesFolder)
	End If
	
	oOccs = oADoc.ComponentDefinition.Occurrences
	IterateComponentsRecursively(oOccs)
	MsgBox("All Exports Complete.", vbInformation, "")
End Sub

Dim oSTEPFilesFolder As String
Dim oDXFFilesFolder As String
Dim oProcessedDocs As List(Of PartDocument)

Sub IterateComponentsRecursively(oComps As ComponentOccurrences)
	If IsNothing(oComps) OrElse oComps.Count = 0 Then Exit Sub
	For Each oComp As ComponentOccurrence In oComps
		'only process Visible components
		If oComp.Visible = False Then Continue For
		'if it is Visible, and an Assembly, recursively process its components
		If oComp.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
			IterateComponentsRecursively(oComp.Definition.Occurrences)
		End If
		'make sure it is a Part
		If oComp.DefinitionDocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kPartDocumentObject Then Continue For
		If Not TypeOf oComp.Definition Is PartComponentDefinition Then Continue For
		Dim oPDoc As PartDocument = oComp.ReferencedDocumentDescriptor.ReferencedDocument
		If IsNothing(oProcessedDocs) Then oProcessedDocs = New List(Of PartDocument)
		'if we have already processed this referenced document, skip to next component
		If oProcessedDocs.Contains(oPDoc) Then Continue For
		Dim oFileName As String = System.IO.Path.GetFileNameWithoutExtension(oPDoc.FullFileName)
		Dim oSTEPFullFileName As String = oSTEPFilesFolder &amp;amp; "\" &amp;amp; oFileName &amp;amp; ".stp"
		'run other custom Sub routine here that does main work of rule
		ExportToSTEP(oPDoc, oSTEPFullFileName)
		Dim oDrawDoc As DrawingDocument = GetDrawing(oPDoc)
		If Not IsNothing(oDrawDoc) Then
			Dim oDXFFullFileName As String = oDXFFilesFolder &amp;amp; "\" &amp;amp; oFileName &amp;amp; ".dxf"
			ExportIDWtoDXF(oDrawDoc, oDXFFullFileName)
		End If
	Next
End Sub

Sub ExportToSTEP(oDoc As Document, oNewFileName As String)
	Dim oSTEP As TranslatorAddIn = ThisApplication.ApplicationAddIns.ItemById( _
	"{90AF7F40-0C01-11D5-8E83-0010B541CD80}")
	If IsNothing(oSTEP) Then
		MsgBox("STEP Translator Add-in not found.  Exiting.", vbCritical, "")
		'Logger.Debug("STEP Translator Add-in not found.")
		Exit Sub
	End If

	'create needed variables for translator
	oTO = ThisApplication.TransientObjects
	oContext = oTO.CreateTranslationContext
	oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
	oOptions = oTO.CreateNameValueMap
	oDataMedium = oTO.CreateDataMedium

	If System.IO.File.Exists(oNewFileName) Then
		oAns = MsgBox("A STEP file with this name already exists." &amp;amp; vbCrLf &amp;amp;
		"Do you want to overwrite it with this new one?",vbYesNo + vbQuestion + vbDefaultButton2, "STEP FILE EXISTS")
		If oAns = vbNo Then Exit Sub
	End If
	oDataMedium.FileName = oNewFileName

	If oSTEP.HasSaveCopyAsOptions(oDoc, oContext, oOptions) Then
		' Set application protocol.
		 ' 2 = AP 203 - Configuration Controlled Design
		 ' 3 = AP 214 - Automotive Design
		 'oOptions.Value("ApplicationProtocolType") = 3
		 'oOptions.Value("IncludeSketches") = True
		 'oOptions.Value("export_fit_tolerance") = .000393701  'minimum
		 'oOptions.Value("Author") = ThisApplication.GeneralOptions.UserName
		 'oOptions.Value("Authorization") = ""
		 'oOptions.Value("Description") = iProperties.Value("Summary", "Title")
		 'oOptions.Value("Organization") = iProperties.Value("Summary", "Company")
		Try
			 oSTEP.SaveCopyAs(oDoc, oContext, oOptions, oDataMedium)
		Catch
			MsgBox("Your attempt to export this document as a STEP file FAILED!", vbExclamation, "Export to STEP Error")
			'Logger.Error("Export to STEP failed.")
		End Try
	End If
End Sub

Function GetDrawing(oModelDoc As Document) As DrawingDocument
	'only works when drawing is in same place and has same file name as model.
	Dim oDrawingFile As String = System.IO.Path.ChangeExtension(oModelDoc.FullFileName, ".idw")
	If System.IO.File.Exists(oDrawingFile) Then
		Dim oDrawingDoc As DrawingDocument = ThisApplication.Documents.Open(oDrawingFile, False)
		Return oDrawingDoc
	End If
	Return Nothing
End Function

Sub ExportIDWtoDXF(oDrawing As DrawingDocument, oNewFullFileName As String)
	Dim oDXF As TranslatorAddIn = ThisApplication.ApplicationAddIns.ItemById( _
	"{C24E3AC4-122E-11D5-8E91-0010B541CD80}")
	If IsNothing(oDXF) Then
		MsgBox("DXF Translator Add-in not found.  Exiting.", vbCritical, "")
		'Logger.Debug("DXF Translator Add-in not found.")
		Exit Sub
	End If
	
	'create needed variables for translator
	oTO = ThisApplication.TransientObjects
	oContext = oTO.CreateTranslationContext
	oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
	oOptions = oTO.CreateNameValueMap
	oDataMedium = oTO.CreateDataMedium
	
	If System.IO.File.Exists(oNewFileName) Then
		oAns = MsgBox("A DXF file with this name already exists." &amp;amp; vbCrLf &amp;amp;
		"Do you want to overwrite it with this new one?", vbYesNo + vbQuestion + vbDefaultButton2, "DXF FILE EXISTS")
		If oAns = vbNo Then Exit Sub
	End If
	oDataMedium.FileName = oNewFileName
	'&amp;lt;&amp;lt;&amp;lt;&amp;lt; CHANGE THIS IF NEEDED &amp;gt;&amp;gt;&amp;gt;&amp;gt;
	Dim oINI_File As String = "C:\Users\Public\Documents\Autodesk\Inventor 2022\Design Data\DWG-DXF\exportdxf.ini"
	If Not System.IO.File.Exists(oINI_File) Then
		MsgBox("Couldn't find this INI file:  " &amp;amp; oINI_File &amp;amp; ".  Exiting.", vbExclamation, "")
		Exit Sub
	End If
	If oDXF.HasSaveCopyAsOptions(oDrawing, oContext, oOptions) Then
		oOptions.Value("Export_Acad_IniFile") = oINI_File
	End If
	Try
		oDXF.SaveCopyAs(oDrawing, oContext, oOptions, oDataMedium)
	Catch oEx As Exception
		MsgBox("SaveCopyAs DXF failed." &amp;amp; vbCrLf &amp;amp; _
		oEx.Message &amp;amp; vbCrLf &amp;amp; oEx.StackTrace, vbExclamation, "")
		'Logger.Error(oEx.Message &amp;amp; vbCrLf &amp;amp; oEx.StackTrace)
	End Try
End Sub&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 15:35:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11117037#M39088</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-04-20T15:35:58Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11117183#M39089</link>
      <description>&lt;P&gt;Looks like I forgot a couple lines of code that might help with clean up after the task is finished.&amp;nbsp; Since this code has to open a bunch of DrawingDocuments, in order to export them to DXF, it is leaving all those open in the background unnecessarily.&amp;nbsp; There are a few things we can do to fix that situation, that I forgot to incorporate into the code.&amp;nbsp; At the end of the ExportIDWtoDXF Sub, we could add a line like the following:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;oDrawing.Close(True) 'True = SkipSave&lt;/LI-CODE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;oDrawing.ReleaseReference&lt;/LI-CODE&gt;
&lt;P&gt;Then, if you use the ReleaseReference route, you can also use the following line of code at the end of the Sub Main code, as part of the clean up.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;ThisApplication.Documents.CloseAll(True)&lt;/LI-CODE&gt;
&lt;P&gt;True here means only close all of the 'unreferenced' documents.&amp;nbsp; When you open documents using the Visible = False setting, then they can be dismissed using the ReleaseReference method, and cleared from memory using the CloseAll(True) method.&amp;nbsp; But if opened visibly, then using the regular Close method is best.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 16:29:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11117183#M39089</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-04-20T16:29:29Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11188768#M39090</link>
      <description>&lt;P&gt;Okay so back at it now, finally have a job we are sending out to try this with properly.. So using this code you posted, i added the couple lines like you mentioned (i think in the right spots) and i get this error&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Autodesk Inventor Professional 2021 5_24_2022 4_05_47 AM.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1071035iFA5B33D907166D76/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Autodesk Inventor Professional 2021 5_24_2022 4_05_47 AM.png" alt="Autodesk Inventor Professional 2021 5_24_2022 4_05_47 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Currently my files are in different folders, Components&lt;FONT face="inherit"&gt;(where the ipt and iam files are), and Drawings(all drawings made go in this folder) are separated for a few reasons, for one to somewhat cleanup the files in the folder, and to also be able to manage subfolders within the drawings, might have a &lt;/FONT&gt;separate&lt;FONT face="inherit"&gt;&amp;nbsp;folder in there for a specific customer, or saved as a different type for a customer that needs it saved as something else.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="inherit"&gt;As far as the documents, it is saving as a STP properly, whatever is hidden isn't saving, so thats good. Just gotta try and get the next part, idw to dxf and i think i would be set.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="inherit"&gt;I did take a couple idw files and save them in the same folder as the IPT but didn't seem to translate over to saving as a dxf.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="inherit"&gt;Thanks again for you help, this code i can see easily saving hours of work over time. Truly appreciate your help with this&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 08:11:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11188768#M39090</guid>
      <dc:creator>dschulteHR4D5</dc:creator>
      <dc:date>2022-05-24T08:11:14Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11188774#M39091</link>
      <description>this is the rule, also i noticed, it seems to be cycling over the parts and saying there is a part already with the same name asking if i want to save new, which there wasn't before, so im wondering if its saving as a stp then somewhere in the code cycling back through that part?&lt;BR /&gt;&lt;BR /&gt;Sub Main&lt;BR /&gt;If ThisDoc.Document.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kAssemblyDocumentObject Then&lt;BR /&gt;MsgBox("An Assembly Document must be active for this rule to work. Exiting.", vbCritical, "")&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;BR /&gt;Dim oADoc As AssemblyDocument = ThisDoc.Document&lt;BR /&gt;&lt;BR /&gt;Dim oWSPath As String = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath&lt;BR /&gt;oSTEPFilesFolder = oWSPath &amp;amp; "\STEP FILES"&lt;BR /&gt;If Not System.IO.Directory.Exists(oSTEPFilesFolder) Then&lt;BR /&gt;System.IO.Directory.CreateDirectory(oSTEPFilesFolder)&lt;BR /&gt;End If&lt;BR /&gt;oDXFFilesFolder = oWSPath &amp;amp; "\DXF FILES"&lt;BR /&gt;If Not System.IO.Directory.Exists(oDXFFilesFolder) Then&lt;BR /&gt;System.IO.Directory.CreateDirectory(oDXFFilesFolder)&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;oOccs = oADoc.ComponentDefinition.Occurrences&lt;BR /&gt;IterateComponentsRecursively(oOccs)&lt;BR /&gt;MsgBox("All Exports Complete.", vbInformation, "")&lt;BR /&gt;ThisApplication.Documents.CloseAll(True)&lt;BR /&gt;End Sub&lt;BR /&gt;&lt;BR /&gt;Dim oSTEPFilesFolder As String&lt;BR /&gt;Dim oDXFFilesFolder As String&lt;BR /&gt;Dim oProcessedDocs As List(Of PartDocument)&lt;BR /&gt;&lt;BR /&gt;Sub IterateComponentsRecursively(oComps As ComponentOccurrences)&lt;BR /&gt;If IsNothing(oComps) OrElse oComps.Count = 0 Then Exit Sub&lt;BR /&gt;For Each oComp As ComponentOccurrence In oComps&lt;BR /&gt;'only process Visible components&lt;BR /&gt;If oComp.Visible = False Then Continue For&lt;BR /&gt;'if it is Visible, and an Assembly, recursively process its components&lt;BR /&gt;If oComp.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then&lt;BR /&gt;IterateComponentsRecursively(oComp.Definition.Occurrences)&lt;BR /&gt;End If&lt;BR /&gt;'make sure it is a Part&lt;BR /&gt;If oComp.DefinitionDocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kPartDocumentObject Then Continue For&lt;BR /&gt;If Not TypeOf oComp.Definition Is PartComponentDefinition Then Continue For&lt;BR /&gt;Dim oPDoc As PartDocument = oComp.ReferencedDocumentDescriptor.ReferencedDocument&lt;BR /&gt;If IsNothing(oProcessedDocs) Then oProcessedDocs = New List(Of PartDocument)&lt;BR /&gt;'if we have already processed this referenced document, skip to next component&lt;BR /&gt;If oProcessedDocs.Contains(oPDoc) Then Continue For&lt;BR /&gt;Dim oFileName As String = System.IO.Path.GetFileNameWithoutExtension(oPDoc.FullFileName)&lt;BR /&gt;Dim oSTEPFullFileName As String = oSTEPFilesFolder &amp;amp; "\" &amp;amp; oFileName &amp;amp; ".stp"&lt;BR /&gt;'run other custom Sub routine here that does main work of rule&lt;BR /&gt;ExportToSTEP(oPDoc, oSTEPFullFileName)&lt;BR /&gt;Dim oDrawDoc As DrawingDocument = GetDrawing(oPDoc)&lt;BR /&gt;If Not IsNothing(oDrawDoc) Then&lt;BR /&gt;Dim oDXFFullFileName As String = oDXFFilesFolder &amp;amp; "\" &amp;amp; oFileName &amp;amp; ".dxf"&lt;BR /&gt;ExportIDWtoDXF(oDrawDoc, oDXFFullFileName)&lt;BR /&gt;End If&lt;BR /&gt;Next&lt;BR /&gt;End Sub&lt;BR /&gt;&lt;BR /&gt;Sub ExportToSTEP(oDoc As Document, oNewFileName As String)&lt;BR /&gt;Dim oSTEP As TranslatorAddIn = ThisApplication.ApplicationAddIns.ItemById( _&lt;BR /&gt;"{90AF7F40-0C01-11D5-8E83-0010B541CD80}")&lt;BR /&gt;If IsNothing(oSTEP) Then&lt;BR /&gt;MsgBox("STEP Translator Add-in not found. Exiting.", vbCritical, "")&lt;BR /&gt;'Logger.Debug("STEP Translator Add-in not found.")&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;'create needed variables for translator&lt;BR /&gt;oTO = ThisApplication.TransientObjects&lt;BR /&gt;oContext = oTO.CreateTranslationContext&lt;BR /&gt;oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism&lt;BR /&gt;oOptions = oTO.CreateNameValueMap&lt;BR /&gt;oDataMedium = oTO.CreateDataMedium&lt;BR /&gt;&lt;BR /&gt;If System.IO.File.Exists(oNewFileName) Then&lt;BR /&gt;oAns = MsgBox("A STEP file with this name already exists." &amp;amp; vbCrLf &amp;amp;&lt;BR /&gt;"Do you want to overwrite it with this new one?",vbYesNo + vbQuestion + vbDefaultButton2, "STEP FILE EXISTS")&lt;BR /&gt;If oAns = vbNo Then Exit Sub&lt;BR /&gt;End If&lt;BR /&gt;oDataMedium.FileName = oNewFileName&lt;BR /&gt;&lt;BR /&gt;If oSTEP.HasSaveCopyAsOptions(oDoc, oContext, oOptions) Then&lt;BR /&gt;' Set application protocol.&lt;BR /&gt;' 2 = AP 203 - Configuration Controlled Design&lt;BR /&gt;' 3 = AP 214 - Automotive Design&lt;BR /&gt;'oOptions.Value("ApplicationProtocolType") = 3&lt;BR /&gt;'oOptions.Value("IncludeSketches") = True&lt;BR /&gt;'oOptions.Value("export_fit_tolerance") = .000393701 'minimum&lt;BR /&gt;'oOptions.Value("Author") = ThisApplication.GeneralOptions.UserName&lt;BR /&gt;'oOptions.Value("Authorization") = ""&lt;BR /&gt;'oOptions.Value("Description") = iProperties.Value("Summary", "Title")&lt;BR /&gt;'oOptions.Value("Organization") = iProperties.Value("Summary", "Company")&lt;BR /&gt;Try&lt;BR /&gt;oSTEP.SaveCopyAs(oDoc, oContext, oOptions, oDataMedium)&lt;BR /&gt;Catch&lt;BR /&gt;MsgBox("Your attempt to export this document as a STEP file FAILED!", vbExclamation, "Export to STEP Error")&lt;BR /&gt;'Logger.Error("Export to STEP failed.")&lt;BR /&gt;End Try&lt;BR /&gt;End If&lt;BR /&gt;End Sub&lt;BR /&gt;&lt;BR /&gt;Function GetDrawing(oModelDoc As Document) As DrawingDocument&lt;BR /&gt;'only works when drawing is in same place and has same file name as model.&lt;BR /&gt;Dim oDrawingFile As String = System.IO.Path.ChangeExtension(oModelDoc.FullFileName, ".idw")&lt;BR /&gt;If System.IO.File.Exists(oDrawingFile) Then&lt;BR /&gt;Dim oDrawingDoc As DrawingDocument = ThisApplication.Documents.Open(oDrawingFile, False)&lt;BR /&gt;Return oDrawingDoc&lt;BR /&gt;End If&lt;BR /&gt;Return Nothing&lt;BR /&gt;End Function&lt;BR /&gt;&lt;BR /&gt;Sub ExportIDWtoDXF(oDrawing As DrawingDocument, oNewFullFileName As String)&lt;BR /&gt;Dim oDXF As TranslatorAddIn = ThisApplication.ApplicationAddIns.ItemById( _&lt;BR /&gt;"{C24E3AC4-122E-11D5-8E91-0010B541CD80}")&lt;BR /&gt;If IsNothing(oDXF) Then&lt;BR /&gt;MsgBox("DXF Translator Add-in not found. Exiting.", vbCritical, "")&lt;BR /&gt;'Logger.Debug("DXF Translator Add-in not found.")&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;'create needed variables for translator&lt;BR /&gt;oTO = ThisApplication.TransientObjects&lt;BR /&gt;oContext = oTO.CreateTranslationContext&lt;BR /&gt;oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism&lt;BR /&gt;oOptions = oTO.CreateNameValueMap&lt;BR /&gt;oDataMedium = oTO.CreateDataMedium&lt;BR /&gt;&lt;BR /&gt;If System.IO.File.Exists(oNewFileName) Then&lt;BR /&gt;oAns = MsgBox("A DXF file with this name already exists." &amp;amp; vbCrLf &amp;amp;&lt;BR /&gt;"Do you want to overwrite it with this new one?", vbYesNo + vbQuestion + vbDefaultButton2, "DXF FILE EXISTS")&lt;BR /&gt;If oAns = vbNo Then Exit Sub&lt;BR /&gt;End If&lt;BR /&gt;oDataMedium.FileName = oNewFileName&lt;BR /&gt;'&amp;lt;&amp;lt;&amp;lt;&amp;lt; CHANGE THIS IF NEEDED &amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;BR /&gt;Dim oINI_File As String = "C:\Users\Public\Documents\Autodesk\Inventor 2021\Design Data\DWG-DXF\exportdxf.ini"&lt;BR /&gt;If Not System.IO.File.Exists(oINI_File) Then&lt;BR /&gt;MsgBox("Couldn't find this INI file: " &amp;amp; oINI_File &amp;amp; ". Exiting.", vbExclamation, "")&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;BR /&gt;If oDXF.HasSaveCopyAsOptions(oDrawing, oContext, oOptions) Then&lt;BR /&gt;oOptions.Value("Export_Acad_IniFile") = oINI_File&lt;BR /&gt;End If&lt;BR /&gt;Try&lt;BR /&gt;oDXF.SaveCopyAs(oDrawing, oContext, oOptions, oDataMedium)&lt;BR /&gt;Catch oEx As Exception&lt;BR /&gt;MsgBox("SaveCopyAs DXF failed." &amp;amp; vbCrLf &amp;amp; _&lt;BR /&gt;oEx.Message &amp;amp; vbCrLf &amp;amp; oEx.StackTrace, vbExclamation, "")&lt;BR /&gt;'Logger.Error(oEx.Message &amp;amp; vbCrLf &amp;amp; oEx.StackTrace)&lt;BR /&gt;oDrawing.ReleaseReference&lt;BR /&gt;End Try&lt;BR /&gt;End Sub</description>
      <pubDate>Tue, 24 May 2022 08:13:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11188774#M39091</guid>
      <dc:creator>dschulteHR4D5</dc:creator>
      <dc:date>2022-05-24T08:13:09Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11189515#M39092</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11172607"&gt;@dschulteHR4D5&lt;/a&gt;.&amp;nbsp; If you normally store your drawing files in a different folder than your model files, then you will need to change the 'GetDrawing' function to reflect that.&amp;nbsp; Currently it is only looking for the drawing in the same folder as the part file, and with the same exact full file name, except for the file extension.&amp;nbsp; You could have it look in both places too, if you wanted.&amp;nbsp; When you change it, you could either just 'hard code' a folder location into it, or you could have it use a shared variable (sort of like how we did with the 'oSTEPFilesFolder ' variable), or you could add another 'input variable' to the Function's definition line for a String that will represent the folder where it should start searching for the drawing file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for the 'ExportIDWtoDXF' Sub routine failing...It seems to be failing right at the end for some reason.&amp;nbsp; Do you have the INI file set-up the way you want it, and is it pointing to the correct file?&amp;nbsp; Are you only encountering that 'save as' error message when trying to save over an existing file with the same name, or is there any other noticeable similarities about the instances that fail that way?&amp;nbsp; Maybe we need to include the full file name it was trying to save as, within the error message, to help us better understand where the error is happening, and on which specific files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may be seeing that message about encountering the same document again, because we are looping through components in an assembly, instead of referenced documents.&amp;nbsp; Because it is possible for multiple components within the structure of an assembly to be referencing the same source model document, that's why I'm using the List(Of PartDocument), to keep track of which documents we have already encountered / worked on.&amp;nbsp; If we were looping through all the referenced documents within the main assembly, we wouldn't need the List or that check in there, but then we couldn't check component visibility/suppression.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 13:29:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11189515#M39092</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-05-24T13:29:58Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11191723#M39093</link>
      <description>&lt;P&gt;Yeah i am trying to look and see where to set the folder, its always in the root workspace folder where the IPJ is, under DRAWINGS, so im going to try and play with that part, not sure what to put in for code to tell it to look in that folder.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And i have had some time to experiment, it asks to save over when there is more than 1 visible with the same name, and only then will it ask to save over.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as the idw to dxf, i have all of the drawings in the same folder as the the part is in, and still get the error. And yeah i copied the link to the ini file i have unless mine is looking somewhere else for it, so for some reason somewhere its not saving as a dxf.. not sure if its the code or file location.&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 08:59:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11191723#M39093</guid>
      <dc:creator>dschulteHR4D5</dc:creator>
      <dc:date>2022-05-25T08:59:28Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11192882#M39094</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11172607"&gt;@dschulteHR4D5&lt;/a&gt;.&amp;nbsp; I'm not sure if this is similar to what you were looking for as the modified version of the 'GetDrawing' function, but this is what I had in mind, based on what you said in your last post.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Function GetDrawing(oModelDoc As Document) As DrawingDocument
	oWSPath = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath
	Dim oDrawingsFolder As String = oWSPath &amp;amp; "\DRAWINGS"
	oFileName = System.IO.Path.GetFileNameWithoutExtension(oModelDoc.FullFileName)
	Dim oDrawingFile As String = oDrawingsFolder &amp;amp; "\" &amp;amp; oFileName &amp;amp; ".idw"
	If System.IO.File.Exists(oDrawingFile) Then
		Dim oDrawingDoc As DrawingDocument = ThisApplication.Documents.Open(oDrawingFile, False)
		Return oDrawingDoc
	Else
'		MsgBox("A Drawing File Named:" &amp;amp; vbCrLf &amp;amp; oDrawingFile &amp;amp; vbCrLf &amp;amp; _
'		"Could not be found.", vbExclamation, "")
	End If
	Return Nothing
End Function&lt;/LI-CODE&gt;
&lt;P&gt;Then, although I'm still not sure what may be going wrong with the '&lt;SPAN&gt;ExportIDWtoDXF&lt;/SPAN&gt;' Sub routine, I modified the Try...Catch block and its feedback message a bit to include a lot more information, including the full file name of the drawing and the full file name of the proposed dxf file it was trying to create.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;	Try
		oDXF.SaveCopyAs(oDrawing, oContext, oOptions, oDataMedium)
	Catch oEx As Exception
		MsgBox("SaveCopyAs method of the ExportIDWtoDXF Sub routine failed." &amp;amp; vbCrLf &amp;amp; _
		"While trying to export the following Drawing file:  " &amp;amp; vbCrLf &amp;amp; _
		oDrawing.FullFileName &amp;amp; vbCrLf &amp;amp; _
		"as the following dxf file:  " &amp;amp; vbCrLf &amp;amp; _
		oNewFileName &amp;amp; vbCrLf &amp;amp; _
		oEx.Message &amp;amp; vbCrLf &amp;amp; oEx.StackTrace, vbExclamation, "")
		'Logger.Error(oEx.Message &amp;amp; vbCrLf &amp;amp; oEx.StackTrace)
		oDrawing.ReleaseReference
	End Try&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 25 May 2022 16:29:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11192882#M39094</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-05-25T16:29:20Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11193638#M39095</link>
      <description>&lt;P&gt;so i made the changes in your last reply, and getting this now.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2022-05-25 192415.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1072072iD0492CF7AAB17CF0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2022-05-25 192415.png" alt="Screenshot 2022-05-25 192415.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; im trying to play around and edit things to get something to work but my experience with ilogic is minimal so im not really getting anywhere, but im trying lol&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i copied a different code, although a bit different, one of your other codes i seen you posted on a different thread, that saves a copy of an idw as dxf, this works just fine when i have an open idw, so i can save a copy as a dxf, so not sure if its having problems referencing the file or the save as settings or what&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 23:29:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11193638#M39095</guid>
      <dc:creator>dschulteHR4D5</dc:creator>
      <dc:date>2022-05-25T23:29:17Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11194603#M39096</link>
      <description>&lt;P&gt;I don't know why I didn't see this sooner.&amp;nbsp; After looking at the contents of that very informational error message, then looking back at my updated code for what was supposed to be in that error message, I noticed that it is &lt;U&gt;not&lt;/U&gt; showing the 'new' full file name that it was trying to save the DXF file to.&amp;nbsp; Then I looked at the variable I had in that position within the error message (oNewFileName).&amp;nbsp; Then I looked back at your previous post which contained the whole code, and attempted to follow that variable up through that Sub routine from that point.&amp;nbsp; I then saw that we were using a slightly different variable name for this within the definition line of that Sub routine as follows:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub ExportIDWtoDXF(oDrawing As DrawingDocument, oNewFullFileName As String)&lt;/LI-CODE&gt;
&lt;P&gt;For some reason, we were using the oNewFileName variable after that point, instead of the oNewFullFileName variable.&amp;nbsp; You either need to use the 'Search and Replace' tool at the top of your iLogic rule editor dialog to search for the oNewFileName variable, and replace it with the oNewFullFileName variable, or the other way around, so that all the references within that Sub routine are using the same variable for this information.&amp;nbsp; This will probably fix the issue.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 11:37:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11194603#M39096</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-05-26T11:37:20Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11194660#M39097</link>
      <description>&lt;P&gt;Dang!! okay so i changed all the oNewFileName to the oNewFullFileName and it worked, actually so far, it works pretty **** perfectly, testing it on a make**** assembly i made up quick.. BUT, for some reason it is saving each DXF into a rar file, for some reason.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 12:12:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11194660#M39097</guid>
      <dc:creator>dschulteHR4D5</dc:creator>
      <dc:date>2022-05-26T12:12:39Z</dc:date>
    </item>
    <item>
      <title>Betreff: Help with saving copy as iges or step of part within assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11194688#M39098</link>
      <description>&lt;P&gt;okay so i messed with the default dxf ini settings, i think it was set to a default state to save it as the rar file, so now it is saving, but i dont have a viewer for the dxf file so im not sure if its proper or not, the files aren't showing the file extension so i gotta look at getting a viewer to make sure its proper, right now im at home messing with ilogic so im not at my default workstation so not sure if it will save different at work based on the ini settings&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 12:23:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-with-saving-copy-as-iges-or-step-of-part-within-assembly/m-p/11194688#M39098</guid>
      <dc:creator>dschulteHR4D5</dc:creator>
      <dc:date>2022-05-26T12:23:10Z</dc:date>
    </item>
  </channel>
</rss>

