Search code examples
autodesk-forgeautodesk-designautomation

Automate Inventor SAT import with Design Automation


Is possible in Design Automation for Inventor, to automate the manual process of importing a SAT file to an assembly?

I see there is a translator add-in for SAT in Inventor 89162634-02B6-11D5-8E80-0010B541CD80, but is not clear if it support only export, I need instead import options.

In short I need to automate the option and steps described here: https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-7CF00AFC-D40C-4FFC-B781-338AE2476527


Solution

  • Import SAT with Design Automation is possible in general.

    When you need to get Translator options (not only SAT translator), you can use following VBA code

    Options with possible values are described here

    https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-25D24E28-7517-4903-8AEE-123F8C71A89E&v=Inventor2023

    Sub ImportSAT_Options()
        Dim satAddIn As TranslatorAddIn
        Set satAddIn = ThisApplication.ApplicationAddIns.ItemById("{89162634-02B6-11D5-8E80-0010B541CD80}")
        
        Dim oContext As TranslationContext
        Set oContext = ThisApplication.TransientObjects.CreateTranslationContext()
        
        Dim oOptions    As NameValueMap
        Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap()
        
        Dim oData As DataMedium
        Set oData = ThisApplication.TransientObjects.CreateDataMedium()
        
        If satAddIn.HasOpenOptions(oData, oContext, oOptions) Then
            Call PrintNameValueMap(oOptions)
        End If
    End Sub
    
    Sub PrintNameValueMap(namValMap As NameValueMap)
        Dim i As Integer
        Dim key As String
        Dim value As Variant
        For i = 1 To namValMap.Count
            key = namValMap.name(i)
            value = namValMap.value(key)
            Debug.Print key, value
        Next
    End Sub