<?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 Macro to save geometry as .jt doesnt use .cfg file. How do i get inventor to in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/macro-to-save-geometry-as-jt-doesnt-use-cfg-file-how-do-i-get/m-p/8422409#M91674</link>
    <description>&lt;P&gt;Macro to save geometry as .jt doesnt use .cfg file. How do i get inventor to use the cfg file I specify?&lt;/P&gt;</description>
    <pubDate>Sat, 24 Nov 2018 23:42:15 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-11-24T23:42:15Z</dc:date>
    <item>
      <title>Macro to save geometry as .jt doesnt use .cfg file. How do i get inventor to</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/macro-to-save-geometry-as-jt-doesnt-use-cfg-file-how-do-i-get/m-p/8422409#M91674</link>
      <description>&lt;P&gt;Macro to save geometry as .jt doesnt use .cfg file. How do i get inventor to use the cfg file I specify?&lt;/P&gt;</description>
      <pubDate>Sat, 24 Nov 2018 23:42:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/macro-to-save-geometry-as-jt-doesnt-use-cfg-file-how-do-i-get/m-p/8422409#M91674</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-24T23:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to save geometry as .jt doesnt use .cfg file. How do i get inventor to</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/macro-to-save-geometry-as-jt-doesnt-use-cfg-file-how-do-i-get/m-p/8436853#M91929</link>
      <description>&lt;P&gt;You would have to pass in the relevant options to the TraslatorAddin as a NameValueMap. The options for Config File are as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ConfigFilePath&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String&lt;/P&gt;
&lt;P&gt;ConfigFileEnabled&amp;nbsp; &amp;nbsp; Boolean&amp;nbsp; &amp;nbsp;(False)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Search Translator Options in API Help for more details on the available options.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Syntax&amp;nbsp;of SaveCopyAs Method of TranslatorAddIn Object&lt;/P&gt;
&lt;PRE&gt;TranslatorAddIn.SaveCopyAs( SourceObject As Object, Context As TranslationContext, Options As NameValueMap, TargetData As DataMedium ) &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 17:33:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/macro-to-save-geometry-as-jt-doesnt-use-cfg-file-how-do-i-get/m-p/8436853#M91929</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-30T17:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to save geometry as .jt doesnt use .cfg file. How do i get inventor to</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/macro-to-save-geometry-as-jt-doesnt-use-cfg-file-how-do-i-get/m-p/8438268#M91951</link>
      <description>&lt;P&gt;Thanks that gave me the clue i needed.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Dec 2018 12:31:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/macro-to-save-geometry-as-jt-doesnt-use-cfg-file-how-do-i-get/m-p/8438268#M91951</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-01T12:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to save geometry as .jt doesnt use .cfg file. How do i get inventor to</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/macro-to-save-geometry-as-jt-doesnt-use-cfg-file-how-do-i-get/m-p/8439578#M91960</link>
      <description>&lt;P&gt;Reasonably cleaned up version of final code:&lt;/P&gt;
&lt;PRE&gt;Function func_ConvertFolderContentToJT(ByVal strSourceFolder As String, ByVal strSourceFileType As String, ByVal strDestinationFolder As String, ByVal strDestinationFileType As String, ByVal strConverterConfigFilePath As String) As Boolean
    func_ConvertFolderContentToJT = True
    Dim objFS As FileSystemObject
    Set objFS = CreateObject("Scripting.FileSystemObject")

    If Right(strSourceFolder, 1) &amp;lt;&amp;gt; "\" Then
        strSourceFolder = strSourceFolder &amp;amp; "\"
    End If
    If objFS.FolderExists(strSourceFolder) &amp;lt;&amp;gt; True Then
        func_ConvertFolderContentToJT = False
        Exit Function
    End If
    If strDestinationFolder &amp;lt;&amp;gt; "" Then
        If objFS.FolderExists(strDestinationFolder) &amp;lt;&amp;gt; True Then
            strDestinationFolder = False
        End If
        If Right(strDestinationFolder, 1) &amp;lt;&amp;gt; "\" Then
            strDestinationFolder = strDestinationFolder &amp;amp; "\"
        End If
    End If

    If strSourceFileType = "" Then
        func_ConvertFolderContentToJT = False
        Exit Function
    End If
    
    If strDestinationFileType = "" Then
        func_ConvertFolderContentToJT = False
        Exit Function
    End If
    
    Dim strToLookFor As String
    strToLookFor = strDestinationFileType
    
    If Left(strDestinationFileType, 1) = "." Then
        strToLookFor = Right(strDestinationFileType, Len(strDestinationFileType) - 1)
    Else
        strToLookFor = strDestinationFileType
        strDestinationFileType = "." &amp;amp; strDestinationFileType
    End If
    
    If objFS.FileExists(strConverterConfigFilePath) = False Then
        func_ConvertFolderContentToJT = False
        Exit Function
    End If
    
    Dim flg_TranslationAddInFound As Boolean
    flg_TranslationAddInFound = False
    Dim intAddIn As Long
    intAddIn = 1
    Do
        If InStr(1, UCase(ThisApplication.ApplicationAddIns.Item(intAddIn).Description), UCase(strToLookFor)) &amp;gt; 0 Then
            flg_TranslationAddInFound = True
            Exit Do
        End If
        intAddIn = intAddIn + 1
    Loop Until intAddIn = ThisApplication.ApplicationAddIns.Count + 1

    If flg_TranslationAddInFound &amp;lt;&amp;gt; True Then
        func_ConvertFolderContentToJT = False
        Exit Function
    End If
    
    Dim JTAddIn As TranslatorAddIn
    Set JTAddIn = ThisApplication.ApplicationAddIns.ItemById(ThisApplication.ApplicationAddIns.Item(intAddIn).ClientId)
   
    Dim oContext As TranslationContext
    Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
            
    Dim oOptions As NameValueMap
    Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap

    Dim oDataMedium As DataMedium
    Set oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
    
    Dim objFolder As Folder
    Dim objFile 'As File
    Set objFolder = objFS.GetFolder(strSourceFolder)
    Debug.Print "Convert Content of Folder: " &amp;amp; strSourceFolder
    For Each objFile In objFolder.Files
        Dim strFullFilePath As String
        strFullFilePath = objFile
        If Right(objFile, Len(strSourceFileType)) = strSourceFileType Then
            Dim oPartDoc As PartDocument
            Set oPartDoc = ThisApplication.Documents.Open(strFullFilePath)
            If JTAddIn.HasSaveCopyAsOptions(oPartDoc, oContext, oOptions) = True Then
                oOptions.Value("ConfigFilePath") = strConverterConfigFilePath
                oOptions.Value("ConfigFileEnabled") = True
                oContext.Type = kFileBrowseIOMechanism
                If strDestinationFolder &amp;lt;&amp;gt; "" Then
                    strFullFilePath = Replace(strFullFilePath, strSourceFolder, strDestinationFolder)
                End If
                oDataMedium.FileName = strFullFilePath &amp;amp; strDestinationFileType
                JTAddIn.SaveCopyAs oPartDoc, oContext, oOptions, oDataMedium
                oPartDoc.Close True
            Else
                If strDestinationFolder &amp;lt;&amp;gt; "" Then
                    strFullFilePath = Replace(strFullFilePath, strSourceFolder, strDestinationFolder)
                End If
                
                oPartDoc.SaveAs strFullFilePath &amp;amp; strDestinationFileType, True
                oPartDoc.Close True
            End If
        End If
    Next objFile
End Function
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Dec 2018 19:58:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/macro-to-save-geometry-as-jt-doesnt-use-cfg-file-how-do-i-get/m-p/8439578#M91960</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-02T19:58:20Z</dc:date>
    </item>
  </channel>
</rss>

