英文:
design-automation for Revit Autodesk.Revit.Exceptions.RevitServerUnauthenticatedUserException
问题
I'm working with Design Automation using Postman. After posting a work item, I get an error regarding the SaveAsCloudModel()
function. I tested this as a plugin for Revit, and it works fine, but now it's in Design Automation.
Any idea why I'm getting this error message:
Autodesk.Revit.Exceptions.RevitServerUnauthenticatedUserException: You must sign in to Autodesk 360 in order to complete this action. at Autodesk.Revit.DB.Document.SaveAsCloudModel(Guid accountId, Guid projectId, String folderId, String modelName)
The parameters provided work and are included in the C# code, and they have been shown to work within the Revit API as a plugin. The issue seems to be with Design Automation.
Activity post:
{
"id": "SaveModelTestActivity8",
"commandLine": ["$(engine.path)\\\\revitcoreconsole.exe /i \"$(args[rvtFile].path)\" /al \"$(appbundles[SaveModelTest8].path)\""],
"parameters": {
"rvtFile": {
"zip": false,
"ondemand": false,
"verb": "get",
"description": "Input Revit model",
"required": true,
"localName": "$(rvtFile)"
},
"result": {
"zip": false,
"ondemand": false,
"verb": "put",
"description": "Results",
"required": true,
"localName": "result.rvt"
}
},
"engine": "Autodesk.Revit+2022",
"appbundles": ["SAVE_CLOUD_MODEL.SaveModelTest8+current"],
"description": "Save Revit model"
}
Work Item Post:
{
"activityId": "SAVE_CLOUD_MODEL.SaveModelTestActivity8+current",
"arguments": {
"rvtFile": {
"url": "https://cdn.us.oss.api.autodesk.com/oss/v2/signedresources/372091ac-8274-4187-95f0-22414d21c9f2?region=US",
"pathInZip": "MYFILE.rvt"
},
"result": {
"verb": "put",
"url": "https://cdn.us.oss.api.autodesk.com/oss/v2/signedresources/372091ac-8274-4187-95f0-22414d21c9f2?region=US"
}
}
}
I tried looking up more documentation on the error but struggled to find resources regarding this error within Design Automation. My goal is to use SaveAsCloudModel()
to save a cloud-shared model to BIM360 as part of our project creation automation. We already have the folder process figured out; we just need to get the cloud-shared model in place.
- Default Top Folder
- Folder
- Folder
- project.rvt
英文:
I'm working with Design Automation using Postman. After posting work item I get an error regarding the SaveAsCloudModel() function. I tested this as a plugin for Revit and it works fine, now it's a Design Automation.
Any idea why I'm getting: Autodesk.Revit.Exceptions.RevitServerUnauthenticatedUserException: You must sign in to Autodesk 360 in order to complete this action. at Autodesk.Revit.DB.Document.SaveAsCloudModel(Guid accountId, Guid projectId, String folderId, String modelName)
The parameters provided work and are provided inside the C# code and has shown to work inside of Revit API as plugin. Just issue with DA.
Activity post:
{
"id":"SaveModelTestActivity8",
"commandLine": [ "$(engine.path)\\\\revitcoreconsole.exe /i \"$(args[rvtFile].path)\" /al \"$(appbundles[SaveModelTest8].path)\"" ],
"parameters": {
"rvtFile": {
"zip": false,
"ondemand": false,
"verb": "get",
"description": "Input Revit model",
"required": true,
"localName": "$(rvtFile)"
},
"result": {
"zip": false,
"ondemand": false,
"verb": "put",
"description": "Results",
"required": true,
"localName": "result.rvt"
}
},
"engine": "Autodesk.Revit+2022",
"appbundles": [ "SAVE_CLOUD_MODEL.SaveModelTest8+current" ],
"description": "Save revit model"
}
Work Item Post:
{
"activityId": "SAVE_CLOUD_MODEL.SaveModelTestActivity8+current",
"arguments": {
"rvtFile": {
"url": "https://cdn.us.oss.api.autodesk.com/oss/v2/signedresources/372091ac-8274-4187-95f0-22414d21c9f2?region=US",
"pathInZip": "MYFILE.rvt"
},
"result": {
"verb": "put",
"url": "https://cdn.us.oss.api.autodesk.com/oss/v2/signedresources/372091ac-8274-4187-95f0-22414d21c9f2?region=US"
}
}
}
I tried looking up more documentation on the error, and struggling to find resources regarding this error inside of design automation. I'm expecting to use the SaveAsCloudModel(). Ultimately I want to be able to save a cloud share model to BIM360, as part of our project creation automation. We create folders with a default naming convention and structure where we want to also publish a model into that folder. We already have the folder process figured out, just need to get the cloud share model in place.
-Default Top Folder
-Folder
-Folder
-project.rvt
答案1
得分: 1
这是你的桌面版本可用,因为你已登录并且可以访问 Hub / 项目文件夹。如果你从右上角的小部件注销,你将遇到相同的异常。
同样,在你的工作项发布中,你需要将用户上下文传递给用于 Revit 的设计自动化。可以通过在工作项调用中添加 adsk3LeggedToken
argument
来实现这一点。这是一个特殊的参数,不需要在活动中定义相应的 parameter
。
在这个 博客 中可以阅读更多详细信息。
作为示例,请参阅以下内容:
{
"activityId": "SAVE_CLOUD_MODEL.SaveModelTestActivity8+current",
"arguments": {
"rvtFile": {
"url": "workingurldownload",
"pathInZip": "XXXXX_JLG Revit2021 Starter File_A_detached.rvt",
},
"result": {
"verb": "put",
"url": "outputurl"
},
"adsk3LeggedToken": "token"
}
}
英文:
It works on your desktop version because you are logged in and you have access to the Hub / Project folder. If you log out from the widget in top right corner you would have the same exception.
Similarly, in your workitem post you need to pass on the user context to Design Automation for Revit. This can be done adding adsk3LeggedToken
argument
to the workitem call. This is a special argument that does not require corresponding parameter
defined at the activity.
Read more details in this blog.
As an example see here:
{
"activityId": "SAVE_CLOUD_MODEL.SaveModelTestActivity8+current",
"arguments": {
"rvtFile": {
"url": "workingurldownload",
"pathInZip": "XXXXX_JLG Revit2021 Starter File_A_detached.rvt",
},
"result": {
"verb": "put",
"url": "outputurl"
}
"adsk3LeggedToken": "token"
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论