How to create an activity for both ZIP and Unzip input - autodesk-forge

I am trying to run a Revit plugin on Forge Design Automation, the input to the plugin are Revit files from BIM 360 that are accessed using BIM 360 APIs. If the Revit document has links, it's downloaded as a zip file (containing the links), otherwise, it's a single Revit file. How can I define my activity so it can handle both scenarios? More specifically, how should I set:
data['parameters']['rvtFile']['zip']
In my activity?
I don't know if the file is downloaded as a ZIP file or not before it's downloaded.

I don't know if the file is downloaded as a ZIP file or not before it's downloaded.
To determine if your Revit file downloaded from BIM 360 is a zip file, you can use this BIM 360 API. If the response has isCompositeDesign = true, it will download as a zip file with eTransmit package. If not, it will download as a Revit file. To understand why your file may sometimes be downloaded as a zip package see here.
For usage of a zip package as input file in Design Automation, you can follow the instructions for pathInZip in our documentation and/or see answer.
Edit (5/24):
Also see a new blog post on the topic. Refer to the usage of arguments.inputFile.zip and arguments.inputFile.pathInZip in the workitem. This way you can use the same activity and include these argument values when the posting the workitem when your input file is a composite design.

Related

Can't show translated .zip files on Autodesk Viewer after translating them with Forge APIs

I've tried following the tutorial on how to translate .zip files sending all the requests using Postman. Everything went smoothly with no errors and the responses where all as they were supposed to be. In the end I saved the response as a .stl file but when I try to visualize it on the online Autodesk Viewer it says that the model is empty.
I've been trying several times this tutorial, and on different Forge apps now but the result is always the same. Except for one time where Autodesk Viewer visualized what seemed like a single object of the file Tuner.zip.
Note that there are a couple of requirements when processing a collection of files with the Model Derivative service:
you must include all the required files (for example, the main Inventor assembly file as well as all the Inventor part files that are referenced by it) in the zip
the files in the zip archive should not be in any subfolders
when submitting the Model Derivative job, you have to include the compressedUrn and rootFilename parameters

How can I upload linked OBJ and MTL files to BIM 360?

I'm trying to use the Forge Api to upload linked OBJ and MTL files to a BIM 360 folder. I have been able to successfully upload the files separately, however I can't find how to "link" these files together.
Using the BIM 360 Document Management page, I am able to accomplish this by clicking the "Upload linked files" button, selecting my two files, and setting the OBJ file as the parent file.
How can I accomplish this using the Forge Api?
Yes, you can achieve the similar UI behavior "Upload linked files" by the Forge API, and I believe this blog post should be the one you are looking for..
https://forge.autodesk.com/blog/bim360-docs-setting-external-references-between-files-upload-linked-files

Upload `POST`local Revit files to BIM 360 using forge

I have a small question regarding Upload local Revit files to BIM 360 using forge, instead of open files using Revit and sync with BIM 360. I would like to build Using web interface and upload the files the idea behind that to save time because we have a lot of files... so if every time I want to sync the Revit project it will take a long time. I am not sure if the tutorial does what I am looking for:
https://forge.autodesk.com/en/docs/data/v2/tutorials/publish-model/
note that I am basically using JS and node JS, and the RVT files on the network location. I already followed the tutorial on learning forge and I managed to access BIM360 same at the tutorial, so now to POST the OBJ to OSS in specific folders.
I hope you get my point just to save time as I mentioned earlier instead open Revit project and Sync. I think we can put POST all the files at ones to BIM 360 using my own application or website 
It sounds the other tutorial should be what you are looking for:
https://forge.autodesk.com/en/docs/data/v2/tutorials/upload-file/
It explains how to upload a local file as a resource item to the project such as version item in the folder of BIM 360. Could you check if it helps?
It is also feasible to transfer the file from your cloud server. After getting the file stream, upload it to storage of BIM 360 (similar to step 4 in the above link shows ).
Please let us know if there is any further question.

Autodesk BIM360 upload file in Plans root

in Autodesk BIM360 Plans root folder, only project drawings and models are allowed to upload.
Using the Data Service Forge-API (as described here) instead, we can upload and retrieve all kind of files also in Plans root folder (but these files are hidden on online client).
What is your advice?
Thanks,
Alberto
The UI of the BIM 360 Docs product is design to show you 3D and 2D models that are hosted in the Plans folder. I understand that you can upload through the API, but that is not the right use of the Plans folder.
If you want to upload files and be able to access other kind of formats I will suggest upload them on the Project Files, which will be the right place to host them.

Local instance of SVF translator

Is there a local version of the SVF translation process that I could use locally on my computer without having to send my design to forge platform ?
- a standalone application under Autodesk license
- or a revit module ?
I work on project where people do not want to send their design online but still want to use the local version of the viewer.
thank you.
Autodesk Forge doesn't offer a locally hosted translation service. Unfortunately, that means that if your customer is not willing to even temporarily upload their file to the Autodesk server, then they cannot use the Forge Viewer to view their files.
If your customer is ok to temporarily upload a file, then they can upload the file, translate it, download the resulting SVF, and then delete the original file. This sample on GitHub demonstrates that process - https://github.com/cyrillef/extract.autodesk.io.
You can use 3ds MAX to export your files to SVF