Revit无法链接ACC‘Consumed’文件夹模型的权限问题排查
问题
我用pyRevit编写了脚本,借助Autodesk Data Management API从ACC获取Model Guid,以程序化方式将云模型链接至Revit文件。我拥有项目中心(project hub)的Admin权限,可成功链接大部分模型,但无法链接通过Design Collaboration导入到项目文件夹的Consumed类模型。
报错信息:
You are unauthorized to access this hub/project or the hub/project doesn't exist.
Haven't found the cloud model. Please check if your cloud folder is accessible and if the model exists or not.
脚本中获取Guid的相关代码片段:
def link_cloud_model(project_id, model_id): """Links a cloud model by shared coordinates""" # Convert Ids to GUIDs project_guid = System.Guid(project_id) model_guid = System.Guid(model_id) # Get Cloud Path cloud_path = ModelPathUtils.ConvertCloudGUIDsToCloudPath( "US", project_guid, model_guid ) # Link the Model and create a link instance link_options = RevitLinkOptions(False) link_type = RevitLinkType.Create(doc, cloud_path, link_options) link_instance = RevitLinkInstance.Create( doc, link_type.ElementId, ImportPlacement.Shared ) def get_tip_version_data(project_id, selected_file_ids): """Gets the tip version or latest version of a list of ACC files""" model_data = [] for item_id in selected_file_ids: target_uri = f"https://developer.api.autodesk.com/data/v1/projects/{project_id}/items/{item_id}/tip" tip_version_data = requests.get(target_uri, headers=headers) model_data.append(tip_version_data.json()) return json.dumps(model_data) def main(): # Fetching the tip data for a list of projects from ACC model_metadata = get_tip_version_data(project_id, project_files) # Fetch the Guid from the JSON object for model in model_metadata: id_path = model["data"]["attributes"]["extension"]["data"] model_id = id_path["modelGuid"] project_id = id_path["projectGuid"] transaction.Start("Link Cloud Model") link_cloud_model(project_id, model_id) transaction.Commit()
我曾推测问题源于外部文件导入的Shared文件夹权限不足,为此给自己设置了Edit权限,但问题仍未解决。请问是否需要最初共享包的顾问为我提供其项目中心的Edit或Manage权限,才能完成模型链接?
解答
- Consumed模型的权限特殊性:通过Design Collaboration导入的Consumed模型本质归属外部协作方的源项目,你当前的Admin权限仅覆盖自身项目中心,对协作方的源项目无访问权限。即便你在本地项目的Shared文件夹拥有Edit权限,也无法直接访问源项目的模型核心数据。
- 所需权限说明:确实需要协作方在他们的项目中心为你分配至少Edit权限(Manage权限更稳妥),这样你的账号才能通过API合法获取源项目的模型Guid并建立有效链接。
- 额外排查要点:
- 确认脚本中获取的
projectGuid是协作方的源项目ID,而非你本地项目的ID。Consumed模型的projectGuid指向原始项目,而非导入后的本地项目,这是高频错误点。 - 检查API请求的
headers是否包含正确权限范围(需覆盖data:read和data:write),确保能访问协作方项目数据。 - 先手动在Revit中尝试链接该Consumed模型:如果手动操作也失败,可确认是权限问题;如果手动能成功,需排查脚本中
projectGuid或modelGuid的获取逻辑是否有误。
- 确认脚本中获取的
内容的提问来源于stack exchange,提问作者Gokul Easwaran
相关产品推荐
相关产品推荐

