0

我无法引用父程序集翻译所需的子程序集。

首先我POSThttps://developer.api.autodesk.com/references/v1/setreference使用以下身体

{ master: 'urn:adsk.objects:os.object:stemn/57b9f339c77fe2652f830206-ckwdob3791d6u359wz7eklnmi.iam',
     dependencies: 
      [ { file: 'urn:adsk.objects:os.object:stemn/57b9f339c77fe2652f830206-e3l7hokp0qxqn227b7qcjo47vi.iam',
          metadata: 
           { childPath: 'fuselage.iam',
             parentPath: '57b9f339c77fe2652f830206-ckwdob3791d6u359wz7eklnmi.iam' } },
        { file: 'urn:adsk.objects:os.object:stemn/57b9f339c77fe2652f830206-mhrb7um0of74iasv37nzh0k9.iam',
          metadata: 
           { childPath: 'motor_mount.iam',
             parentPath: '57b9f339c77fe2652f830206-ckwdob3791d6u359wz7eklnmi.iam' } } ] }

设置引用后,我请求翻译并得到以下翻译结果:

{ Result: 'Success',
  Scope: '25660970-8194-4de0-baa4-c8f1f132b2a7',
  RegisterType: [ 'thumbnail', '2dviewing', '3dviewing' ] }

之后,我得到了骨灰盒的清单,如下所示:

{ guid: 'dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6c3RlbW4vNTdiOWYzMzljNzdmZTI2NTJmODMwMjA2LWNrd2RvYjM3OTFkNnUzNTl3ejdla2xubWkuaWFt',
  owner: 'dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6c3RlbW4vNTdiOWYzMzljNzdmZTI2NTJmODMwMjA2LWNrd2RvYjM3OTFkNnUzNTl3ejdla2xubWkuaWFt',
  type: 'design',
  hasThumbnail: 'false',
  startedAt: 'Wed Jan 04 04:43:59 UTC 2017',
  urn: 'dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6c3RlbW4vNTdiOWYzMzljNzdmZTI2NTJmODMwMjA2LWNrd2RvYjM3OTFkNnUzNTl3ejdla2xubWkuaWFt',
  region: 'US',
  status: 'failed',
  progress: 'complete',
  success: '100%',
  children: 
   [ { guid: 'aa85aad6-c480-4a35-9cbf-4cf5994a25ba',
       messages: 
        [ { type: 'warning',
            message: 'The drawing\'s thumbnails were not properly created.',
            code: 'TranslationWorker-ThumbnailGenerationFailed' } ],
       name: '57b9f339c77fe2652f830206-ckwdob3791d6u359wz7eklnmi.iam',
       success: '100%',
       hasThumbnail: 'false',
       role: 'viewable',
       version: '2.0',
       urn: 'dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6c3RlbW4vNTdiOWYzMzljNzdmZTI2NTJmODMwMjA2LWNrd2RvYjM3OTFkNnUzNTl3ejdla2xubWkuaWFt',
       status: 'failed',
       assetCount: 25,
       type: 'folder',
       progress: 'complete',
       children: 
        [ { guid: '015896d9-e6d3-4be6-8f3d-96da5e64eed3',
            type: 'folder',
            name: 'Scenes',
            status: 'success',
            progress: 'complete',
            success: '100%',
            hasThumbnail: 'false',
            children: 
             [ { guid: '451f7aab-1917-40dd-b117-5dd8f90ab6a7',
                 type: 'geometry',
                 role: '3d',
                 name: 'Scene',
                 status: 'success',
                 messages: 
                  [ { type: 'warning',
                      code: 'ATF-1023',
                      message: 
                       [ 'The file: {0} does not exist.',
                         'X:\\Google Drive\\SCAAD\\PRJ_HAARDCraft\\HAARDCraft_JFlight\\CAD\\Fuselage\\fuselage.iam' ] },
                    { type: 'warning',
                      code: 'ATF-1023',
                      message: 
                       [ 'The file: {0} does not exist.',
                         'X:\\Google Drive\\SCAAD\\PRJ_HAARDCraft\\HAARDCraft_JFlight\\CAD\\Engine mount\\motor_mount.iam' ] },
                    { type: 'error',
                      code: 'ATF-1026',
                      message: 
                       [ 'The file: {0} is empty.',
                         'C:/worker/viewing-inventor-lmv/tmp/job-1/68/output/1/57b9f339c77fe2652f830206-ckwdob3791d6u359wz7eklnmi.svf' ] } ],
                 size: 27864,
                 progress: 'complete',
                 success: '100%',
                 hasThumbnail: 'false',
                 children: 
                  [ { guid: '6dc4b244-8a47-4a75-bcb3-811dc7b4f294',
                      type: 'resource',
                      urn: 'urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6c3RlbW4vNTdiOWYzMzljNzdmZTI2NTJmODMwMjA2LWNrd2RvYjM3OTFkNnUzNTl3ejdla2xubWkuaWFt/output/1/57b9f339c77fe2652f830206-ckwdob3791d6u359wz7eklnmi.svf',
                      role: 'graphics',
                      mime: 'application/autodesk-svf',
                      size: 27864 } ] },
               { guid: '9bb1adbe-d9d9-4482-ac03-1d60bb0aea36',
                 type: 'resource',
                 urn: 'urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6c3RlbW4vNTdiOWYzMzljNzdmZTI2NTJmODMwMjA2LWNrd2RvYjM3OTFkNnUzNTl3ejdla2xubWkuaWFt/output/1/properties.db',
                 role: 'Autodesk.CloudPlatform.PropertyDatabase',
                 mime: 'application/autodesk-db',
                 status: 'success',
                 size: 24576 } ] },
          { guid: '039c2bcf-beb7-426b-916c-4a5adb814593',
            type: 'resource',
            role: 'Autodesk.CloudPlatform.DesignDescription',
            urn: 'urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6c3RlbW4vNTdiOWYzMzljNzdmZTI2NTJmODMwMjA2LWNrd2RvYjM3OTFkNnUzNTl3ejdla2xubWkuaWFt/output/xref/designDescription.json',
            mime: 'application/json' } ] } ] }

使用相同的代码路径,我可以成功地渲染具有已使用设置的非装配子零件的装配setreference,但是在渲染具有子装配的装配时,setreference似乎没有成功设置对子装配文件的引用。我设置对子程序集的引用的顺序有问题吗?

4

2 回答 2

1

我与@sabrehage 讨论并最终得到了工作代码。

首先,推荐使用 Forge Derivative API v2 (zip + 仅指定根文件),API 用户不需要显式指定引用。

如果您仍然想使用 Forge Derivative API v1,以下是注意事项:

在本地 Inventor 中,文件参考由 Inventor Project 管理。Inventor 将首先在项目的特定文件夹中查找 ref 文件,然后查找相对路径。很明显,当文件上传到 Forge 的 bucket 时,没有项目文件,所有文件在物理角度上都处于同一级别。所以在 v1 中,它取决于发件人指定的参考文件。

如果层次结构是这样的:

Top Assembly.iam
    part1.ipt
    part2.ipt

参考文件可以像博客中提到的那样简单地组成:http: //adndevblog.typepad.com/cloud_and_mobile/2015/09/how-to-set-references-with-inventor-files-for-view-and -data-api.html

在@sabrehagen 的数据集中,层次结构包含嵌套的程序集,甚至在子文件夹中:

topassemb.iam
    part in top assemb.ipt
    subassem folder
        subassem.iam
        part1 in sub assem1.ipt
        part2 in sub assem1.ipt

正确的方法是在一次调用中指定(仅适用于顶级组件),并在参考映射中指定子文件夹。另外,我们应该用原始名称定义路径名,而不是已经被 URL 编码。IE

{
    "master" : "urn:adsk.objects:os.object:adsk2017-8/topassemb.iam",
    "dependencies" : [
        {
            "file" : "urn:adsk.objects:os.object:adsk2017-8/subassem.iam",
            "metadata" : {
                "childPath" : "subassem/subassem.iam",
                "parentPath" : "topassemb.iam"
                }
        },
        {
            "file" : "urn:adsk.objects:os.object:adsk2017-8/part1%20in%20sub%20assem1.ipt",
            "metadata" : {
                "childPath" : "part1 in sub assem1.ipt",
                "parentPath" : "subassem/subassem.iam"
                }
        },
        {
            "file" : "urn:adsk.objects:os.object:adsk2017-8/part2%20in%20sub%20assem1.ipt",
            "metadata" : {
                "childPath" : "part2 in sub assem1.ipt",
                "parentPath" : "subassem/subassem.iam"
                }
        },
        {
            "file" : "urn:adsk.objects:os.object:adsk2017-8/part%20in%20top%20assemb.ipt",
            "metadata" : {
                "childPath" : "part in top assemb.ipt",
                "parentPath" : "topassemb.iam"
                }
        } 
    ]
}

如果不指定子文件夹,Forge 认为所有文件都在同一级别,但它与上次保存的层次结构(绝对路径)冲突。所以无法在bucket中找到对应的文件。

Forge 获取文件并正确引用后,它会查看引用文件并创建子文件夹(如果指定),然后将这些文件从存储桶中放入子文件夹中,最后进行翻译。

于 2017-02-04T05:02:08.063 回答
0

我记得,您还需要在 set reference 的 Web 服务中配置部件。这是一个博客:http ://adndevblog.typepad.com/cloud_and_mobile/2015/09/how-to-set-references-with-inventor-files-for-view-and-data-api.html 。可能它可以帮助您诊断问题。但是,我强烈建议您迁移到 v2,您无需手动设置参考。您可以将所有数据集作为 zip 文件上传并设置哪个文件是顶部(根)文件,Forge 将自动分析层次结构。这是另一个博客:http ://adndevblog.typepad.com/cloud_and_mobile/2016/07/translate-referenced-files-by-derivative-api.html

于 2017-01-05T09:55:10.397 回答