<?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 Betreff: API STL Translator on an Assembly File in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10843739#M41970</link>
    <description>&lt;P&gt;Is there no way to transpose coordinate systems in every file relative to the assembly origin?&amp;nbsp;Maybe that's what will solve this.&amp;nbsp;I had a need to do this too, but quit trying b/c it's WAY over my paygrade and I have better things to do than fiddle around w/the one-time thing. Anyway, that's what I would've tried to do to get this solved, that is, IF I knew what I was doing.&lt;/P&gt;</description>
    <pubDate>Sun, 26 Dec 2021 21:07:27 GMT</pubDate>
    <dc:creator>cadman777</dc:creator>
    <dc:date>2021-12-26T21:07:27Z</dc:date>
    <item>
      <title>API STL Translator on an Assembly File</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10841225#M41964</link>
      <description>&lt;P&gt;When exporting an Assembly file within Inventor it can produce a STL for each occurrence (filename suffixed as per the DisplayName) with its Origin in the Master Assembly preserved (such that re-importing it all the parts are correctly positioned) when the 'One File per Part Instance' option is selected. Using the Translator via the API on a part file is fine but I cannot seem to get the Translator to replicate the behaviour when running the 'One File per Part Instance' command on an assembly using the API. As there is an option for this in the API translator I thought it might do this when it was enabled and offered an assembly but I cant get it work and how would it deal with the filenames?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I recursively traverse the the assembly and all sub assemblies and export them individually the Origin position of each part within the assembly is lost.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There's lots of API information on using the STL Translator on Parts but I can find no examples on an IAM file - can anyone please point me in the right direction or provide a code snippet ?&lt;/P&gt;&lt;LI-CODE lang="general"&gt;        Dim oDoc As Document = oInv.ActiveDocument
        Dim oContext As TranslationContext = oInv.TransientObjects.CreateTranslationContext
        Dim oOptions As NameValueMap = oInv.TransientObjects.CreateNameValueMap

        '    Save Copy As Options:
        '       Name Value Map:
        '               ExportUnits = 4 , 5 = Millimeter
        '               Resolution = 1
        '               AllowMoveMeshNode = False
        '               SurfaceDeviation = 60
        '               NormalDeviation = 14
        '               MaxEdgeLength = 100
        '               AspectRatio = 40
        '               ExportFileStructure = 0
        '               OutputFileType = 0
        '               ExportColor = True

        If oSTLTranslator.HasSaveCopyAsOptions(oDoc, oContext, oOptions) Then
            oOptions.Value("Resolution") = ComboSTLRes.SelectedIndex  ' Set accuracy.0 = High,  1 = Medium,  2 = Low
            oOptions.Value("OutputFileType") = 0 ' Set output file type:0 - binary,  1 - ASCII 
            oOptions.Value("ExportFileStructure") = ComboSTLStructure.SelectedIndex 'One part or multi ?

            oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
            Dim oData As DataMedium = oInv.TransientObjects.CreateDataMedium
            oData.FileName = STLPath &amp;amp; "\" &amp;amp; STLFileName &amp;amp; ".STL"

            Call oSTLTranslator.SaveCopyAs(oDoc, oContext, oOptions, oData)

            SBar1.Text = "Exported " &amp;amp; oData.FileName

            oDoc.Close(True)

        End If&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Dec 2021 11:26:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10841225#M41964</guid>
      <dc:creator>SteveLainson6531</dc:creator>
      <dc:date>2021-12-24T11:26:38Z</dc:date>
    </item>
    <item>
      <title>Betreff: API STL Translator on an Assembly File</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10841295#M41965</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You don't have to care of the file naming. The names are generated by the Addin.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've edited your code to make it able to run stand alone. The rule creates a STL file for the assembly and one for each part instance with respect to the main assembly origin. All Subassemblies are skipped. I can not see a different behaviour to the GUI version. &lt;span class="lia-unicode-emoji" title=":pensive_face:"&gt;😔&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oInv As Inventor.Application = ThisApplication
Dim strCLSID As String = "{81CA7D27-2DBE-4058-8188-9136F85FC859}"
Dim STLPath As String = ThisDoc.Path 
Dim STLFileName As String = ThisDoc.FileName(False)
Dim oAddIns As ApplicationAddIns = ThisApplication.ApplicationAddIns
Dim oSTLTranslator As TranslatorAddIn = oAddIns.ItemById(strCLSID)
oSTLTranslator.Activate

Dim oDoc As Document = oInv.ActiveDocument
Dim oContext As TranslationContext = oInv.TransientObjects.CreateTranslationContext
Dim oOptions As NameValueMap = oInv.TransientObjects.CreateNameValueMap

'    Save Copy As Options:
'       Name Value Map:
'               ExportUnits = 4 , 5 = Millimeter
'               Resolution = 1
'               AllowMoveMeshNode = False
'               SurfaceDeviation = 60
'               NormalDeviation = 14
'               MaxEdgeLength = 100
'               AspectRatio = 40
'               ExportFileStructure = 0
'               OutputFileType = 0
'               ExportColor = True

If oSTLTranslator.HasSaveCopyAsOptions(oDoc, oContext, oOptions) Then
    oOptions.Value("Resolution") = 0 'ComboSTLRes.SelectedIndex  ' Set accuracy.0 = High,  1 = Medium,  2 = Low
    oOptions.Value("OutputFileType") = 0 ' Set output file type:0 - binary,  1 - ASCII 
    oOptions.Value("ExportFileStructure") = 1 'ComboSTLStructure.SelectedIndex 'One part or multi ?

    oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
    Dim oData As DataMedium = oInv.TransientObjects.CreateDataMedium
    oData.FileName = STLPath &amp;amp; "\" &amp;amp; STLFileName &amp;amp; ".STL"

    Call oSTLTranslator.SaveCopyAs(oDoc, oContext, oOptions, oData)

    'SBar1.Text = "Exported " &amp;amp; oData.FileName

    'oDoc.Close(True)

End If&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Dec 2021 12:47:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10841295#M41965</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2021-12-24T12:47:55Z</dc:date>
    </item>
    <item>
      <title>Betreff: API STL Translator on an Assembly File</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10841624#M41966</link>
      <description>&lt;P&gt;Many thanks for replying &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564136"&gt;@Ralf_Krieg&lt;/a&gt;&amp;nbsp;but I'm still having the same problem. The code will:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Produce a single part STL from an IPT when oOptions.Value("ExportFileStructure") =0&lt;/P&gt;&lt;P&gt;2) Create a single part STL from an IAM when oOptions.Value("ExportFileStructure") =0&lt;/P&gt;&lt;P&gt;3) Create a single part STL from an IPT when oOptions.Value("ExportFileStructure") =1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it will not create multiple STLs from an IAM when&amp;nbsp;oOptions.Value("ExportFileStructure") =1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I dont pass anything in oData.FileName&amp;nbsp; (for example "C:\Temp\TEST.STL")&amp;nbsp; it throws an exception at the line Call oSTLTranslator.SaveCopyAs(oDoc, oContext, oOptions, oData) so it seems it needs something here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cant find any reference material on the STL Translator in the API documentation either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thoughts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;    Private Sub MakeSTL()
        oInv = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")

        Dim oFileManager As FileManager = oInv.FileManager ' Set a reference to the FileManager object.
        Dim strFullDocumentName As String = oFileManager.GetFullDocumentName("C:\Temp\Test.iam", "Test LoD") ' Use the full file name and LOD name
        Dim oDocOpenOptions As NameValueMap = oInv.TransientObjects.CreateNameValueMap ' Create a new NameValueMap object

        IVDoc = oInv.Documents.OpenWithOptions(strFullDocumentName, oDocOpenOptions) 'Open the document in a LoD state

        Dim strCLSID As String = "{81CA7D27-2DBE-4058-8188-9136F85FC859}" 'This seems to be a different GUID
        Dim oAddIns As ApplicationAddIns = oInv.ApplicationAddIns
        Dim oSTLTranslator As TranslatorAddIn = oAddIns.ItemById(strCLSID)

        oSTLTranslator.Activate()

        Dim oDoc As Document = oInv.ActiveDocument

        Dim STLPath As String = IO.Path.GetDirectoryName(oDoc.FullFileName) &amp;amp; "\STLs\" &amp;amp; IO.Path.GetFileNameWithoutExtension(oDoc.FullFileName)
        If Not IO.Directory.Exists(STLPath) Then IO.Directory.CreateDirectory(STLPath)
        Dim STLFileName As String = IO.Path.GetFileNameWithoutExtension(oDoc.FullFileName) &amp;amp; ".STL"
        Dim STLFullFileName As String = STLPath &amp;amp; "\" &amp;amp; STLFileName

        Dim oContext As TranslationContext = oInv.TransientObjects.CreateTranslationContext
        Dim oOptions As NameValueMap = oInv.TransientObjects.CreateNameValueMap

        If oSTLTranslator.HasSaveCopyAsOptions(oDoc, oContext, oOptions) Then
            oOptions.Value("Resolution") = 2 
            oOptions.Value("OutputFileType") = 0 
            oOptions.Value("ExportFileStructure") = 1 

            oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
            Dim oData As DataMedium = oInv.TransientObjects.CreateDataMedium
            oData.FileName = STLFullFileName

            Call oSTLTranslator.SaveCopyAs(oDoc, oContext, oOptions, oData)

            oDoc.Close(True)

        End If

    End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Dec 2021 18:45:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10841624#M41966</guid>
      <dc:creator>SteveLainson6531</dc:creator>
      <dc:date>2021-12-24T18:45:05Z</dc:date>
    </item>
    <item>
      <title>Betreff: API STL Translator on an Assembly File</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10842325#M41967</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you try without closing the source document at end?&lt;/P&gt;</description>
      <pubDate>Sat, 25 Dec 2021 12:03:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10842325#M41967</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2021-12-25T12:03:55Z</dc:date>
    </item>
    <item>
      <title>Betreff: API STL Translator on an Assembly File</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10843243#M41968</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564136"&gt;@Ralf_Krieg&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately even if dont close the ActiveDocument I still get same the result. Single Part STLs from either a selected IPT or an IAM are created fine, but nothing is created when I ask for a multipart STL from an IAM.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder if it implemented at all? Its a pity there doesn't seem to be any documentation in the API Reference Manual for the STL Translator.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SteveLainson6531_0-1640515331529.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1004940i1D714D2A054BF8EA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SteveLainson6531_0-1640515331529.png" alt="SteveLainson6531_0-1640515331529.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Dec 2021 10:43:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10843243#M41968</guid>
      <dc:creator>SteveLainson6531</dc:creator>
      <dc:date>2021-12-26T10:43:57Z</dc:date>
    </item>
    <item>
      <title>Betreff: API STL Translator on an Assembly File</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10843408#M41969</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;There's not much further documentation needed. The translator Addins are all mostly identic. Reading your code, you are running a standalone exe right?You grep a running Inventor instance in your first line. Are you running two or more Inventor instances in parallel while trying? Is there a Try-Catch or On Error resume next statement somewhere in the code around, that prevents displaying error messages and just silently abort? Are you using a program like VisualStudio for developing? Have you tried to step line by line through your code in debugging mode and checked that all variables hold the value you expected they do?&lt;/P&gt;&lt;P&gt;Have you tried my code in an iLogic rule, just to see if it's work that way? What version of Inventor are you using? ServicePack level?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Dec 2021 14:28:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10843408#M41969</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2021-12-26T14:28:48Z</dc:date>
    </item>
    <item>
      <title>Betreff: API STL Translator on an Assembly File</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10843739#M41970</link>
      <description>&lt;P&gt;Is there no way to transpose coordinate systems in every file relative to the assembly origin?&amp;nbsp;Maybe that's what will solve this.&amp;nbsp;I had a need to do this too, but quit trying b/c it's WAY over my paygrade and I have better things to do than fiddle around w/the one-time thing. Anyway, that's what I would've tried to do to get this solved, that is, IF I knew what I was doing.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Dec 2021 21:07:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10843739#M41970</guid>
      <dc:creator>cadman777</dc:creator>
      <dc:date>2021-12-26T21:07:27Z</dc:date>
    </item>
    <item>
      <title>Betreff: API STL Translator on an Assembly File</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10844452#M41971</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;None of my questions answered. How do you expect to get help???&lt;/P&gt;&lt;P&gt;The example version I gave you runs fine in Inventor 2021 and 2022 with latest updates installed. If it's not working with your data, we would need a demo assembly trying to reproduce.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you only need the position, create a ComponentOccurrenceProxy of tha part in assembly context. This will give you the origin coordinates of the part occurrence in assembly context. This will not givw you any information about rotation angles of the part occurrence in assembly space. And take a look at the TranformationMatrix object of the component occurrence. This can give you further information about part position.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 10:05:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10844452#M41971</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2021-12-27T10:05:38Z</dc:date>
    </item>
    <item>
      <title>Betreff: API STL Translator on an Assembly File</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10856699#M41972</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564136"&gt;@Ralf_Krieg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks - sorry I got hit by THE bug and have been laid up ill for a few days, not 100% but I'm back at my PC now.&lt;/P&gt;&lt;P&gt;Yes, I'm using Visual Studio and writing a standalone VB Net application calling on the Inventor 2019&amp;nbsp; Build 330 Release 2019.4.8&amp;nbsp;&lt;/P&gt;&lt;P&gt;My App does several other things (some using Apprentice) so I think I'll pull out just the code for the STL export and try that on its own to make sure I'm not running two instances and also try it in iLogic.&lt;/P&gt;&lt;P&gt;I did just notice that when starting the Inventor application from the desktop it required me to login to the Autodesk server so maybe that was preventing the API from starting.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 08:33:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10856699#M41972</guid>
      <dc:creator>SteveLainson6531</dc:creator>
      <dc:date>2022-01-04T08:33:43Z</dc:date>
    </item>
    <item>
      <title>Betreff: API STL Translator on an Assembly File</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10857277#M41973</link>
      <description>&lt;P&gt;Steve,&lt;/P&gt;&lt;P&gt;'the bug' has a name:&lt;/P&gt;&lt;P&gt;"FLURONA"&lt;/P&gt;&lt;P&gt;Talk about mocking us while seeding society with weaponized microbes that the DoD and USDA invented in their filthy, criminal infested germ warfare labs around the world!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 14:11:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10857277#M41973</guid>
      <dc:creator>cadman777</dc:creator>
      <dc:date>2022-01-04T14:11:02Z</dc:date>
    </item>
    <item>
      <title>Betreff: API STL Translator on an Assembly File</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10857726#M41974</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564136"&gt;@Ralf_Krieg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help, I've installed 2021 Inventor Pro on my PC and tried the code in iLogic inside Inventor and (as you said) it works, creating both single and multipart files and taking care of the filenames for multi-parts, but it still does not create multi parts when called using the interop DLL reference (for either 2019 or 2021 versions) using the 2021 API in a standalone app created in Visual Studio, only creating single parts. I've tried taking all the Try/Catches out hoping for an exception to be thrown and also tried stepping through on debug but there are no clues and no errors are generated during the process so I'm no further to understanding why its not working. I suspect that it may be something to do with the TranslationContext and/or NameValueMap parameters not being passed to the API or maybe them not being implemented in the API. Without any documentation on how to call the STL translator correctly it is hard to know for sure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 16:54:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10857726#M41974</guid>
      <dc:creator>SteveLainson6531</dc:creator>
      <dc:date>2022-01-04T16:54:32Z</dc:date>
    </item>
    <item>
      <title>Betreff: API STL Translator on an Assembly File</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10858283#M41975</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry to hear that this special case is not working. I've added a button (Button1) in one of my standalone exe applications and assigned the code below to the button. The application has a reference to the Autodesk.Inventor.Interop.dll version 25.2.0.0 (Inventor 2021). Running this application while the assembly document is open in Inventor, it creates multiple STL files as expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim oInv As Inventor.Application = TryCast(Marshal.GetActiveObject("Inventor.Application"), Inventor.Application)
        Dim strCLSID As String = "{81CA7D27-2DBE-4058-8188-9136F85FC859}"
        Dim STLPath As String = System.IO.Path.GetDirectoryName(oInv.ActiveDocument.FullFileName) 'ThisDoc.Path
        Dim STLFileName As String = System.IO.Path.GetFileNameWithoutExtension(oInv.ActiveDocument.FullFileName) 'ThisDoc.FileName(False)
        Dim oAddIns As ApplicationAddIns = oInv.ApplicationAddIns 'ThisApplication.ApplicationAddIns
        Dim oSTLTranslator As TranslatorAddIn = DirectCast(oAddIns.ItemById(strCLSID), TranslatorAddIn)
        oSTLTranslator.Activate()

        Dim oDoc As Document = oInv.ActiveDocument
        Dim oContext As TranslationContext = oInv.TransientObjects.CreateTranslationContext
        Dim oOptions As NameValueMap = oInv.TransientObjects.CreateNameValueMap

        '    Save Copy As Options:
        '       Name Value Map:
        '               ExportUnits = 4 , 5 = Millimeter
        '               Resolution = 1
        '               AllowMoveMeshNode = False
        '               SurfaceDeviation = 60
        '               NormalDeviation = 14
        '               MaxEdgeLength = 100
        '               AspectRatio = 40
        '               ExportFileStructure = 0
        '               OutputFileType = 0
        '               ExportColor = True

        If oSTLTranslator.HasSaveCopyAsOptions(oDoc, oContext, oOptions) Then
            oOptions.Value("Resolution") = 0 'ComboSTLRes.SelectedIndex  ' Set accuracy.0 = High,  1 = Medium,  2 = Low
            oOptions.Value("OutputFileType") = 0 ' Set output file type:0 - binary,  1 - ASCII 
            oOptions.Value("ExportFileStructure") = 1 'ComboSTLStructure.SelectedIndex 'One part or multi ?

            oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
            Dim oData As DataMedium = oInv.TransientObjects.CreateDataMedium
            oData.FileName = STLPath &amp;amp; "\" &amp;amp; STLFileName &amp;amp; ".STL"

            Call oSTLTranslator.SaveCopyAs(oDoc, oContext, oOptions, oData)

            'SBar1.Text = "Exported " &amp;amp; oData.FileName

            'oDoc.Close(True)

        End If
    End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 22:05:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10858283#M41975</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2022-01-04T22:05:12Z</dc:date>
    </item>
    <item>
      <title>Betreff: API STL Translator on an Assembly File</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10859864#M41976</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564136"&gt;@Ralf_Krieg&lt;/a&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply once again. I've finally got it working - I had problems with the line :&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oInv As Inventor.Application = TryCast(Marshal.GetActiveObject("Inventor.Application"), Inventor.Application)&lt;/LI-CODE&gt;&lt;P&gt;which threw an exception, but replacing this with:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;            Dim inventorAppType As Type = System.Type.GetTypeFromProgID("Inventor.Application")
            oInv = System.Activator.CreateInstance(inventorAppType)
            oInv.Visible = False 'Show/Hide it&lt;/LI-CODE&gt;&lt;P&gt;It now works and exports multi-part STLs but I don't understand why.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attached a copy of my Visual Studio vb.net code for information for anyone. This&amp;nbsp;opens inventor in the background, allows a user to select an IAM in any selected LoD state and export the parts within as an binary STL(s) with selected resolution and either multipart or single part option.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its only has minimal error checking.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564136"&gt;@Ralf_Krieg&lt;/a&gt;&amp;nbsp;- thank you so much for your help, its very much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 16:04:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10859864#M41976</guid>
      <dc:creator>SteveLainson6531</dc:creator>
      <dc:date>2022-01-05T16:04:35Z</dc:date>
    </item>
    <item>
      <title>Betreff: API STL Translator on an Assembly File</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10860388#M41977</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Glad to hear it work now. &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My code snippet assumes an Inventor instance is already running. That's why it throws an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let your users find the things to check and prevent. It will be an endless list. There's nothing a user don't do. &lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 19:40:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10860388#M41977</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2022-01-05T19:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: API STL Translator on an Assembly File</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10861669#M41978</link>
      <description>&lt;P&gt;Just a closing note on this for anyone else finding that the STL translator wont export multiple STL parts - the 2019 API wouldn't do this for me (although it did export single parts) but the 2021 API does export multiple parts using the same code.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jan 2022 11:24:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-stl-translator-on-an-assembly-file/m-p/10861669#M41978</guid>
      <dc:creator>SteveLainson6531</dc:creator>
      <dc:date>2022-01-06T11:24:00Z</dc:date>
    </item>
  </channel>
</rss>

