Downloading a Model Derivative from BIM 360 - autodesk-forge

I have a file hosted on BIM 360 with different versions. I retrieved the latest version's URN, translated to Base64 URL safe, and posted a model derivative job to translate to IFC. This URN does not have padding, but it does contain an underscore where the / character used to be. If I check the manifest of the version, it shows the derivative URN:
{
"urn": <source_urn>,
"derivatives":[
...
{
"children": [{
"urn": "urn:adsk.viewing:fs.file<source_urn>/output/Resource/IFC/rme_advanced_sample_project.ifc",
"role":"ifc","mime":"application/vnd.autodesk.cad",
"guid":<guid>,
"type":"resource","status":"success"
}],
"progress":"complete",
"outputType":"ifc",
"status":"success"
}],
"hasThumbnail":"true",
"progress":"complete",
"type":"manifest",
"region":"US",
"version":"1.0",
"status":"success"
}
If I try to download the model using <source_urn> and
urn:adsk.viewing:fs.file<source_urn>/output/Resource/IFC/rme_advanced_sample_project.ifc (I converted it into a URI safe format using encodeURIComponent), I get the following error:
{
statusCode: 400,
statusMessage: 'Bad Request',
statusBody: { diagnostic: 'The requested derivative urn is invalid.' }
}

Related

Autodesk Construction Cloud API unavailable endpoints

Our team is working with Autodesk Construction Cloud and it's Docs module quite heavily. Because of that we're trying to develop some internal tools which would automate some work that they do, mostly around copying files.
In ACC Docs you can easily copy files from one folder to another. From our investigation it looks like the ACC internally uses an endpoint like this to copy the files:
https://developer.api.autodesk.com/dm/v3/projects/{{projectId}}/documents:copy?targetFolder={{targetFolder}}
By using the authentication token from ACC requests (obtained from the browser), we can easily use this call from Postman or even an AWS Lambda function. But when we're using the auth tokens obtained from 3-legged auth process as described in the documentation, the same API call fails.
Is it even possible right now to obtain an auth token which works with that endpoint for copying ACC Docs files? Or is this not available right now as this API is still not really "public"?
Happy New Year!
Those APIs are internal APIs. Please do not try to use them. even if it may work, you would use it on your own risk..
Regarding with copy files files from one folder to the other, you can use the public API. After you get the version urn of the original file, call the endpoint below with the parameter
POST https://developer.api.autodesk.com/data/v1/projects/{PROJECT_ID}/items?copyFrom=urn%3Aadsk.wipprod%3Afs.file%3Avf.rH_L4XJsTmeiYA4ixCVNAA%3Fversion%3D1
with the payload, in which specify the target folder.
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "items",
"relationships": {
"tip":{
"data":{
"type":"versions",
"id":"1"
}
},
"parent": {
"data": {
"type": "folders",
"id": "urn:adsk.wipprod:fs.folder:co.0xaYa2rVTJuFiz7rxLCOQQ"
//!<<< The folder we want to put this file
}
}
}
},
"included":[
{
"type":"versions",
"id":"1",
"attributes":{
"name":"rac_basic_sample_project.rvt" //!<<< Version name
}
}
]
}

Autodesk Forge Viewer is not rendering SVF derived from IFC

IFC model has been uploaded and translated to SVF.
the problem is reproduced on https://autodesk-forge.github.io/forge-tutorial-postman/display_svf.html. The viewer is rendering forge logo indefinitely. The console shows an error:
"TypeError: undefined is not an object (evaluating 't.children.length')"
We are experiencing this since Tuesday, 26 Oct, 2022 06:45 AM (GMT).
This is the body of the Translate Job Post API:
{
"input": {
"urn": "{{t4_ossEncodedSourceFileURN}}"
},
"output": {
"formats": [
{
"type": "svf",
"views": [
"2d", "3d"
],
"advanced": {
"conversionMethod": "modern",
"buildingStoreys": "show",
"spaces": "show",
"openingElements" : "show"
}
}
]
}
}
The same model is successfully presented when translated to SVF2.
We tested this executing multiple scenarios using multiple models.
Using postman collections, both versions with signedcookies and without show the same behavior.
In our system , we are translating models to SVF and downloading derivatives to serve those from our own servers. The same behavior is noticed there. We are using forge-server-utils version 8.3.4 for download
Also, vscode-forge-tools Visual Studio Code extension shows the same behavior.
Models translated before the date indicated above are rendered correctly.
Kindly asking for help, this has a big impact on our service.

Error while trying to Display an SVF from a BIM 360 URN

I'm trying to display a revit model stored in BIM 360 using the code example from this repository: https://github.com/Autodesk-Forge/forge-tutorial-postman/blob/master/docs/display_svf.html
In this html file I only need to give my access token and the URN (encoded). This works if my model is uploaded from a bucket I had created, but I'm getting an Failed fetching Forge manifest error when I try to do it from an URN that I got from a BIM 360 document.
These are the steps I'm taking:
Getting the document URN
I used this endpoint https://developer.api.autodesk.com/data/v1/projects/b.ef7b0d22-8480-40d6-9749-12e5d7192ac9/folders/urn:adsk.wipprod:fs.folder:co.nAdJ4fwLRRuGem-qpDIlTA/contents
And from the results I get my urn:
Encode the URN
After that I got to https://www.base64encode.org/ and encode the value
urn:adsk.objects:os.object:wip.dm.prod/ac9e8b48-4a51-4f6a-a7e4-a947c9d6a1e6.rvt
And the result is this:
dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6d2lwLmRtLnByb2QvYWM5ZThiNDgtNGE1MS00ZjZhLWE3ZTQtYTk0N2M5ZDZhMWU2LnJ2dA
Set my access token and encoded URN in display_sfv.html
After that I place my acces token and the encoded URN, like this:
Finally I got this errors from the console:
Again this example works if I use and urn from a bucket I had created, but when I use the urn I get from a BIM 360 folder I get that error message. Where could be my mistake?
To load models form BIM360, you have to use the urn under derivatives attribute like below:
"derivatives": {
"data": {
"type": "derivatives",
"id": "dXJuOmFkc2sud2lwcWE6ZnMuZmlsZTp2Zi50X3hodWwwYVFkbWhhN2FBaVBuXzlnP3ZlcnNpb249MQ"
},
"meta": {
"link": {
"href": "/modelderivative/v2/designdata/dXJuOmFkc2sud2lwcWE6ZnMuZmlsZTp2Zi50X3hodWwwYVFkbWhhN2FBaVBuXzlnP3ZlcnNpb249MQ/manifest?scopes=b360project.6f8813fe-31a7-4440-bc63-d8ca97c856b4,global,O2tenant.tenantId"
}
}
},
Ref: https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-version_id-GET/

How do I get the document path using the Autodesk A360 API?

When looking at the API documentation, it states it should be able to set a query parameter: includePathInProject. Using that, the relative path should be included in the response.
includePathInProject
Specify whether to return pathInProject attribute in response for BIM 360 Docs projects. pathInProject is the relative path of the item starting from project’s root folder.
true: response will include pathInProject attribute for BIM 360 Docs projects.
false (default): response will not include pathInProject attribute for BIM 360 Docs projects.
However, when I try this in Postman, I get this message:
{
"jsonapi": {
"version": "1.0"
},
"errors": [
{
"id": "34a40e9d-2db2-4a32-ac9a-fc0642207266",
"status": "400",
"code": "FUNCTION_NOT_SUPPORTED",
"detail": "A360 currently does not support query parameter includePathInProject."
}
]
}
This is the request URL I'm using:
https://developer.api.autodesk.com/data/v1/projects/:project_id/items/:item_id?includePathInProject=true
project_id: a.Yna[...]zgx
item_id: urn:adsk.wipprod:dm.lineage:0P0E[...]l5A
Is there any other way or workaround to get the path of a document?
It seems that you're trying to use it for A360 projects, I see an a. prefix on your project id. This parameter applies to BIM 360 only.

Define IFC Mvd on posting translation job

On translation of RVT file to SVF, I also want to post a job to translate and download an IFC file. Opening that IFC file after translation, it seems to use CV1 - Coordination View 1, which is a very old Model View Definition (hardly in use anymore and only for IFC2x3). If I export same RVT file in Revit 2016 with newest IFC exporter downloaded, choosing CV1 as an option, the file size of the IFC file translated from Revit is half the size of that from Forge. Is there a way to specify which MVD to use for the IFC translation using Model Derivative API, as it is in Revit (CV2, COBIE, IFC4 RV/DTV)? Since it seems that Forge uses the Revit IFC exporter, I would anticipate this be an option, but so far I have not succeeded finding it.
2019 Update
Just got informed, the issue REVIT-125299 has been resolved according to our engineering team. So, please try to submit the job body like below, use IFCExportOption instead, then you will obtain an IFC exported with the specified export setting. Cheer!
{
"input": {
"urn": "{{base64URN}}"
},
"output": {
"formats": [
{
"type": "IFC",
"views": [
"2d",
"3d"
],
"advanced": { //!<<< export options start
"IFCExportOption": "IFC4 Design Transfer View"
} //!<<< export options end
}
]
}
}
The old
After checking with our engineering team, Forge MD has supported to set IFC export options up like in Revit. For example,
{
"input": {
"urn": "{{base64URN}}",
"compressedUrn": false,
"rootFilename": "{{Filename}}"
},
"output": {
"formats": [
{
"type": "IFC",
"views": [
"2d",
"3d"
],
"advanced": { //!<<< export options start
"exportSettingName": "IFC4 Design Transfer View"
} //!<<< export options end
}
]
}
}
IFC exporter will try to seek for the saved export settings in your uploaded RVT based on the exportSettingName. If there is no matched setting, it will use IFC2X3 by default as I experience.
But there is a issue related to this feature, the output might not matched with the export settings, it has been logged as request id REVIT-125299 in our internal case system to make our team to allocate time to investigate. Apologies for any inconvenience caused.
However, you can sent the request id to forge.help#autodesk.com in the future to track updates. Thank you~
P.S. The above code sample might be changed in the future, please follow with the official documents: https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/