使用 Autodesk Forge 从 BIM 360 查找项目的 URL 时遇到问题

Posted

技术标签:

【中文标题】使用 Autodesk Forge 从 BIM 360 查找项目的 URL 时遇到问题【英文标题】:Troble finding URN of Item from BIM 360 using Autodesk Forge 【发布时间】:2021-05-21 02:58:27 【问题描述】:

我们的文件在 BIM 360 容器中。我们正在尝试创建使用 BIM360 文件并将其显示在浏览器中的查看器应用程序,Forge 站点中可用于查看器的示例代码在我们的本地环境中运行良好,但我们在同一个应用程序中访问 BIM360 urn 时遇到问题(我们也已经尝试过使用三足身份验证令牌)。您能否指导我们为存储在 BIM360 容器中的文件获取正确的 URN?请在BIM360中找到属于DWG文件的示例URN(我们在查看器应用程序中访问时已转换为base64),请告诉我们它是否正确。

urn:adsk.objects:os.object:wip.dm.prod/7c21a6f0-41c9-42ae-a2b2-4b5741fa4d0c.dwg 瓮:adsk.objects:os.object:wip.dm.prod/9ece42b9-c71c-4a27-90bb-87775f370164.dwg

另请查看商品详情响应json,


    "jsonapi": 
        "version": "1.0"
    ,
    "links": 
        "self": 
            "href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g"
        
    ,
    "data": 
        "type": "items",
        "id": "urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g",
        "attributes": 
            "displayName": "bandra ga.dwg",
            "createTime": "2021-02-16T11:06:47.0000000Z",
            "createUserId": "8DCHNK3XFCM2",
            "createUserName": "VBSL System Integrator",
            "lastModifiedTime": "2021-02-16T11:06:47.0000000Z",
            "lastModifiedUserId": "8DCHNK3XFCM2",
            "lastModifiedUserName": "VBSL System Integrator",
            "hidden": false,
            "reserved": false,
            "extension": 
                "type": "items:autodesk.bim360:File",
                "version": "1.0",
                "schema": 
                    "href": "https://developer.api.autodesk.com/schema/v1/versions/items:autodesk.bim360:File-1.0"
                ,
                "data": 
                    "sourceFileName": "bandra ga.dwg"
                
            
        ,
        "links": 
            "self": 
                "href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g"
            ,
            "webView": 
                "href": "https://docs.b360.autodesk.com/projects/56fded29-645c-44b6-9498-29c0f9517fec/folders/urn%3Aadsk.wipprod%3Afs.folder%3Aco.nPlZOfdwQQiTrkXjS0FVVw/detail/viewer/items/urn%3Aadsk.wipprod%3Adm.lineage%3A1sbrvwIVRJ6J_hnfeVDA2g"
            
        ,
        "relationships": 
            "tip": 
                "data": 
                    "type": "versions",
                    "id": "urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g?version=1"
                ,
                "links": 
                    "related": 
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g/tip"
                    
                
            ,
            "versions": 
                "links": 
                    "related": 
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g/versions"
                    
                
            ,
            "parent": 
                "data": 
                    "type": "folders",
                    "id": "urn:adsk.wipprod:fs.folder:co.nPlZOfdwQQiTrkXjS0FVVw"
                ,
                "links": 
                    "related": 
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g/parent"
                    
                
            ,
            "refs": 
                "links": 
                    "self": 
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g/relationships/refs"
                    ,
                    "related": 
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g/refs"
                    
                
            ,
            "links": 
                "links": 
                    "self": 
                        "href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g/relationships/links"
                    
                
            
        
    ,
    "included": [
        
            "type": "versions",
            "id": "urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g?version=1",
            "attributes": 
                "name": "bandra ga.dwg",
                "displayName": "bandra ga.dwg",
                "createTime": "2021-02-16T11:06:47.0000000Z",
                "createUserId": "8DCHNK3XFCM2",
                "createUserName": "VBSL System Integrator",
                "lastModifiedTime": "2021-02-16T11:08:00.0000000Z",
                "lastModifiedUserId": "8DCHNK3XFCM2",
                "lastModifiedUserName": "VBSL System Integrator",
                "versionNumber": 1,
                "storageSize": 2227450,
                "fileType": "dwg",
                "extension": 
                    "type": "versions:autodesk.bim360:File",
                    "version": "1.0",
                    "schema": 
                        "href": "https://developer.api.autodesk.com/schema/v1/versions/versions:autodesk.bim360:File-1.0"
                    ,
                    "data": 
                        "processState": "PROCESSING_COMPLETE",
                        "extractionState": "SUCCESS",
                        "splittingState": "NOT_SPLIT",
                        "reviewState": "NOT_IN_REVIEW",
                        "revisionDisplayLabel": "1",
                        "sourceFileName": "bandra ga.dwg"
                    
                
            ,
            "links": 
                "self": 
                    "href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/versions/urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g%3Fversion=1"
                ,
                "webView": 
                    "href": "https://docs.b360.autodesk.com/projects/56fded29-645c-44b6-9498-29c0f9517fec/folders/urn%3Aadsk.wipprod%3Afs.folder%3Aco.nPlZOfdwQQiTrkXjS0FVVw/detail/viewer/items/urn%3Aadsk.wipprod%3Afs.file%3Avf.1sbrvwIVRJ6J_hnfeVDA2g%3Fversion%3D1"
                
            ,
            "relationships": 
                "item": 
                    "data": 
                        "type": "items",
                        "id": "urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g"
                    ,
                    "links": 
                        "related": 
                            "href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/versions/urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g%3Fversion=1/item"
                        
                    
                ,
                "links": 
                    "links": 
                        "self": 
                            "href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/versions/urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g%3Fversion=1/relationships/links"
                        
                    
                ,
                "refs": 
                    "links": 
                        "self": 
                            "href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/versions/urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g%3Fversion=1/relationships/refs"
                        ,
                        "related": 
                            "href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/versions/urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g%3Fversion=1/refs"
                        
                    
                ,
                "downloadFormats": 
                    "links": 
                        "related": 
                            "href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/versions/urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g%3Fversion=1/downloadFormats"
                        
                    
                ,
                "derivatives": 
                    "data": 
                        "type": "derivatives",
                        "id": "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjFzYnJ2d0lWUko2Sl9obmZlVkRBMmc_dmVyc2lvbj0x"
                    ,
                    "meta": 
                        "link": 
                            "href": "https://developer.api.autodesk.com/modelderivative/v2/designdata/dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjFzYnJ2d0lWUko2Sl9obmZlVkRBMmc_dmVyc2lvbj0x/manifest?scopes=b360project.56fded29-645c-44b6-9498-29c0f9517fec,O2tenant.5902118"
                        
                    
                ,
                "thumbnails": 
                    "data": 
                        "type": "thumbnails",
                        "id": "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjFzYnJ2d0lWUko2Sl9obmZlVkRBMmc_dmVyc2lvbj0x"
                    ,
                    "meta": 
                        "link": 
                            "href": "https://developer.api.autodesk.com/modelderivative/v2/designdata/dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjFzYnJ2d0lWUko2Sl9obmZlVkRBMmc_dmVyc2lvbj0x/thumbnail?scopes=b360project.56fded29-645c-44b6-9498-29c0f9517fec,O2tenant.5902118"
                        
                    
                ,
                "storage": 
                    "data": 
                        "type": "objects",
                        "id": "urn:adsk.objects:os.object:wip.dm.prod/9ece42b9-c71c-4a27-90bb-87775f370164.dwg"
                    ,
                    "meta": 
                        "link": 
                            "href": "https://developer.api.autodesk.com/oss/v2/buckets/wip.dm.prod/objects/9ece42b9-c71c-4a27-90bb-87775f370164.dwg?scopes=b360project.56fded29-645c-44b6-9498-29c0f9517fec,O2tenant.5902118"
                        
                    
                
            
        
    ]

【问题讨论】:

【参考方案1】:

在这里:dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjFzYnJ2d0lWUko2Sl9obmZlVkRBMmc_dmVyc2lvbj0x

"derivatives": 
    "data": 
        "type": "derivatives",
        "id": "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjFzYnJ2d0lWUko2Sl9obmZlVkRBMmc_dmVyc2lvbj0x"
    ,
    "meta": 
        "link": 
            "href": "https://developer.api.autodesk.com/modelderivative/v2/designdata/dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjFzYnJ2d0lWUko2Sl9obmZlVkRBMmc_dmVyc2lvbj0x/manifest?scopes=b360project.56fded29-645c-44b6-9498-29c0f9517fec,O2tenant.5902118"
        
    
,

【讨论】:

非常感谢,对我很有帮助 我还有一个问题,请告诉我是否可以在查看器中添加谷歌地图,然后在其上添加 3d 模型?有人做过吗?【参考方案2】:

要获取项目的存储位置(在您的情况下为urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g),请使用 FORGE_HOST/data/v1/projects/ 查询项目的提示(最新版本)的数据:project/items/:item/tip (在您的情况下,您可以简单地将 /tip 添加到您的 .links.self.href 中,即。@ 987654323@.

这将返回项目最新版本的详细信息 (docs)。

在那里,你应该找到data.relationships.storage.data.id,这是储物箱。

【讨论】:

以上是关于使用 Autodesk Forge 从 BIM 360 查找项目的 URL 时遇到问题的主要内容,如果未能解决你的问题,请参考以下文章

Autodesk Forge:模型比较(BIM 360 功能)

尝试在 Autodesk Forge / Bim360 中显示房间信息

是否可以使用 Autodesk forge 识别 BIM 模型的内部和外部元素?

Autodesk Forge BIM 360 API - 激活服务类型

Autodesk Forge:如何在 BIM 360 Docs 中查找模型的 svf 文件的 URL

Autodesk Forge - 将文件作为块上传到 Node JS 中的 BIM 360 存储时出现 504 网关超时