首页 > 解决方案 > WorkItem -> 错误:无法准备应用程序包

问题描述

我正在尝试使用 AutoDesk 的 API 修改 DWG 文件。

我用 Visual Basic 创建了一个简单的命令,这个命令在 AutoCAD 中运行良好。命令名称是“Rota”。

然后我创建了一个 XML 文件:

<?xml version="1.0" encoding="utf-8"?>
<ApplicationPackage
  SchemaVersion="1.0"
  Version="1.0"
  AutodeskProduct="AutoCAD"
  AppVersion="0.1.0"
  Name="PluginPrueba"
  Description="Paquete de Prueba"
  Author="Yomisma" >

  <Components>
    <RuntimeRequirements 
      OS="Win64" 
      Platform="AutoCAD" 
      SeriesMin="R23.0" 
      SeriesMax="R23.0"/>
  <ComponentEntry
    AppName="Comandos"
    ModuleName="./Contents/PluginPrueba.dll"
    AppType=".Net"
    AppDescription="Rotate 45 degrees"
    LoadOnCommandInvocation="True"
    LoadOnAutoCADStartup="True">
    <Commands GroupName="ComandosVB">
      <Command Global="Rota" Local="Rota" />
      </Commands>
    </ComponentEntry>
  </Components>
</ApplicationPackage>

我将 XML 放入文件夹 PluginPrueba.bundle,并创建了文件夹 Contests(在此文件夹中我放入了 de DLL 文件)。然后我制作了 ZIP 文件。

然后进入我的代码,我按照以下步骤操作:

1.- oAuth。

2.- 创建一个桶。我放入 Bucket de DWG 文件进行修改。

3.- 发布捆绑包

4.- 创建BundleAlias

5.- UploadToForge 压缩文件。

6.- 创建活动

{
    "id": "ActivityPrueba",
    "commandLine": "$(engine.path)\\accoreconsole.exe /i $(args[inputFile].path) /al $(appbundles[{{ AppBundleName  }}].path) /s $(settings[script].path)",
    "parameters": {
        "inputFile": {
            "zip": false,
            "ondemand": false,
            "verb": "get",
            "description": "Rota DWG",
            "localName": "$(inputFile)"
        },
        "outputFile": {
            "zip": false,
            "ondemand": false,
            "verb": "put",
            "description": "output file",
            "localName": "outputFile.dwg",
            "required": "true"
        }
    },
    "engine": "Autodesk.AutoCAD+23",
    "appbundles": [
        "{{ client_id  }}.{{ AppBundleName  }}+prod"
    ],
    "settings": {
        "script": "Rota\n"
    },
    "description": "AutoCAD Prueba Comando."
}

7.- 创建活动别名

8.- 创建工作项

当我执行时,这是报告:

[07/17/2019 08:10:23] Starting work item { id }
[07/17/2019 08:10:23] Start download phase.
[07/17/2019 08:10:23] Start preparing AppPackage appBundlePrueba.
[07/17/2019 08:10:23] Start downloading file https://developer.api.autodesk.com/oss/v2/buckets/newtoken/objects/square.dwg.
[07/17/2019 08:10:23] Download bits and install app to local cache.
[07/17/2019 08:10:23] Error: Failed to prepare app package(s).
[07/17/2019 08:10:23] End downloading file https://developer.api.autodesk.com/oss/v2/buckets/newtoken/objects/square.dwg. 32049 bytes have been written to T:\Aces\Jobs\b64f9613734b497db06459cdcd6e6fb1\square.dwg.
[07/17/2019 08:10:23] End download phase.
[07/17/2019 08:10:23] Error: An unexpected error happened during phase Downloading of job.
[07/17/2019 08:10:23] Job finished with result FailedEnvironmentSetup
[07/17/2019 08:10:23] Job Status:
{
  "status": "failedDownload",
  ..........................
}

怎么了?

标签: autodesk-designautomation

解决方案


谢谢布莱恩!!

我解决了Activity中的错误变化:

"settings": {
    "script": "Rota\n"

至:

"settings": {
    "script": "(command \"Rota\")\n"

现在我有另一个错误:

[07/18/2019 09:24:00] Error: Non-optional output [outputFile.dwg] is missing .

[07/18/2019 09:24:00] Error: An unexpected error happened during phase Publishing of job.

在活动中,我有以下代码:

    "outputFile": {
        "zip": false,
        "ondemand": false,
        "verb": "put",
        "description": "output file",
        "localName": "outputFile.dwg",
        "required": "true"
    }

在 WorkItem 中:

    "outputFile": {
        "url": "https://developer.api.autodesk.com/oss/v2/buckets/{{ TokenKey}}/objects/square.dwg",
        "headers": {
            "Authorization": "Bearer {{ oAuthToken  }}",
            "Content-type": "application/octet-stream"
        },
        "verb": "put"
    },

可能会发生什么变化?

谢谢!!


推荐阅读