0

我经常需要将现有的 JT 模型导出为镶嵌的 JT 模型,这在我的计算机上需要很长时间。所以我想知道这是否可以通过脚本完成?理想情况下嵌入在 Excel 文件中,我在其中提供 JT 文件名和路径的列表,但一个一个也可以。只要我不必在 Inventor 中手动打开和导出每个文件。

需要设置的导入选项: - 对象过滤器:实体

导出选项: - 要导出的对象类型:全部勾选 - 输出:仅 Facets - 版本:9.5 - 结构:单片

这可以做到吗?我有一些 VBA 经验,但是就脚本/命令行的东西而言,绝对没有专门使用 Inventor 的经验......

谢谢!

做梦8a

4

1 回答 1

0

I don't have at the moment the solution for the Options. But this is the script to export to JT. It's based on the STEP example in the Inventor API documentation.

Public Sub ExportToJT(inventorFile As String, jtFile As String)
    ' Get the JT translator Add-In.
    Dim oJTTranslator As TranslatorAddIn
    Set oJTTranslator = ThisApplication.ApplicationAddIns.ItemById("{16625A0E-F58C-4488-A969-E7EC4F99CACD}")

    If oJTTranslator Is Nothing Then
        MsgBox "Could not access JT translator."
        Exit Sub
    End If

    Dim oContext As TranslationContext
    Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
    Dim oOptions As NameValueMap
    Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap
    If oJTTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then

        ' Other options...
        'oOptions.Value("Author") = ""
        'oOptions.Value("Authorization") = ""
        'oOptions.Value("Description") = ""
        'oOptions.Value("Organization") = ""

        oContext.Type = kFileBrowseIOMechanism

        Dim oData As DataMedium
        Set oData = ThisApplication.TransientObjects.CreateDataMedium
        oData.FileName = jtFile

        Call oJTTranslator.SaveCopyAs(ThisApplication.ActiveDocument, oContext, oOptions, oData)
    End If
End Sub
于 2018-11-08T09:16:49.823 回答