0

我正在尝试使用 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",
  ..........................
}

怎么了?

4

2 回答 2

0

谢谢布莱恩!!

我解决了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"
    },

可能会发生什么变化?

谢谢!!

于 2019-07-18T09:36:53.077 回答
0

由于错误消息表明我们的服务无法从存储桶下载输入文件......很可能是由于标头中缺少身份验证信息。

请记住,我们的存储桶受 OAuth2 保护,因此您需要在工作项中提供访问令牌(有关详细信息,请参阅此处)或生成签名 URL 以临时下载/上传对象而无需身份验证(请参阅此处的详细信息)

"headers": {
              "Authorization": "", //header goes here
              "Content-type": "application/octet-stream"
            },

或者,您可以将输入/输出文件存储到您选择的任何远程存储 - AWS/GCD/Azure 等。

于 2019-07-18T03:18:49.737 回答