1

I was using the Forge AutoDesk Data management, design management and model viewer APIs to upload my .dmg, convert it to svf and then using the metadata. It works well for 3D designs but there seems to no guid inside the metadata when I use 2D designs. Is there something I am doing wrong?

EDIT: I can get the manifest alright, but when I fetch the metadata for the same, it gives an empty array.

{
  "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"
        }
       ]
      }
     ]
    }
   ]
  }

EDIT 2 In converting some other dwg file, I got this message as a warning in the response body, can this also be a reason I am unable to get the metadata?

    {
      "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"
           }
          ]
         }
       ]
     }
   ]
 }
alpheus
  • 240
  • 1
  • 12

1 Answers1

0

Getting metadata is not yet doable for 2D documents unfortunately. This has been logged as a wish and will be implemented by the development team.

Unfortunately we cannot give you an estimate about it.Sorry for the bad news.

The workarounds I can think of would be to load the 2D document in the viewer and grab its properties. Otherwise you would need to download all viewables as exposed by the extract sample below, then reverse-engineer the sqlite db file that comes along to find those properties.

https://extract.autodesk.io

Felipe
  • 4,325
  • 1
  • 14
  • 19
  • Thanks, I was able to get the .db file and view the data although it looks like some of might have been lost in translation - is it possible ? Also, by loading the document in the viewer (do you mean autocad?) and how can I grab the properties from the viewer ? – alpheus Mar 26 '17 at 15:08
  • I meant the viewer not AutoCAD, but it depends your workflow. Once you loaded a 2D drawing in the viewer you can access each component properties using viewer.getProperties(nodeId, ...) – Felipe Mar 26 '17 at 15:47
  • Depends what you mean by "lost" ... some properties might not be extracted from the original CAD file, for example XData on AutoCAD entities – Felipe Mar 26 '17 at 15:48
  • I used my own viewer but the thing is that when I do get properties on any dbIndex, it always returns an empty properties array, even though via the toolbar - when I click on specific object - and find its properties , it does give me correct dimensions, any clues? – alpheus Mar 27 '17 at 07:41
  • also, now I get an error when I try to access the properties when using this line `var instanceTree = viewer.model.getData().instanceTree` - that instanceTree is undefined - when I check the object `viewer.model.getData()` it doesn't have any key by that name - it was working fine until a few minutes ago. – alpheus Mar 27 '17 at 10:12
  • Can you provide a sample document so we can test that on our side? You can send an email to forge.help@autodesk.com if you want to keep your document private. Thanks – Felipe Mar 27 '17 at 20:55
  • Here is the dwg https://mega.nz/#!uBNnkQDA!mMUK48kzTTRPtw-ykA1FW5-QmdHQ9zdqp2G0K-hJ_Vk – alpheus Mar 28 '17 at 05:38
  • were you able to find out the problem? – alpheus Apr 01 '17 at 04:36
  • This document has 2 viewable path: a 2d and a 3d, the 2d views have no instance tree, maybe you are looking for loading the 3d view? You can give it a try there, you will see both views: https://a360.autodesk.com/viewer – Felipe Apr 02 '17 at 22:52
  • Here is an example that illustrates how to get all path from a loaded document, it is written in ES6, so you may have to adapt a bit the code: https://github.com/Autodesk-Forge/forge-rcdb.nodejs/blob/master/src/client/viewer.components/Viewer.Toolkit/Viewer.Toolkit.js#L93 – Felipe Apr 02 '17 at 22:55
  • You can also check that tutorial that shows how to use the ViewingApplication: an API wrapper around the viewer that can load different path in a document: https://developer.autodesk.com/en/docs/viewer/v2/tutorials/basic-application/ – Felipe Apr 02 '17 at 22:56
  • i was able to view all the dbIds, but was only getting properties array for one of them. On forge, model derivative and data management api docs I could not find the documentation for `Autodesk.Viewing.Private.GuiViewer3D`. What I need is exact same thing as what the properties button does, when clicking on some part but I don't want to click on the part of drawing instead I would like to obtain all such properties by writing some piece of code. Please tell me if it makes sense. Thanks – alpheus Apr 03 '17 at 13:42
  • There is NO WAY you can get properties for 2D dwg at the moment using the model derivatives rest API. By loading the dwg in the viewer, you can do viewer.model.getProperties(dbId, callback). The API for GuiViewer3D is the same than Viewer3D. Hope that helps. – Felipe Apr 03 '17 at 16:18
  • Thanks I will try that – alpheus Apr 03 '17 at 16:48
  • @PhilippeLeefsma, We are also in the same position, is it still not possible to get the metadata of 2D dwg files? In order to build an workflow application, I need to extract some text information from the 2D dwg file. Though there are workarounds, they are very hard to understand and implement. – Thangadurai Jan 29 '18 at 08:02