Autodesk forge viewer - autodesk-forge

So we are using the forge viewer API, but when we upload file it doesn't show on the viewer and we end up with a gray viewer.
The file transcription to svf seems to not be working properly.
Anyone experience or know how to solve this?

First you need to check if your file is well uploaded in your bucket (I assume that your using Buckets/Object with 2-legged OAuth).
Using this endpoint your must see your uploaded files : Get Objects
In the response, you will find the objectId. This objectId need to be converted into base64 and URL Safe for the SVF translation.
Now, following this tutorial, you will be able to translate your file : Translate to SVF
Please note the response of this request to get the most information about this job.
Finally, check the manifest to know when the translation is complete.

Related

Fetch Metadata of a model using model derivative api (Forge)

I was trying some hands on with forge services, I want to fetch few object's properties inside of a revit model uploaded on bim360/ACC, for which I am calling two API's 'https://developer.api.autodesk.com/modelderivative/v2/designdata/job' for translating the job to svf and then calling API "https://developer.api.autodesk.com/modelderivative/v2/designdata/" + urn + "/metadata/" (with urn of the translated job) (failed when passed urn of revit file directly)
Can we not directly get the metadata/properties without converting the file to svf? Since translating to svf is taking a lot of time for large files, my motive is to decrease the time to fetch the properties, can you share any solutions if you think of any please?
Yes, you are correct in assuming that you need to translate to SVF in order to access any BIM element properties at all. It's either that, or open it in desktop Revit and access the data there. Also discussed in the Revit API discussion forum thread on fetching metadata of a model using Forge model derivative API.

Autodesk Forge viewer: Directly load a SVF?

As the official documentation states, you can upload a source file to OSS and translate it, once in your bucket, to a SVF with the Model Derivative API.
But is it possible to skip the translation step, directly uploading a SVF project (for example, one of these: https://forge-rcdb.autodesk.io/gallery) and loading into the web viewer?
I haven't been able neither to do it nor find any documentation yet.
Yes, that is possible. Instead of loading the Model Derivative service "manifest" using the Autodesk.Viewing.Document.load method, and then loading a specific "viewable" from the manifest using the Viewer3D#loadDocumentNode method, you can just call the viewer's loadModel method and provide an actual URL to your SVF file.
Note however that the Forge Viewer assets (JavaScript, CSS files, icons, etc.) should still be coming from the Autodesk domain. In other words, we do not officially support running the application offline. If you need to support workflows where your users could be temporarily disconnected from the internet, please refer to https://forge.autodesk.com/blog/disconnected-workflows.

Can I get the URL of a translated DWG and use it as the input for a Design Automation Activity?

I have translated some DWG files into SVFs using the Model Derivative API. I kept track of the returned URNS and I'm able to view each translated file in the Forge viewer.
Since I used a persistent retention policy, those original DWG files are apparently stored somewhere in the Forge cloud.
Now, I want to run CAD scripts on one of those stored DWG files using the Design Automation API and send the output to some other cloud storage (Dropbox etc).
Is there a way to get the URL for one of those original DWGs based on the URN of its translated SVF and then use that URL as the input to a Design Automation Activity?
The short answer is Yes, you can use the file that uploaded to Autodesk storage as an input of Design Automation, just input the file link and access token.
We are about to release the Design Automation V3, so I use that version for example, but the way applies to V2.
You have 2 ways to use the link of your DWG file:
Use the file link directly with access token, when you upload your file to Autodesk storage or list all the content from on bucket, you should get the location property, and use that url with access directly as input url.
You can also create a signed URL for the original link to be used as input/output, for details, please refer Sign URL and Post workitem.
Here is one of my sample workitem request body, it includes both ways:
{
"activityId":"{{dasNickName}}.FileUpgraderActivity+prod",
"arguments":{
"rvtFile":{
"url":"https://developer.api.autodesk.com/oss/v2/buckets/revitiosample/objects/RevitNative.rvt",
"Headers":{
"Authorization":"Bearer {{dataApiToken}}"
}
},
"resultrvt":{
"verb":"put",
"url":"https://developer.api.autodesk.com/oss/v2/signedresources/***-****?region=US"
}
}
}

How to use autodesk viewer api to view .dxf files on my website?

I have around 200 .dxf files on my server. I would like to integrate the autodesk-forge viewer so that people coming to my website can view the drawings? I do not see any example as such online which can help me in that? Do you guys have any examples which can assist me in this?
I do not want to upload the files on the cloud and use the embed link rather I just want to use the viewer api and pass my .dxf files from my server to view those on my website.
Any help will be highly appreciated?
I am afraid this is not possible, the Autodesk Forge Viewer requires you to upload the file on the Autodesk storage and use the Model Derivative API to prepare your DXF files to be viewed in the Viewer. You do not need to keep the DXF on the Autodesk storage after the process, but this is a required step.
If you follow this tutorial, you will be able to see you DXF files onlines. All resources are protected, but if you want to delete the seed file (aka the DXF file), you need to call this endpoint at the end of the tutorial steps.

Revit file not supported (while working in A360 viewer) but IFC is working

For a proof of concept I'm playing around in Postman with the Autodesk Forge API's and I'm doign the following.
authenticate
create & get bucket
upload model (in IFC and Revit) in bucket
translate it
extract meta-data.
With IFC files everything is working like a charm but it's not working with Revit files no matter what I do or which Revit file I try.
I tried 3 of my own Revit files (that do work in Autodesk 360 viewer based on Forge) and Autodesk's sample Revit file Basic Sample Project 2016
I'm wondering if it could be something specific in my API calls that I'm missing.
Below are two screenshots of two calls that I'm doing;
put model in bucket
validate translation giving error with Revit but working with IFC
Hope you can help, because I'm very stuck.