Autodisk forge files - autodesk-forge

I was wondering, the dwg files are hosted on my server, to use the viewer API do I need to upload it to forge platform then I can use the viewer API?
if yes is there API or otherways to upload the files to the platform I do not want to do it manually
if no this means it's ok I can use the viewer on the files on my server
Regards

In order to show any model (other than PDF) in the Viewer, you need to get it translated to SVF, which is the Viewer's format. This translation can only be done on our servers, so the file needs to be there at least while the translation is running.
https://forge.autodesk.com/blog/showing-files-viewer
We have a nice tutorial on how this can be done: https://learnforge.autodesk.io/#/tutorials/viewmodels

Related

Forge viewer - Download pdf derivative via API

Can I download a pdf from a derivative via API?
It's not clear to me what exactly you're asking for. Below are a couple of answers to what I think your question could be:
You have uploaded a PDF file to the Model Derivative service, and you would like to download the results of the conversion?
While you can download the derivatives of 3D models, I'm afraid it is not possible for PDFs. When processing PDFs, the Model Derivative service converts them to image pyramids to enable Google Maps-like experience where zooming in on different parts of the PDF will load in higher resolution images of the area.
However, if your goal is to be able to load a PDF into the viewer without the Model Derivative service, note that this is also possible: https://aps.autodesk.com/blog/dwf-and-pdf-support-forge-viewer
You have uploaded a design (e.g., a Revit design) to the Model Derivative service, and you would like to download the PDF output that the service generated?
If you're interested in converting Revit designs to PDFs, I would suggest that you generate the PDFs using the Design Automation for Revit as this service is better suited for these types of tasks.

Can you query, translate, and open .dwg files from web.autocad.com's Web & Mobile directories?

Background: I have a simple integration (Client App) using the Forge API that can: create a bucket, upload a .dwg file to the object storage service, translate the file (and get translation status), query the files in a bucket, and open any of the files in the bucket in the Viewer. I'm now researching the possibility to pull files that are made/modified from the AutoCAD Web & Mobile App (https://web.autocad.com/) (aka the Web App) via the forge API. Is this possible?
Usecase: We want some personnel to be able to modify the underlying files, whereas others just need to view it from an existing application integrated through forge. The idea would be the engineers would modify the file in the Web App, and then from the Client App using the forge API, I want to query to see if the base file has been updated since the last time it was translated for the viewer. If newer, re-translate the file and view it. If not, just view it.
Attempts: I assumed the files would be in a project in a hub in the /project/v1/hubs/ in the data management API of Forge, but I'm getting a response of "You don't have permission to access this API". I am in the trial version of forge, so that may be the issue. And the Web App is currently "free for everyone for an extended period." Is it possible that I just need to purchase one of the subscriptions to be able to access the files I have on the web app? Or am I looking in the entirely wrong place?
So, concisely, here are the questions:
Are files that are saved on https://web.autocad.com/ accessible via the Forge API? How, if yes?
If yes to #1, do these files need to be converted using the Forge API to be render-able in the Viewer?
Thank you for your time and help!
I would say, it's a pretty cool idea and workflow, but unfortunately, AFAIK, we don't have direct access to file on https://web.autocad.com/ by Forge API currently, only data within Autodesk SAAS applications include BIM 360 Team, Fusion Team (formerly known as A360 Team), BIM 360 Docs, A360 Personal could be accessed directly, refer https://forge.autodesk.com/en/docs/data/v2/developers_guide/overview/, But some ideas:
I am not expert on https://web.autocad.com, but I know it provides the connection to cloud storage including Box, Dropbox, Google Drive, and Microsoft OneDrive, depends on which cloud storage you are using, you should pick the corresponding API to access the file, and maybe check if the file is changed, all of that is nothing to do with Forge, but the cloud storage.
If you can check the file version with the API from cloud storage provider, then you should be able to exchange the file between the cloud storage and Autodesk OSS(check sample https://github.com/Autodesk-Forge/bim360appstore-data.management-nodejs-transfer.storage ), you can use the Forge to translate and view files on Autodesk OSS.

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.

Embed the Autodesk Viewer in a web page

In our web application, we want to view AutoCAD files using Autodesk viewer API.
As per our requirement we want to select the file and need to open directly in auto-desk viewer site, where all default options like 2D, 3D views are available.
Is it possible to view those files, directly in Autodesk viewer, instead of creating our own viewer?
We do have a minified online viewer that takes a svf - pls make sure all svf assets are available at the same location and open to public access with CORs allowed:
https://autodeskviewer.com/viewers/latest/viewer3d.html?svf=url/to/your/svf (make sure to put in the url to your svf)
But this is NOT an official setup of any sort and is subject to change w/o notice. You are very much encouraged to develop your own, just a few lines of code would do this trick if you already have your models extracted.
Here's a few good places to start:
https://forge.autodesk.com/en/docs/viewer/v6/tutorials/basic-viewer/
http://learnforge.autodesk.io
Tools:
http://models.autodesk.io
https://extract.autodesk.io/

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.