Manual Reference Source

Modelo API

Modelo API provides the every bit of functionalities you need to build a BIM platform.

Basic usage

Create a model viewer with default UI.

<!DOCTYPE html>
<html lang="en">

<head>
  <link rel="stylesheet" href="http://api-release.modeloapp.com/prod/modeloapiui-1.0-lts.css" type="text/css" />
  <style type="text/css">
    #modelContainer { width:100%; height:100%; position: absolute; }
  </style>
</head>

<body>
  <div id="modelContainer"></div>
  <script src="http://api-release.modeloapp.com/prod/modeloapi-1.1-lts.js"></script>
  <script src="http://api-release.modeloapp.com/prod/modeloapiui-1.1-lts.js"></script>
  <script>
  window.onload = function() {
       Modelo.init({ endpoint: "https://build-portal.modeloapp.com" });

       var modelId = "wm8vx71L";
       var container = document.querySelector("#modelContainer");
       var appToken = 'c2FtcGxlcyxtb2RlbG9TQU1QTEVT';

       Modelo.Auth.signIn(
           appToken,
           function() {
               const modelApp = new Modelo.WebApp({
                   modelId,
                   containerId: "modelContainer"
               });
           },
           function(e) {
               console.error(e);
           }
       );
   };
  </script>
</body>
</html>

Functionalities

  • Upload models to cloud
    • Support most common CAD files, including .3dm, .skp, .fbx, .obj, .stl, .rvt, .ifc, .nvw, altizure and .dwg format.
  • Combine models at the cloud
  • Extract parts of model into a new model at the cloud.
  • View uploaded 3D models in modelo 3D viewer.
    • Load multiple models into one viewer.
  • Retrieve the BIM information of uploaded models.
    • Support BIM models, e.g., .rvt and .ifc.
    • The BIM tree of the scene.
    • The BIM information of each element.
    • Query elements with certain BIM information values.
  • Support multiple input devices.
    • Mouse, keyboard, touch and gyrosensor.
  • Rendering effects
    • Shadow and ambient occlusion.
    • Lighting.
    • Enhanced anti-aliasing.
    • Smart culling
    • Glow
    • DoF
    • Background, solid color, wallpaper and skydome.
  • Camera control
    • Rotation, zoom, pan
    • Region zoom
    • Default views, e.g., top, bottom and etc
  • Bunch of tools in 3D viewer
    • Section, cutting the model in any directions, e.g., distance measurement.
    • Measurement, measuring the distance and angle with snapping to edges and points.
  • Visibility control
    • Show and hide certain elements.
  • Change element properties.
    • Colors
    • The values of BIM properties extracted from original models.
    • Delete the BIM properties extracted from original models.
    • Add new customized BIM properties.
  • Screen capture of the viewer.
  • Generate a 3D PDF of a model.
  • View 2D DWG and PDF in browser
  • Provide the interaction between 3D model and 2D floor plan for .rvt models.

The API connects to Modelo Build backend service and delivery functions above.

Sign Up

To use API, the application developer needs to sign up at build.modeloapp.com as a registered developer at first. Then she needs to retrieve an applicaiton token in her dashboard. This application token is the access key to data stored on Modelo Build cloud. The application developers need to ensure the safty of this token themselves.

Upload Models

Developer can either use upload dialog in the dashboard of build.modeloapp.com or use API to upload model. Once the model is uploaded, server will return an model ID which is the gloal idenfier for this model.

Supported Platform

  • Chrome 63+ x64
  • Safari
  • Safari iOS
  • FireFox 53+

Samples

Modelo API Samples

Element manipulation

Set elements' visibilities

    viewer.setElementsVisibility(elementNames, false); // Hide elements with given element IDs.
    viewer.invalidate(); // refresh the rendering.

Set elements' custom colors

    var randomColor = [Math.random(), Math.random(), Math.random()];
    viewer.setElementsColor(elementNames, randomColor);
    viewer.invalidate();

    viewer.setElementsColor(coloredElements, null); // Restore element colors to their original colors.
    viewer.invalidate();

Change Log

Version 1.1 (2018/11/08)

  • Support merge model.
  • Has measurement notations.
  • Comments.
  • The viewer initialization gets changed.

Version 1.0 (2018/10/08)

  • The first version released, modeloapi-1.0-lts.js.