Cannot extract the OBJ of 3D view - autodesk-forge

I have a Revit file with two different 3D views which I can see them in Autodesk viewer ;however, when I extract model manifest, there is only one OBJ file and I can extract only one.
How can I extract the OBJ of all the 3D views that are created in the model?
Thank you

You need to translate your file into OBJ first using the ModelDerivative API.
According to Supported Translations, Revit files doesn't support OBJ derivatives, so can't translate the whole file into OBJ.
But you can extract the geometry, take a look at this tutorial : Extract Geometry in the official Autodesk Forge documentation.
In the translate payload you need to pass the model guid of the 3D view you want to translate, so you should be able to translate all your 3D views.

Related

Autodesk Forge - (RVT Model) Forge to three.JS to .USDZ

I would like to convert assemblies from a .RVT model to three.JS to .USDZ for AR. I have a list of assemblies and want to process each individual file into the final format of USDZ for AR. Does anyone have any good recommendations? I’m thinking Model Derivative IFC to three.JS to .USDZ but would love know the best method for this! Thank you!
The ModelDerivative API allows you to convert your RVT file (and many others) into SVF (or SVF2) to be used by the viewer for example. Then you can use Forge Convert Utils package to extract the geometry and create a glTF of your model.
glTF is widely used for AR but if you need to use USDZ, you can easily convert your model with this kind of tool : USD_From_glTF

Reality Capture output file to forge viewer

is there any way so I can see the results of the Reality Capture API output file in forge Viewer, or do I need to download first then again upload that is the only option?
The output of the Recap API that would work are the following: obj and fbx. In order for you to get a viewable and show it with the Forge Viewer it will need to go through the process of using Model Derivative to translate the file into an SVF.
Here is the steps to take to achieve this:
1st. Use Recap API and set the output as obj or fbx - https://forge.autodesk.com/en/docs/reality-capture/v1/tutorials/create-3d-mesh-from-photos/
2nd. Use Model Derivative API - https://forge.autodesk.com/en/docs/model-derivative/v2/tutorials/prep-file4viewer/

Load three js model into forge viewer

I try to load a three.js file (Json from rvt) into the offline version of the forge viewer. How I can do this?
Thank you!
Forge viewer is based on three.js. It is similar to adding mesh to the scene in native three.js context. The below are one demo extension.
https://github.com/Autodesk-Forge/library-javascript-viewer-extensions/tree/0c0db2d6426f4ff4aea1042813ed10da17c63554/src/Autodesk.ADN.Viewing.Extension.MeshImporter
In this demo, the json file (Arbor Press.json) is from Inventor. It contains the definition of the geometry and material. The code of the extension will parse the json, and create mesh in the scene of Forge Viewer.
You might also need to take a look at the other extension for examples of changing material colors:
https://github.com/Autodesk-Forge/library-javascript-viewer-extensions/blob/0c0db2d6426f4ff4aea1042813ed10da17c63554/src/Autodesk.ADN.Viewing.Extension.Material/Autodesk.ADN.Viewing.Extension.Material.js
However please be aware your meshes will not be detected by the viewer selection logic, some extra work would be needed if you want that.

3D Geometry missing in Revit File after model derivative SVF translation

I'm trying to translate Revit file that contains both 3D and 2D geometries. I've verified that the file contains proper 3D geometry, by opening it in revit 2019 and visualizing it through 3D viewing mode.
However, when I pass this file into model derivative process, it only creates 2D derivative.
Before translation process, I've tried to set default view of the revit file as '3D' instead of 2D drawing file, which didn't work.
I've also tried making a translation POST request with formats as 'svf', and views as both ('3D', '2D'), and ('3D' only), which both failed.
However, all these attempts didn't work, and when I inspected the manifest from the file translation, it seems like that 3D geometry is completely missing. I think that there is a unhandled exception in Model Derivative process that fails to extract 3D geometry in our particular forge model file.
If you need URN of the file / actual file, please let me know.
Thanks in advance.
- EDIT
UPDATE:
I've confirmed that the default 3D view is named as {3D}, default name set by Revit.
What is the name of your default 3D view?
The default name is "{3D}", I believe.
Maybe the translation process does not pick it up if it is named differently.
Afaik, the one and only way to specify the views for the translator to process is by using the Collaboration for Revit or C4R BIM 360 Team tool to select the views to publish to the cloud.

Convert autodesk .dwg and .dwf files to three.js json format

I want to render 3D graphics files of autodesk (.dwg and .dwf) using three.js but three.js requires 3D data to be in json format. So, I need to convert these files to three.js readable json format. I tried searching on the internet but couldn't find any solution. Can anyone tell me a good converter for these files?
Thanks in advance.
In fact Autodesk already have a converter & wegbl viewer. Go to http://developer.autodesk.com and get a key for View & Data API. There is a server side REST API that allow you to upload a CAD file and convert to a JSON stream. You can hook to it and get the output. Or, even easier, just use the JavaScript client side API to embed the viewer on your website/app
Update
The API was renamed to Model Derivative + Viewer, the first translates the source file (e.g. DWG, RVT and many others) to a web-friendly format that can be viewed on the second, which is based on Three.js (and can be customized).