如何使用 Forge AutoDesk API 从 2d .dwg 文件获取元数据?
How do I get metadata from a 2d .dwg file using Forge AutoDesk APIs?
我使用 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"
}
]
}
]
}
]
}
EDIT 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"
}
]
}
]
}
]
}
不幸的是,获取元数据对于 2D 文档尚不可行。已记录为愿望,将由开发团队实施。
很遗憾,我们无法为您提供关于 it.Sorry 坏消息的估计。
我能想到的解决方法是在查看器中加载 2D 文档并获取其属性。否则,您将需要下载下面提取示例公开的所有可视项,然后对随附的 sqlite db 文件进行逆向工程以查找这些属性。
我使用 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"
}
]
}
]
}
]
}
EDIT 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"
}
]
}
]
}
]
}
不幸的是,获取元数据对于 2D 文档尚不可行。已记录为愿望,将由开发团队实施。
很遗憾,我们无法为您提供关于 it.Sorry 坏消息的估计。
我能想到的解决方法是在查看器中加载 2D 文档并获取其属性。否则,您将需要下载下面提取示例公开的所有可视项,然后对随附的 sqlite db 文件进行逆向工程以查找这些属性。