使用Design Automation API (DA)下载SVF数据

问题描述 投票:0回答:1

我想将inventor.ipt文件转换为SVF数据,并使用设计自动化API(DA)下载SVF数据。 参考以下博客,而不是Appbundles,创建如下所示的iLogicVb 文件并将其上传到inventor.ipt 的同一存储桶中。 https://aps.autodesk.com/blog/speed-viewable- Generation-when-using-design-automation-inventor workkitem的执行结果为“status”:“success”,但没有任何内容输出到output.zip。 出现消息 ReferenceError: SVFdocumentid 未定义。 怎么了?

uploaded file name is
Question_SVFinput.iLogicVb


' Get AutoCAD Inventor object
Dim inventorApplication As Inventor.Application = ThisApplication

' Get the documentation (if necessary, use the appropriate method to get the documentation)
Dim doc As Document = ThisDoc.Document

'Output folder path

Dim docDir As String = System.IO.Path.GetDirectoryName(ThisDoc.Document.FullFileName)
Dim filePath As String = System.IO.Path.Combine(docDir, "output.zip")
Dim outputFolderPath As String = filePath

' Log trace
'iLogicVb.Automation.LogTrace("**Saving SVF")
Try
    ' Get TranslatorAddIn object
    Dim oAddin As TranslatorAddIn = inventorApplication.ApplicationAddIns.ItemById("{C200B99B-B7DD-4114-A5E9-6557AB5ED8EC}")

    'Create a TranslationContext object
    Dim oContext As TranslationContext = inventorApplication.TransientObjects.CreateTranslationContext()
    oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism

    'Create NameValueMap object
    Dim oOptions As NameValueMap = inventorApplication.TransientObjects.CreateNameValueMap()
    Dim oData As DataMedium = inventorApplication.TransientObjects.CreateDataMedium()

    'Set output file path
    oData.FileName = System.IO.Path.Combine(outputFolderPath, "result.collaboration")

    'Set SVF options
    If oAddin.get_HasSaveCopyAsOptions(doc, oContext, oOptions) Then
        oOptions.Value("EnableExpressTranslation") = False
        oOptions.Value("SVFFileOutputDir") = outputFolderPath
        oOptions.Value("ExportFileProperties") = True
        oOptions.Value("ObfuscateLabels") = False
    End If

    ' Execute the SaveCopyAs method
    oAddin.SaveCopyAs(doc, oContext, oOptions, oData)
    
    ' Output trace information
    'iLogicVb.Automation.LogTrace("SVF can be exported.")
    'iLogicVb.Automation.LogTrace("** Saved SVF as " & oData.FileName)

Catch ex As Exception
    ' Output error log
    'iLogicVb.Automation.LogError("********Export to format SVF failed: " & ex.Message)

End Trytype here
autodesk-forge
1个回答
0
投票

您需要提供有关如何设置活动的更多信息以及工作项的完整报告。

如果您使用的是这篇博文指出的示例网站,那么您应该完全按原样保留iLogic代码,因为它期望结果位于

outputFiles
文件夹中。

© www.soinside.com 2019 - 2024. All rights reserved.