如何从 Autodesk 模型衍生 API 的响应中识别提取的 obj 文件?

Posted

技术标签:

【中文标题】如何从 Autodesk 模型衍生 API 的响应中识别提取的 obj 文件?【英文标题】:How to identify extracted obj file from response of autodesk model derivative API? 【发布时间】:2019-11-15 18:34:27 【问题描述】:

在模型派生 API(使用 DbIds 的 OBJ 提取)中,我使用 API 检索了 OBJ URN。如下 Response 所示,它返回 obj、mtl 及其 zip 的所有子 URN。我们如何识别最近的提取,因为每个孩子都有自己的指导?

我附上了整个响应 JSON。我正在寻找的是第二个 obj 文件,它使用多个 dbid 提取,例如“17,19,21,22,23 ...”。第一个子 obj 是很久以前创建的。如何区分新的 obj.因为每个节点的 GUID 都不同。如何识别哪个 GUID.obj 属于我想要的提取。

** 已编辑 ** 我正在寻找识别提取的波前对象文件(不是从元数据中获取的对象 ID 和名称)。假设如果我从一个模型中提取了 2 个目标文件,那么在完成目标文件几何提取作业后,将生成 6 个文件并存储在存储桶中。

    第一个 .obj (guid = /output/geometry/e72fa6b3-4fc2-3c86-8424-5d0755539c0d.obj) 第一个.mtl 第一个.zip 第二个.obj 第二个.mtl 第二个.zip

每个文件都有不同的 GUID.Type 作为名称。并且这些 guid 是随机的,并且在调用提取 API 或获取其进度时从未显示。

这些显示在下面的 JSON 文件中。现在假设我从一个模型中提取了 10 个不同的目标文件。这意味着将在桶 30 中生成新文件 URN。 而且越来越难以识别。

解决方案可能是如果我从模型中提取 obj 几何图形,我应该得到那个特定的 obj、mtl、zips guid。如果我只得到 3 个 id,那么我可以映射它们并从存储桶下载它。 现在发生的事情是我在调用 get manifest GET :urn/manifest 后得到了所有 obj 的 guid(假设为 30 )。而且我不明白哪个 obj 文件属于哪个提取。


  "type": "manifest",
  "hasThumbnail": "true",
  "status": "success",
  "progress": "complete",
  "region": "US",
  "urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA",
  "version": "1.0",
  "derivatives": [
    "name": "rme_advanced_sample_project.nwd",
    "hasThumbnail": "true",
    "status": "success",
    "progress": "complete",
    "outputType": "svf",
    "children": [
      "guid": "763d96f1-0812-451d-b3a1-a51a27eba53b",
      "name": "rme_advanced_sample_project.rvt",
      "hasThumbnail": "true",
      "role": "3d",
      "viewableID": "rme_advanced_sample_project.rvt",
      "progress": "complete",
      "useAsDefault": true,
      "status": "success",
      "type": "geometry",
      "children": [
        "guid": "1e172e73-2305-4eb8-9954-eeab8217a8d3",
        "name": "Default",
        "hasThumbnail": "true",
        "role": "3d",
        "camera": [-86.09573364257812, -79.89456176757812, 139.12220764160156, 70.56798553466797, 76.76915740966797, -17.541505813598633, 0.40824830532073975, 0.40824830532073975, 0.8164966106414795, 1.664323329925537, 0.785398006439209, 1, 0],
        "useAsDefault": true,
        "status": "success",
        "type": "view",
        "children": [
          "guid": "f2054c5f-10b8-457b-a927-23b69107dcd7",
          "role": "thumbnail",
          "mime": "image/png",
          "resolution": [100, 100],
          "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/0/0_100.png",
          "type": "resource"
        , 
          "guid": "20625548-d014-4d29-8e50-4d61a1759a60",
          "role": "thumbnail",
          "mime": "image/png",
          "resolution": [200, 200],
          "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/0/0_200.png",
          "type": "resource"
        , 
          "guid": "48675a6a-f2ec-4748-b22c-200b72cd06a8",
          "role": "thumbnail",
          "mime": "image/png",
          "resolution": [400, 400],
          "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/0/0_400.png",
          "type": "resource"
        ]
      , 
        "guid": "77850512-9e8b-4d09-bb1a-45706ad5b7e6",
        "name": "3D View",
        "hasThumbnail": "false",
        "role": "viewable",
        "progress": "0% complete",
        "status": "success",
        "type": "folder",
        "children": [
          "guid": "ebf9f756-6cfa-4858-9787-e3af9c8424c3",
          "name": "3D Duct & Equipment",
          "role": "3d",
          "camera": [61.56271743774414, 38.53883743286133, 9.783880233764648, 59.46215057373047, 40.639404296875, 7.683313846588135, -0.40824830532073975, 0.40824830532073975, 0.8164966106414795, 1, 45, 227.96743774414062, 1],
          "status": "success",
          "type": "view"
        , 
          "guid": "54d5a270-f330-4446-a482-1079312d8518",
          "name": "Main Electrical Distribution",
          "role": "3d",
          "camera": [91.54497528076172, -63.42673110961914, -34.64605712890625, 46.680015563964844, 38.5232048034668, -66.7026596069336, -0.11140129715204239, 0.25314533710479736, 0.9609928131103516, 1, 45, 342.1146545410156, 1],
          "status": "success",
          "type": "view"
        , 
          "guid": "2c6938f2-c052-4195-93d0-adc7af1cb965",
          "name": "3D Plumbing",
          "role": "3d",
          "camera": [3.6063644886016846, -184.62478637695312, 180.24473571777344, 173.09983825683594, -2.4171712398529053, -0.014680136926472187, 0.39955270290374756, 0.42952418327331543, 0.8098559379577637, 1, 45, 461.8291931152344, 1],
          "status": "success",
          "type": "view"
        , 
          "guid": "1b3f6ae4-beb6-478c-9cfe-b83bf371141d",
          "name": "Room 53 3D Fire Protection",
          "role": "3d",
          "camera": [735.119384765625, -538.998779296875, 662.6300048828125, 98.2931900024414, 97.82740020751953, 25.80381202697754, -0.40824830532073975, 0.40824830532073975, 0.8164966106414795, 1, 45, 368.90972900390625, 1],
          "status": "success",
          "type": "view"
        , 
          "guid": "45811cc4-79ed-421b-82b2-6c8548d1507e",
          "name": "WSHP 2-3 System View",
          "role": "3d",
          "camera": [108.588134765625, 117.7073974609375, 54.383365631103516, 102.33130645751953, 123.9642333984375, 48.12653350830078, -0.40824830532073975, 0.40824830532073975, 0.8164966106414795, 1, 45, 333.1808776855469, 1],
          "status": "success",
          "type": "view"
        , 
          "guid": "8c1402a9-6af6-47af-af0d-2c025ca26109",
          "name": "Plumbing Isometric - Domestic Water",
          "role": "3d",
          "camera": [3.6063644886016846, -184.62478637695312, 180.24473571777344, 173.09983825683594, -2.4171712398529053, -0.014680136926472187, 0.39955270290374756, 0.42952418327331543, 0.8098559379577637, 1, 45, 461.8291931152344, 1],
          "status": "success",
          "type": "view"
        , 
          "guid": "9dcc0f6a-fc2c-418f-8d08-c99b7afed337",
          "name": "Plumbing Isometric - Sanitary Waste",
          "role": "3d",
          "camera": [3.6063644886016846, -184.62478637695312, 180.24473571777344, 173.09983825683594, -2.4171712398529053, -0.014680136926472187, 0.39955270290374756, 0.42952418327331543, 0.8098559379577637, 1, 45, 461.8291931152344, 1],
          "status": "success",
          "type": "view"
        , 
          "guid": "e3a2443a-7f4c-49dc-a41d-da067922ab04",
          "name": "Typical Make Up Air Isometric Detail",
          "role": "3d",
          "camera": [0.8279496431350708, 187.99771118164062, 118.81455993652344, 100.31283569335938, 88.51282501220703, 19.32967758178711, 0.40824830532073975, -0.40824830532073975, 0.8164966106414795, 1, 45, 248.74505615234375, 1],
          "status": "success",
          "type": "view"
        , 
          "guid": "915564b9-ed83-426e-88df-002dac32363b",
          "name": "Typical Room WSHP",
          "role": "3d",
          "camera": [171.6078338623047, -3.038959264755249, 18.71452522277832, 90.31718444824219, 43.15993118286133, -21.66922950744629, -0.34472253918647766, 0.19591180980205536, 0.9180331826210022, 1, 45, 257.0640869140625, 1],
          "status": "success",
          "type": "view"
        , 
          "guid": "12a3ef04-1364-4c23-af91-2679132e3848",
          "name": "Toilet Room",
          "role": "3d",
          "camera": [196.7369842529297, -4.305071830749512, 109.12708282470703, 98.9510269165039, 86.86759948730469, 14.070858001708984, -0.42381933331489563, 0.3951563239097595, 0.8150022625923157, 1, 45, 359.9964294433594, 1],
          "status": "success",
          "type": "view"
        , 
          "guid": "9a34ab86-dfdf-4516-a087-b8f9775435fe",
          "name": "1st Level Slice",
          "role": "3d",
          "camera": [-76.2143325805664, -163.60708618164062, 175.46923828125, 111.73212432861328, 69.6202392578125, 11.465206146240234, 0.3013473451137543, 0.373949259519577, 0.8771269917488098, 1, 45, 313.0205993652344, 1],
          "status": "success",
          "type": "view"
        , 
          "guid": "09effac0-27ac-4f02-b4d7-31ef18a57ef9",
          "name": "3D",
          "role": "3d",
          "camera": [0.8279496431350708, 187.99771118164062, 118.81455993652344, 100.31283569335938, 88.51282501220703, 19.32967758178711, 0.40824830532073975, -0.40824830532073975, 0.8164966106414795, 1, 45, 358.7159118652344, 1],
          "status": "success",
          "type": "view"
        ]
      , 
        "guid": "f9f4721d-9304-43c4-8c07-34cbcc5e79c7",
        "role": "graphics",
        "mime": "application/autodesk-svf",
        "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/0/0.svf",
        "type": "resource"
      ]
    , 
      "guid": "3b7195a7-17ec-4d80-b259-4e9df165f3fb",
      "role": "Autodesk.CloudPlatform.PropertyDatabase",
      "mime": "application/autodesk-db",
      "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/0/properties.db",
      "status": "success",
      "type": "resource"
    ]
  , 
    "hasThumbnail": "false",
    "status": "success",
    "progress": "complete",
    "outputType": "obj",
    "children": [
      "guid": "22519ef5-9da5-35ca-bc70-b25b45e8f8fa",
      "role": "obj",
      "modelGuid": "f9f4721d-9304-43c4-8c07-34cbcc5e79c7",
      "objectIds": [547, 924, 942, 977],
      "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/geometry/e72fa6b3-4fc2-3c86-8424-5d0755539c0d.obj",
      "status": "success",
      "type": "resource"
    , 
      "guid": "75401422-bb33-350a-aa10-05625504d6ca",
      "role": "obj",
      "modelGuid": "f9f4721d-9304-43c4-8c07-34cbcc5e79c7",
      "objectIds": [547, 924, 942, 977],
      "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/geometry/e72fa6b3-4fc2-3c86-8424-5d0755539c0d.mtl",
      "status": "success",
      "type": "resource"
    , 
      "guid": "a4b9fb43-8525-3243-bde1-72797399e342",
      "role": "obj",
      "modelGuid": "f9f4721d-9304-43c4-8c07-34cbcc5e79c7",
      "objectIds": [547, 924, 942, 977],
      "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/geometry/e72fa6b3-4fc2-3c86-8424-5d0755539c0d.zip",
      "status": "success",
      "type": "resource"
    , 
      "guid": "1177e7ea-7fad-34b7-a7bd-23d70e4a62a8",
      "type": "resource",
      "role": "obj",
      "modelGuid": "f9f4721d-9304-43c4-8c07-34cbcc5e79c7",
      "objectIds": [17, 19, 21, 22, 23, 24, 25, 26, 27, 83, 84, 85, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 263, 264, 265, 268, 269, 270, 302, 303, 304, 320, 321, 322, 350, 351, 352, 370, 371],
      "status": "success",
      "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/geometry/a08e65e7-082a-3ce1-8116-ae534c9f081d.obj"
    , 
      "guid": "61acd067-4637-3549-9bd3-cd362a4fb93b",
      "type": "resource",
      "role": "obj",
      "modelGuid": "f9f4721d-9304-43c4-8c07-34cbcc5e79c7",
      "objectIds": [17, 19, 21, 22, 23, 24, 25, 26, 27, 83, 84, 85, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 263, 264, 265, 268, 269, 270, 302, 303, 304, 320, 321, 322, 350, 351, 352, 370, 371],
      "status": "success",
      "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/geometry/a08e65e7-082a-3ce1-8116-ae534c9f081d.mtl"
    , 
      "guid": "6c73254c-7bbf-312a-a481-aaeebdf53de3",
      "type": "resource",
      "role": "obj",
      "modelGuid": "f9f4721d-9304-43c4-8c07-34cbcc5e79c7",
      "objectIds": [17, 19, 21, 22, 23, 24, 25, 26, 27, 83, 84, 85, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 263, 264, 265, 268, 269, 270, 302, 303, 304, 320, 321, 322, 350, 351, 352, 370, 371],
      "status": "success",
      "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/geometry/a08e65e7-082a-3ce1-8116-ae534c9f081d.zip"
    ]
  ]

【问题讨论】:

【参考方案1】:

使用GET :urn/metadata 获取模型视图列表:


  "data": 
    "type": "metadata",
    "metadata": [
      
        "name": "Scene",
        "role": "3d",
        "guid": "4f981e94-8241-4eaf-b08b-cd337c6b8b1f",
      ,
      
        "name": "Sheet: A101",
        "role": "2d",
        "guid": "8e7c6bca-cfd1-290e-4b16-f3670169bb71"
      
    ]
   

然后使用GET :urn/metadata/:guid 检索对象树以识别您的派生:


  "data": 
    "type": "objects",
    "objects": [
      
        "objectid": 1,
        "name": "A5",
        "objects": [
          
            "objectid": 2,
            "name": "Model",
            "objects": [
              
                "objectid": 3,
                "name": "Bottom",
                "objects": [
                  
                    "objectid": 4,
                    "name": "Box"
                  
                ]
              ,

【讨论】:

你好@Bryan。感谢您的答复。但我正在寻找别的东西。这为我们提供了所有对象 ID 及其名称,如模型树。我正在寻找识别提取的波前目标文件。如果我从一个模型中提取了 2 个目标文件,那么在完成 obj 提取作业后,将添加 6 个文件。 1. 第一个 .obj 2.first.mtl 3.first.zip 4.second.obj 5.second.mtl 6.second.zip。如 JSON 文件所示。现在假设我从一个模型中提取了 10 个不同的目标文件。这意味着在存储桶 30 中将生成新文件 URN。 所以如果我想看看第 9 个目标文件是什么。我没有句柄,因为 GUID 不匹配。 我已经编辑了这个问题。能否请您尽快查看并回复。 如果您共享了整个清单有效负载,那么只有两组 obj/mtl/zip(其余是缩略图和视图),您可以使用 GET :urn/metadata 的名称来识别它们端点或将它们映射到 objectID [547, 924, 942, 977][17, 19, 21 ... 以交叉引用它们的详细信息并找出它们的身份。

以上是关于如何从 Autodesk 模型衍生 API 的响应中识别提取的 obj 文件?的主要内容,如果未能解决你的问题,请参考以下文章

Autodesk 模型衍生翻译作业导致“TranslationWorker-InternalFailure”响应?

Autodesk Forge 模型衍生 API:在 Autodesk Forge 衍生子项中找不到“图形”角色

Autodesk forge 模型衍生测试 API

Autodesk Forge 设计自动化/模型衍生 API - 查看器缓存 svf 文件

模型衍生 API 响应未通过 Jackson 映射

Autodesk Forge 混乱的视图