簡體   English   中英

如何查找 Revit 模型的雲項目 ID?

[英]How to find cloud Item id of a Revit model?

在我們的解決方案中,我們需要 Revit 模型與其在雲中的存在(BIM 360/Autodesk Construction Cloud)之間的參考。

在 Revit 中,我們打開一個雲模型或將模型保存到雲(另存為雲模型)。 rvt 文件顯然“知道”它在雲中的位置,但我看不到從文件中提取該信息的方法。 因此,挑戰是在雲中找到文件 Item id。

目前我們做了以下工作:

從 Revit 文檔我們得到

  • CloudProjectName(從 Revit api Document.GetCloudModelPath() 中提取)
  • ModelGuid (Revit api Document.GetModelGUID())

然后...

  1. 獲取用戶的帳戶(Forge Datamanagement API https://developer.api.autodesk.com/project/v1/hubs
  2. 對於每個帳戶:遍歷項目以查找具有指定名稱的項目。 (偽造數據管理 API https://developer.api.autodesk.com/project/v1/hubs/:hub_id/projects
  3. 如果找到項目:在項目中搜索根文件夾以查找具有指定 ModelGuid 的文件(Forge Datamanagement API https://developer.api.autodesk.com/data/v1/projects/:project_id/folders/:folder_id/search?filter[ attributes.extension.data.modelGuid]={ModelGuid} )
  4. 如果找到 1 個或多個文件:選擇“原始”文件。 (relationships.item.data.id == attributes.extension.data.originalItemUrn)

(我們不關心雲模型版本)。

這確實有效,除了第 3 步可能有點棘手。 從模型上傳到雲端需要幾分鍾,也許幾個小時,直到可以進行搜索,這很煩人。

所以這里有兩個問題:

  1. 有沒有更好/更簡單的方法來查找文件的雲項目 ID?
  2. 是否有替代“搜索”調用(第 3 步)或至少某種說明何時可以獲得結果的文檔?

你的方法有點復雜,我一看就看不懂。 沒有試圖達到同樣的自己。 無論如何,The Building Coder 討論了如何確定雲模型本地文件路徑並提到了一些與您類似的步驟。 也許這可以提供一些進一步的提示。 在此處搜索Revit 模型雲會發現許多其他相關主題。

使用ModelPath方法GetModelGUIDGetProjectGUID 您可以從模型“向后”並沿着樹向上移動,直到您點擊項目文件或項目頂部文件夾。 如果用戶沒有完全可見性,則特定用戶可能無法訪問父文件夾。 GET projects/:project_id/items/:item_id/parent下閱讀更多內容。

您使用的是哪個 Revit 版本? 如果是 Revit 2022,最新 SDK 2022 中的新 API Document.GetCloudModelUrn() 應該是您正在尋找的,並且它還提供了以下雲信息 API:

獲取模型的 Forge ID 這些方法允許您識別雲模型的 Forge ID:

Document.GetHubId(): ForgeDM hub id where the model is located
Document.GetProjectId(): ForgeDM project id where the model is located
Document.GetCloudFolderId(bool forceRefresh): ForgeDM folder id where the model is located
Document.GetCloudModelUrn(): A ForgeDM Urn identifying the model They return strings which will be empty for a document which is not a cloud model.

https://help.autodesk.com/view/RVT/2022/ENU/?guid=Revit_API_Revit_API_Developers_Guide_Introduction_Application_and_Document_CloudFiles_htmlhttps://www.revitapidocs.com/2022/7c2bced8-b309-b89-b309-b89-b309-b89-c320tm 上查看詳細信息

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM