Running Bentley’s iModel Viewer

Bentley iModel

Here at Techifide we are passionate about the Built Industry and how technology can improve processes in the field. Our team is well connected and often first to hear about new innovations in software development.

When I discovered Bentley’s iModel.js, an open-source platform “for creating, querying, modifying, and displaying iModels“, I wanted to try it out for myself. I found it to be full of great potential and can already think of ways it can be applied and developed further to bring huge benefits to businesses in the sector.

This post explains how to try this new technology for yourself, using my test example:

I am using Visual Studio Code, as the project structure is optimized for its use.

First of all, check that you are using one of the supported platforms here, and that you have Rush installed. If you don’t, you can install it globally by running the following command:

npm install -g @microsoft/rush

While Rush gets installed, get registered with Bentley:

Register your application at Developer Registration. Select “Agent” from the app type dropdown. For more information, see the section on authorization.

Then add your agent’s identity email as a project participant on your project:

Edit your sample project and add {client_id}@apps.imsoidc.bentley.com as a project participant. If adding the user does not work at first, please wait a few minutes. The identity user is being created in the background, this can take up to ten minutes.

Once you have your credentials, you can download the code from Github: https://github.com/imodeljs/imodeljs-samples

In the interactive-app folder, there are 3 projects:

  • basic-viewport-app
  • ninezone-sample-app
  • simple-viewer-app

Choose one of them and navigate down to the config.json

{chosen-app}/src/common/config.json

You will see something like this:

Remove all comments and set the properties values with the Project Name and iModel Name values you generated at the registration process. Save and run the following command at the route of the project:

rush build

Via terminal, navigate to the project’s folder, in my case:

/interactive-app/ninezone-sample-app

And start your application:

npm start

Now that the app is running, open http://localhost:3000/ in your browser.

Accept the terms of use, then click “Open iModel“. You should see a screen like this:

And let us know about your experience with Bentley’s iModel and any suggestions you have that might help us develop it further…