glTF Exporter API

Settings Explained

Group meshes by element or by material option influences output file size (usually it’s bigger for the last option), 3D model performance and file structure. In examples below the same models were exported with different settings, model on the left has meshes grouped by element and model on the right has meshes grouped by materials:

Elements have their Revit Ids and are broken down by Revit Category, so the output file has nice structure. When grouping by materials there are as much nodes in the file tree as materials in Revit project.

Large projects exported by elements may have less FPS rate. Number of draw calls for the model above is 6494. Gain more FPS exporting by materials - only 55 draw calls - the same as number of materials. Though file size for the model is increased from 18MB to 29MB.

What is the plugin?

glTF Exporter add-in for Revit exports your project to popular  3D glTF format. glTF is universal file format for transferring 3D assets which almost every 3D software can handle. With glTF Exporter it has never been easier to get a Revit project in gltf format.
Get it from the  Autodesk App Store or ask for a special quote sending us an email.

How does it work?

To make use of glTF export functionality in your Revit add-in project get  GS.Revit.GltfExporterAPI.dll under

%ProgramData%\Autodesk\ApplicationPlugins\glTF Exporter.bundle\Contents

directory after the  add-in installation.

1. Reference GS.Revit.GltfExporterAPI.dll from your Revit add-in development C# project (use the library from the appropriate folder for your targeting Revit version).
2. You need to pass your  personal user ID to validate the license before starting the export (you can grab it once and keep in the settings of the add-in):  Validate.License(developerId).
3. Add the following code after license validation to run the export:

var outputPath = @"C:\ExportResult.glb"; var settings = new GltfExportSettings(outputPath); var exporter = new GltfExporter(settings); exporter.Export(document, view);

4. Resolve compilation errors using GS.Revit.GltfExporterAPI; execute the command from a 3D view and see results.

How our solution helps clients?

The add-in helps HoloLens and other Mixed Reality developers get fast tiny files with LODs and all the materials right from Revit - no need to convert a Revit project using numerous software and tools to get the file AR compatible devices can handle. It will take you only a few lines of code to get things done!

glTF Exporter API library features embedded IntelliSense XML documentation and provides flexible export options. Except described on settings explained page they include:

  • export materials as doublesided
  • limit vertices count for a single mesh
  • export normals or not
  • format output json file and more

Level of details determines how many polygons 3D model has. It relates mostly for rounded objects and may dramatically impact the file size. The same model of torus exported with LOD 1, LOD 3 and LOD 15 (5KB, 15KB and 396KB corresponding). LOD values ​​from 5 to 7 are generally sufficient.

glTF Exporter maps Revit materials to PBR materials (and to KHR if you choose export with merged LODs option) so you can get beautifully looking 3D model. But if you what to experiment or get some statistics you can skip materials and export geometry only disabling Export materials checkbox. This might be useful for some geometry analysis.

Output format option determines files you get. The best choice for projects which are going to be send by the Internet is glb format - there will be only single file you can immediately email to a client, for instance. If you are planning to edit textures or want to see the file structure - choose gltf format. You can open gltf file with any text editor and edit materials from Textures folder.

Projects, exported with the last two options can be saved only as glb files:  Draco compression minimizes file size as much as possible. It’s extremely useful for large projects, but remember that not all third party software can handle compressed files. Difference in file size can be seen from the following export results:

Create merged LODs model options improves the quality of detailed Revit models handling. With this checkbox enabled glTF Exporter creates tree files: one with specified LOD and two other with degrading LOD, and merges them into single file. This might be specifically useful for Windows Mixed Reality developers.