Skip to main content

A Customizable Import Process

In this module you will learn how to import a model into your project. We use a sample Revit model to upload and import. We also walk through querying the model data after it is imported.

What Does It Mean to Import a Model?#

When importing a model on Twinit, it is important to understand that you are not actually importing the design systems native file. You are not, for instance, importing a Revit .rvt file. Instead you are importing a representation of that model contained in a .bimpk file.

This .bimpk file is most likely produced by a plugin created specifically for the design system. For instance, Twinit plugins for Revit, AutoCAD, Civil 3D, IFC, and more are all available. These plugins produce a .bimpk file from the source design system or file format.

A .bimpk file, again, isn't the model as the design system understands it. Instead it is the model condensed down to element information including element properties, systems, levels and graphics data that the Twinit graphics service is able to process and stream to the Twinit viewer component.

In this lesson you will be using a pre-generated .bimpk created from a sample Revit file.

Model Import - Where the File Service, Datasources Service, and Item Service Come Together#

The process of importing a model utilizes the File Service (from which it fetches the model bimpk file and housed the graphics files), the Datasource Service (for the asynchronous orchestrator used to read and transform the model data in the bimpk file), and the Item Service to persist, relate, and represent the model information.

The process to import a model can be broken down into these steps:

  1. Create the import Datasources orchestrator and the script used by the orchestrator to parse, transform, and persist the model. This datasource is reusable and can import any .bimpk.
  2. Upload a bimpk to the File Service. Usually this is done via a plugin in a design system, but, as mentioned, in this lesson we will use a pre-generated Revit sample .bimpk
  3. Execute the import orchestrator by passing it the filename, fileId, and fileVersionId of the bimpk which you wish to import, and monitor until the import orchestrator completes.

The first part of the downloaded code in a later step will walk you through three of these steps, including understanding the script run by the orchestrator to parse, transform, and persist the model data.

A Customizable Process#

It's also important to know that every step along the model import process can be customized, enhanced, and changed to meet your needs. This lesson will provide a configuration and scripts which will work for most any .bimpk file, though best for one produced by Revit. However, every point along the way can be customized to meet your needs based on your application.

Since the model import process is a configuration of services and scripts in your project, you are able to make any changes you need to suit your needs.