<?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: Converting LOTS of STEP files in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5900519#M114422</link>
    <description>&lt;P&gt;Here is the rule for only converting all STEP files from one folder:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Imports System.IO
Imports System.IO.File
Sub Main()
    &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;'You can change this line to match your location if you have all files in one folder&lt;/FONT&gt;&lt;/STRONG&gt;
    oPath = "&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;C:\FolderContainingAllParts&lt;/FONT&gt;&lt;/STRONG&gt;"
    &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;'Or you can use this to select the folder, delete it if not needed&lt;/STRONG&gt;&lt;/FONT&gt;
    &lt;FONT color="#FF0000"&gt;Dim dialog1 = New System.Windows.Forms.FolderBrowserDialog()
    dialog1.SelectedPath = oPath
    dialog1.ShowNewFolderButton = True
    If System.Windows.Forms.DialogResult.OK = dialog1.ShowDialog() Then
        oPath = dialog1.SelectedPath
    Else
        MsgBox("No folder selected. Copiyng canceled.")
        Exit Sub
    End If&lt;/FONT&gt;
    If Not System.IO.Directory.Exists(oPath) Then
        MsgBox("Folder doesn't exist")
	Exit Sub
    End If
    Dim oFile As String
    Dim oNewName As String
    &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;'It will only look for STEP files, as there is "*.stp" at the end.&lt;BR /&gt;    'You may need to use "*.step" instead.&lt;/FONT&gt;&lt;/STRONG&gt;
    For Each oFile In System.IO.Directory.EnumerateFiles(oPath, "&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;*.stp&lt;/FONT&gt;&lt;/STRONG&gt;")
        oInv = ThisApplication.Documents.Open(oFile)
	oNewName = Left(oFile, Len(oFile) - 4) &amp;amp; ".ipt"
        Call oInv.SaveAs(oNewName, True)
        oInv.Close(True)
    Next
End Sub&lt;/PRE&gt;</description>
    <pubDate>Tue, 10 Nov 2015 06:06:32 GMT</pubDate>
    <dc:creator>Owner2229</dc:creator>
    <dc:date>2015-11-10T06:06:32Z</dc:date>
    <item>
      <title>Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5897819#M114417</link>
      <description>&lt;P&gt;I'm using Inventor 2014, and I'm working with a FIRST FRC Robotics team. We'd like to convert the STEP files we get from vendors into Inventor files so we can use them more easily to create the design of our robot. The problem is, there are several thousand parts, so doing it by hand, while possible, would take too much time for the number of students we have.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've written a script that renames the parts files, including the internal references, to match our part numbering system, but now I need to do the actual conversion. The simplest way appears to be to open each part in Inventor, which then creates a .ipt file in the project, and then close the part - rinse repeat. It seems like the perfect job for some kind of scripting or macro language. Inventor uses VBA, which I haven't touched for years, but I'm working on picking it back up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've done a lot of searching, but haven't found anything that works. Can someone please help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Ray&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my test routine. In it, I'm just trying to open a STEP file in Inventor. The part filename comes from the filenames.txt file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sub ProcessDoc()
    ' Open filename file
    Dim File_Path As String
    File_Path = "C:\Users\Ray\Desktop\Unzipped Parts\filenames.txt"
    MsgBox "Trying to open " + File_Path
    Dim fs, f, ts, s
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(File_Path)
    Set ts = f.OpenAsTextStream(1, -2)
    s = ts.ReadLine
    MsgBox s
    Set oInv = ThisApplication.Documents.Open(s)
    ts.Close
End Sub&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2015 18:29:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5897819#M114417</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-07T18:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5898402#M114418</link>
      <description>&lt;P&gt;This is a simple but functional example, useful as a starting point.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sub ProcessDoc()
    Dim File_Path As String
    Dim FileNum As Integer
    Dim Fpath As String

    File_Path = "C:\Users\Ray\Desktop\Unzipped Parts\filenames.txt"
    If Dir(File_Path) &amp;lt;&amp;gt; "" Then
        MsgBox "Trying to open " + File_Path
        
        FileNum = FreeFile()
        Open File_Path For Input As #FileNum
    
        While Not EOF(FileNum)
            Line Input #FileNum, Fpath
            If Dir(Fpath) &amp;lt;&amp;gt; "" Then
                Debug.Print Fpath
                'MsgBox Fpath
                Set oInv = ThisApplication.Documents.Open(Fpath)
                Call oInv.SaveAs(Replace(Fpath, ".stp", ".ipt"), True)
                oInv.Close True
            End If
        Wend
    End If
End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bregs&lt;/P&gt;&lt;P&gt;Rossano Praderi&lt;/P&gt;</description>
      <pubDate>Sun, 08 Nov 2015 20:06:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5898402#M114418</guid>
      <dc:creator>rossano_praderi</dc:creator>
      <dc:date>2015-11-08T20:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5900335#M114419</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the help.&amp;nbsp;I'm still having problems, but I don't know if it's the code or something else. At first, it seemed to work, but had a problem because it was trying to open the first file, which I've been messing with a lot. So I changed the filenames.txt file to point to other, as yet unprocessed files, and now it seems to have a problem opening filenames.txt. I love programming, but don't enjoy moments like this. There's something subtle but simple wrong. I'll find it...&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 00:58:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5900335#M114419</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-10T00:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5900338#M114420</link>
      <description>&lt;P&gt;Problem was with my filenames. I'm almost there ....&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 01:04:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5900338#M114420</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-10T01:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5900505#M114421</link>
      <description>&lt;P&gt;Hi, wouldn't it be better for you to put all the STEP files in one folder and use rule that will find all "*.step" files, convert them and save them with new filename based on your numbering system? Or it can just convert them, if you have already renamed them.&lt;/P&gt;&lt;P&gt;E.g.: You can have one part number in your TXT file and it will be updated after each file conversion, so inicialy u'll have there something like "PN001" and after converting 5 files you will have "PN006".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would be something like this acceptable for you?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 05:21:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5900505#M114421</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2015-11-10T05:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5900519#M114422</link>
      <description>&lt;P&gt;Here is the rule for only converting all STEP files from one folder:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Imports System.IO
Imports System.IO.File
Sub Main()
    &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;'You can change this line to match your location if you have all files in one folder&lt;/FONT&gt;&lt;/STRONG&gt;
    oPath = "&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;C:\FolderContainingAllParts&lt;/FONT&gt;&lt;/STRONG&gt;"
    &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;'Or you can use this to select the folder, delete it if not needed&lt;/STRONG&gt;&lt;/FONT&gt;
    &lt;FONT color="#FF0000"&gt;Dim dialog1 = New System.Windows.Forms.FolderBrowserDialog()
    dialog1.SelectedPath = oPath
    dialog1.ShowNewFolderButton = True
    If System.Windows.Forms.DialogResult.OK = dialog1.ShowDialog() Then
        oPath = dialog1.SelectedPath
    Else
        MsgBox("No folder selected. Copiyng canceled.")
        Exit Sub
    End If&lt;/FONT&gt;
    If Not System.IO.Directory.Exists(oPath) Then
        MsgBox("Folder doesn't exist")
	Exit Sub
    End If
    Dim oFile As String
    Dim oNewName As String
    &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;'It will only look for STEP files, as there is "*.stp" at the end.&lt;BR /&gt;    'You may need to use "*.step" instead.&lt;/FONT&gt;&lt;/STRONG&gt;
    For Each oFile In System.IO.Directory.EnumerateFiles(oPath, "&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;*.stp&lt;/FONT&gt;&lt;/STRONG&gt;")
        oInv = ThisApplication.Documents.Open(oFile)
	oNewName = Left(oFile, Len(oFile) - 4) &amp;amp; ".ipt"
        Call oInv.SaveAs(oNewName, True)
        oInv.Close(True)
    Next
End Sub&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Nov 2015 06:06:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5900519#M114422</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2015-11-10T06:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5902173#M114423</link>
      <description>&lt;P&gt;The code opens &amp;nbsp;the STEP file and reads it in, but the save as doesn't work. I get an error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Exchange Export: problems encountered while executing this command.&lt;/P&gt;&lt;P&gt;Failed to create folder, ""&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thought maybe using the Dir command with the full filename was the problem, so I stripped off the filename. No change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's current code:&lt;/P&gt;&lt;PRE&gt;    Public Sub Main()
        ' Process STEP files
        ProcessDoc
    End Sub
    
Sub ProcessDoc()
    Dim File_Path As String
    Dim FileNum As Integer
    Dim Fpath As String
    Dim Folder As String

    File_Path = "C:\Users\Ray\Desktop\Unzipped Parts\filenames.txt"
    If Dir(File_Path) &amp;lt;&amp;gt; "" Then
        MsgBox "Trying to open " + File_Path
        
        FileNum = FreeFile()
        Open File_Path For Input As #FileNum
    
        While Not EOF(FileNum)
            Line Input #FileNum, Fpath
            Folder = FolderFromPath(Fpath)
            If Dir(Folder) &amp;lt;&amp;gt; "" Then
                Debug.Print Fpath
                'MsgBox Fpath
                Set oInv = ThisApplication.Documents.Open(Fpath)
                Call oInv.SaveAs(Replace(Fpath, ".stp", ".ipt"), True)
                oInv.Close True
            Else
                MsgBox "Error: " + Fpath + " appears to be incorrect."
            End If
        Wend
        MsgBox "End of File"
    End If
End Sub
Public Function FolderFromPath(strFullPath As String) As String
    FolderFromPath = Left(strFullPath, InStrRev(strFullPath, "\"))
End Function&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Nov 2015 22:14:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5902173#M114423</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-10T22:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5902224#M114424</link>
      <description>Have you tried using the Inventor task scheduler to do the translation? you could run a sequential task, one to run the rename command, then a second to translate the contents of a folder from step to Inventor.</description>
      <pubDate>Tue, 10 Nov 2015 23:06:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5902224#M114424</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-10T23:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5903839#M114425</link>
      <description>&lt;P&gt;There no error in my original code, I've tested before post it.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The following can be a variation of the code, that is not necessary but if you would like to try....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;If Dir(Folder, vbDirectory) then ....&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An other possible issue are the spaces in the path of each file, sometimes you get back a wrong response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bregs&lt;/P&gt;&lt;P&gt;Rossano Praderi&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 21:16:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5903839#M114425</guid>
      <dc:creator>rossano_praderi</dc:creator>
      <dc:date>2015-11-11T21:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5908378#M114426</link>
      <description>&lt;P&gt;I don't know what I'm doing wrong. I tried the latest suggested code and I'm still getting an error: Run-time error '-2147467259 (80004005)': Method 'SaveAs' of object 'AssemblyDocument' failed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are some sub directories. Could these be causing the problem?&lt;/P&gt;</description>
      <pubDate>Sat, 14 Nov 2015 18:50:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5908378#M114426</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-14T18:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5909007#M114427</link>
      <description>&lt;P&gt;Hi Benjamin,&lt;BR /&gt;you have this problem because some "STEPs" are opened as assembly.&lt;/P&gt;&lt;P&gt;I think you can have only two possible solutions:&lt;BR /&gt;- you should adapt your code to suite the "STEP" traslation "ADDIN" needs&lt;/P&gt;&lt;P&gt;- by using the "Inventor Scheduler" (as suggested by Donovan) to convert your files&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is much more easier to use the scheduler, give it a try.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bregs&lt;/P&gt;&lt;P&gt;Rossano Praderi&lt;/P&gt;</description>
      <pubDate>Sun, 15 Nov 2015 22:06:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5909007#M114427</guid>
      <dc:creator>rossano_praderi</dc:creator>
      <dc:date>2015-11-15T22:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5914239#M114428</link>
      <description>&lt;P&gt;Bregs,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error I'm still getting with your code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Exchange Export: problems encountered while executing this command.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Failed to create folder, ""&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll try moving everything to a directory path that doesn't have spaces. I'll let you know how it goes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;----&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting errors on your &lt;STRONG&gt;Imports&lt;/STRONG&gt; statements and the &lt;STRONG&gt;Dim dialog1&lt;/STRONG&gt; statement. Not sure what's going on there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ray&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 17:52:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5914239#M114428</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-18T17:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5914425#M114429</link>
      <description>&lt;P&gt;I think I know what the problem is, but not how to fix it. The first problem was that my files had the extension .STEP, which I needed to fix in the Replace statement. The second problem is that some of my "parts" are actually assemblies, so they need to be saved as .IAM rather than .IPT files. Do any of you know how to detect if it's an assembly or a part so I know which way to save it in the code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Ray&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 19:42:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5914425#M114429</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-18T19:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5915032#M114430</link>
      <description>&lt;P&gt;Hi, try the code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;oDoc = ThisApplication.ActiveDocument
If oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
    MsgBox("This is assemby.")
Else If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
    MsgBox("This is part.")
End If&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Nov 2015 05:58:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5915032#M114430</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2015-11-19T05:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5915081#M114431</link>
      <description>&lt;P&gt;Hi Ray,&lt;/P&gt;&lt;P&gt;next days I'll give you a more complete code&amp;nbsp;to solve this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bregs&lt;/P&gt;&lt;P&gt;Rossano Praderi&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2015 07:03:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5915081#M114431</guid>
      <dc:creator>rossano_praderi</dc:creator>
      <dc:date>2015-11-19T07:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5916180#M114432</link>
      <description>&lt;P&gt;That's what I'm leaning toward now. I can always set up sub-directories later if needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm really close. The last problem I have is determining if it's a part file or an assembly file and saving it with the correct extension. The script now seems to work on regular part files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate all the help I've gotten from everyone here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ray&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2015 17:06:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5916180#M114432</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-19T17:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5916244#M114433</link>
      <description>&lt;P&gt;Here's the code right now. The problem is that the STEP file is seen as an uknown document. I can't save it as a part file if it's an assembly file, or vice versa, so I need some way to detect which type of file it is. I'm open to any suggestions. I'm so close I can taste it. I hope this is the last obstacle to getting this script working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    Public Sub Main()
        ' Process STEP files
        ProcessDoc
    End Sub


Sub ProcessDoc()
    Dim File_Path As String
    Dim FileNum As Integer
    Dim Fpath As String
    Dim Folder As String

    File_Path = "C:\Users\Ray\Desktop\Unzipped\filenames.txt"
    If Dir(File_Path) &amp;lt;&amp;gt; "" Then
        MsgBox "Trying to open " + File_Path
        
        FileNum = FreeFile()
        Open File_Path For Input As #FileNum
    
        Do While Not EOF(FileNum)
            Line Input #FileNum, Fpath
            Folder = FolderFromPath(Fpath)
            If Dir(Folder) &amp;lt;&amp;gt; "" Then
                Debug.Print Fpath
                'MsgBox Fpath
                Set oInv = ThisApplication.Documents.Open(Fpath)
                Dim docType As DocumentTypeEnum
                Dim ext As String
                Select Case docType
                    Case kAssemblyDocumentObject
                        ext = ".iam"
                    Case kPartDocumentObject
                        ext = ".ipt"
                    Case kDesignElementDocumentObject
                        ext = "???"
                        MsgBox "Error: " + Fpath + " is a Design Element Object."
                        Exit Do
                    Case kDrawingDocumentObject
                        MsgBox "Error: " + Fpath + " is a Drawing Element Object."
                        Exit Do
                    Case kForeignModelDocumentObject
                        MsgBox "Error: " + Fpath + " is a Foreign Model Object."
                        Exit Do
                    Case kNoDocument
                        MsgBox "Error: " + Fpath + " is a Not recognizable as a document."
                        Exit Do
                    Case kPresentationDocumentObject
                        MsgBox "Error: " + Fpath + " is a Presentation document."
                        Exit Do
                    Case kSATFileDocumentObject
                        MsgBox "Error: " + Fpath + " is a SAT File document."
                        Exit Do
                    Case kUnknownDocumentObject
                        MsgBox "Error: " + Fpath + " is an Unknown Document Object."
                        Exit Do
                    Case Else
                        MsgBox "Error: " + Fpath + " is unknown doctype."
                        Exit Do
                End Select
                Call oInv.SaveAs(Replace(Fpath, ".STEP", ext), True)
                oInv.Close True
            Else
                MsgBox "Error: " + Fpath + " appears to be incorrect."
            End If
        Loop
        MsgBox "End of File"
    End If
End Sub
Public Function FolderFromPath(strFullPath As String) As String
    FolderFromPath = Left(strFullPath, InStrRev(strFullPath, "\"))
End Function

&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Nov 2015 17:35:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5916244#M114433</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-19T17:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Converting LOTS of STEP files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5916915#M114434</link>
      <description>&lt;P&gt;Hi Ray,&lt;/P&gt;&lt;P&gt;this is the next step...&lt;BR /&gt;Check the folder name which will contain all files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;....
                Select Case &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;oinv.DocumentType&lt;/STRONG&gt;&lt;/FONT&gt;
                    Case kAssemblyDocumentObject
                        &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Set oDoc = ThisApplication.ActiveDocument
                        oDoc.FullFileName = Replace(Fpath, ".stp", ".iam")
                        oPath = Left(oDoc.FullFileName, InStrRev(oDoc.FullFileName, "\", -1))
                        For Each oref In oDoc.AllReferencedDocuments
                            oref.FullFileName = oPath &amp;amp; Right(oref.FullFileName, Len(oref.FullFileName) - InStrRev(oref.FullFileName, "\", -1))
                        Next
                        oDoc.Save2 True ' if the assembly or any other file exist you will be prompted to save it
                        oDoc.Close True&lt;/FONT&gt;&lt;/STRONG&gt;
                    Case kPartDocumentObject
                        &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Call oinv.SaveAs(Replace(Fpath, ".stp", ".ipt"), True)&lt;/FONT&gt;&lt;/STRONG&gt;
....
....
                End Select
                oinv.Close True
....&lt;/PRE&gt;&lt;P&gt;Bregs&lt;/P&gt;&lt;P&gt;Rossano Praderi&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2015 00:07:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/converting-lots-of-step-files/m-p/5916915#M114434</guid>
      <dc:creator>rossano_praderi</dc:creator>
      <dc:date>2015-11-20T00:07:39Z</dc:date>
    </item>
  </channel>
</rss>

