如何使用Forge AutoDesk API从2d .dwg文件中获取元数据?

时间:2017-03-22 15:52:07

标签: autocad cad autodesk-forge dwg

我使用Forge AutoDesk数据管理,设计管理和模型查看器API来上传我的.dmg,将其转换为svf然后使用元数据。它适用于3D设计,但在使用2D设计时,元数据中似乎没有guid。有什么我做错了吗?

修改 我可以获得清单,但是当我获取相同的元数据时,它会给出一个空数组。

{
  "type": "manifest",
  "hasThumbnail": "true",
  "status": "success",
  "progress": "complete",
  "region": "US",
  "urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS8xMTI2LmR3Zw",
  "version": "1.0",
  "derivatives": [
       {
          "name": "1126.dwg",
          "hasThumbnail": "true",
          "status": "success",
          "progress": "complete",
          "messages": [
              {
                 "type": "warning",
                 "code": "AutoCAD-MissingReference",
                 "message": [
                     "Missing reference\nOne reference was not uploaded so the drawing may not be fully displayed.\n- Please upload the composite design with the missing referenced file: {0}",
                     "\\\\Aa-6246410c0eaa\\LG(D)\\nitin\\materials\\RCS-9-03\\DSCN9763.JPG"]
              }
  ],
  "outputType": "svf",
  "children": [
    {
      "guid": "6882be48-6626-5238-d3df-94e9f0a0019d",
      "name": "2D View",
      "hasThumbnail": "true",
      "role": "2d",
      "viewableID": "Model",
      "progress": "complete",
      "status": "success",
      "type": "geometry",
      "children": [
        {
          "guid": "723799fd-39bd-e421-d62e-442878941b21",
          "role": "thumbnail",
          "mime": "image/png",
          "resolution": [
            100,
            56
          ],
          "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS8xMTI2LmR3Zw/output/1126-Model_100.png",
          "status": "success",
          "type": "resource"
        },
        {
          "guid": "8bd323a6-b1be-26a2-b486-590ea29d51f8",
          "role": "thumbnail",
          "mime": "image/png",
          "resolution": [
            200,
            113
          ],
          "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS8xMTI2LmR3Zw/output/1126-Model_200.png",
          "status": "success",
          "type": "resource"
        },
        {
          "guid": "7395d92b-3098-ceae-46b9-6e008775b99b",
          "role": "thumbnail",
          "mime": "image/png",
          "resolution": [
            400,
            226
          ],
          "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS8xMTI2LmR3Zw/output/1126-Model_400.png",
          "status": "success",
          "type": "resource"
        },
        {
          "guid": "ca2b3fe1-6688-21e6-8936-aff2e362caad",
          "role": "graphics",
          "mime": "application/autodesk-f2d",
          "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS8xMTI2LmR3Zw/output/5f187141-7458-ca76-6ed8-405d67eed186_f2d/primaryGraphics.f2d",
          "status": "success",
          "type": "resource"
        }
      ]
    },
    {
      "guid": "9c7ee634-2c29-0bca-24c4-a43eb97eaf8b",
      "name": "Layout1",
      "hasThumbnail": "true",
      "role": "2d",
      "viewableID": "Layout1",
      "progress": "complete",
      "status": "success",
      "type": "geometry",
      "children": [
        {
          "guid": "74b8925c-0a51-00a0-eeef-554c2e12bc2e",
          "role": "thumbnail",
          "mime": "image/png",
          "resolution": [
            100,
            64
          ],
          "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS8xMTI2LmR3Zw/output/1126-Layout1_100.png",
          "status": "success",
          "type": "resource"
        },
        {
          "guid": "4ffd2d29-9837-fd12-1e97-d21fec6bdf53",
          "role": "thumbnail",
          "mime": "image/png",
          "resolution": [
            200,
            129
          ],
          "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS8xMTI2LmR3Zw/output/1126-Layout1_200.png",
          "status": "success",
          "type": "resource"
        },
        {
          "guid": "c36ed9e4-4a15-c887-f7b5-f5677533f9d5",
          "role": "thumbnail",
          "mime": "image/png",
          "resolution": [
            400,
            258
          ],
          "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS8xMTI2LmR3Zw/output/1126-Layout1_400.png",
          "status": "success",
          "type": "resource"
        },
        {
          "guid": "b0683c33-2116-2202-cdf2-2b61684fc432",
          "role": "graphics",
          "mime": "application/autodesk-f2d",
          "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS8xMTI2LmR3Zw/output/ee27dd79-d97f-be8c-a4c5-aefef3f41fcf_f2d/primaryGraphics.f2d",
          "status": "success",
          "type": "resource"
        }
       ]
      }
     ]
    }
   ]
  }

编辑 2 在转换其他一些dwg文件时,我在响应正文中将此消息作为警告,这也是我无法获取的原因元数据?

    {
      "type": "manifest",
      "hasThumbnail": "true",
      "status": "success",
      "progress": "complete",
      "region": "US",
      "urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS9jYXNhMi5kd2c",
      "version": "1.0",
      "derivatives": [
          {
            "name": "casa2.dwg",
            "hasThumbnail": "true",
            "status": "success",
            "progress": "complete",
            "messages": [
               {
                  "type": "warning",
                  "code": "AutoCAD-MissingReferences",
                  "message": [
                                "Missing references\nSome references were not uploaded so the drawing may not be fully displayed.\n- Please upload the composite design with all the missing referenced files: {0}","C:\\Documents and Settings\\Edel II\\Desktop\\094 CASAS HACIENDA LA CONCEPCION\\160 m2\\FACHADA 1.jpg, \\\\SERVIDORBA\\Servidor_BA\\BA\\000 Proyectos\\094 CASAS HACIENDA LA CONCEPCION\\140 m2\\PLANTA ALTA.jpg, \\\\SERVIDORBA\\Servidor_BA\\BA\\000 Proyectos\\094 CASAS HACIENDA LA CONCEPCION\\160 m2\\PLANTA ALTA.jpg, \\\\SERVIDORBA\\Servidor_BA\\BA\\000 Proyectos\\094 CASAS HACIENDA LA CONCEPCION\\160 m2\\PLANTA BAJA.jpg, \\\\SERVIDORBA\\Servidor_BA\\BA\\000 Proyectos\\094 CASAS HACIENDA LA CONCEPCION\\140 m2\\PLANTA BAJA.jpg"
            ]
         }
      ],
      "outputType": "svf",
      "children": [
        {
          "guid": "6882be48-6626-5238-d3df-94e9f0a0019d",
          "name": "2D View",
          "hasThumbnail": "true",
          "role": "2d",
          "viewableID": "Model",
          "progress": "complete",
          "status": "success",
          "type": "geometry",
          "children": [
             {
               "guid": "a544946a-154f-0bc4-1dd2-43c67dfc07f6",
               "role": "thumbnail",
               "mime": "image/png",
               "resolution": [
                   100,
                   100
                ],
               "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS9jYXNhMi5kd2c/output/casa2-Model_100.png",
              "status": "success",
              "type": "resource"
           },
           {
             "guid": "f277d222-695f-0ff7-2a69-d64eaf68c6f8",
             "role": "thumbnail",
             "mime": "image/png",
             "resolution": [
                200,
                200
              ],
             "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS9jYXNhMi5kd2c/output/casa2-Model_200.png",
             "status": "success",
             "type": "resource"
           },
           {
             "guid": "4e826d98-15f2-c33d-e466-955e9016ffc4",
             "role": "thumbnail",
             "mime": "image/png",
             "resolution": [
                 400,
                 400
              ],
             "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS9jYXNhMi5kd2c/output/casa2-Model_400.png",
             "status": "success",
             "type": "resource"
           },
           {
             "guid": "42aef4c1-c306-07b1-928b-5ae7b60121e9",
             "role": "graphics",
             "mime": "application/autodesk-f2d",
             "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS9jYXNhMi5kd2c/output/d77efc26-d4ab-8843-2499-2b863dedd9b8_f2d/primaryGraphics.f2d",
             "status": "success",
             "type": "resource"
           }
         ]
       },
       {
         "guid": "9c7ee634-2c29-0bca-24c4-a43eb97eaf8b",
         "name": "Layout1",
         "hasThumbnail": "true",
         "role": "2d",
         "viewableID": "Layout1",
         "progress": "complete",
         "status": "success",
         "type": "geometry",
         "children": [
            {
              "guid": "300c4a29-4b14-3be7-72f6-935a8fdf502f",
              "role": "thumbnail",
              "mime": "image/png",
              "resolution": [
                  100,
                  100
              ],
              "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS9jYXNhMi5kd2c/output/casa2-Layout1_100.png",
              "status": "success",
              "type": "resource"
           },
           {
              "guid": "9760574f-0493-f082-9cc3-1412a5a15a11",
              "role": "thumbnail",
              "mime": "image/png",
              "resolution": [
                  200,
                  200
               ],
              "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS9jYXNhMi5kd2c/output/casa2-Layout1_200.png",
              "status": "success",
              "type": "resource"
           },
           {
              "guid": "565ec6a9-11b5-269c-faf6-e2eb502fd382",
              "role": "thumbnail",
              "mime": "image/png",
              "resolution": [
                    400,
                    400
               ],
              "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS9jYXNhMi5kd2c/output/casa2-Layout1_400.png",
              "status": "success",
              "type": "resource"
            },
            {
             "guid": "d8ab5cb1-76ea-6fc7-074c-d1c9d68da110",
             "role": "graphics",
             "mime": "application/autodesk-f2d",
             "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGFkYXNkc2FkYS9jYXNhMi5kd2c/output/caa83ac1-64a6-dbd7-8277-03d949efbaf7_f2d/primaryGraphics.f2d",
             "status": "success",
             "type": "resource"
           }
          ]
         }
       ]
     }
   ]
 }

1 个答案:

答案 0 :(得分:0)

遗憾的是,无法获取2D文档的元数据。这已被记录为愿望,并将由开发团队实施。

不幸的是我们不能给你一个关于它的估计。请听坏消息。

我能想到的解决方法是在查看器中加载2D文档并获取其属性。否则,您需要下载下面的提取示例公开的所有可视对象,然后对出现的sqlite db文件进行反向工程以查找这些属性。

https://extract.autodesk.io