A minimal example demonstrating how to integrate the BimCT Viewer into a TypeScript + Vite application.
Download the complete getting started project:
Download bimct-getting-started.zip
Extract the zip file and follow the setup instructions below.
Create a .npmrc file in your project root (or in your home directory ~/.npmrc):
@nomitech:registry=https://npm.nomitech.com/
Login to the Nomitech npm registry:
Contact Nomitech to request npm registry credentials.
Once you have your credentials, login using:
npm login --registry=https://npm.nomitech.com/ --scope=@nomitech
When prompted, enter the username and password provided by Nomitech.
This will authenticate you with the Nomitech registry and allow you to install the @nomitech/bimct-viewer package.
npm install
This will automatically run the postinstall script to copy required assets (WASM files, Cesium assets, fonts) to the public folder.
Open src/main.ts and replace <PUT_YOUR_DOMAIN_API_KEY_HERE> with your actual domain key:
const options: RendererInitializationOptions = {
key: "your-domain-api-key-here",
// ... other options
};
The zip file already contains a demo Model for you but you can place your own .bimct model file in the bimct_files folder at the project root:
bimct-getting-started/
bimct_files/
YourModel.bimct
Update the model path in src/main.ts:
await renderer.loadModelFromUrl("/bimct_files/YourModel.bimct");
If you want to convert your own file to .bimct file:
You can convert your IFC, Revit, or other BIM files to .bimct format using one of these options:
Online Converter (Demo up to 20MB files): https://bimct-converter.nomitech.com/converter/demo/upload-new
Converter API: Create your own converter instance for better performance and reliability
npm run dev
Open your browser to http://localhost:5173
npm run dev - Start development servernpm run build - Build for productionnpm run preview - Preview production buildnpm run sync-assets - Manually sync BimCT assets to public foldernpm run clean - Remove generated assets and build filesbimct-getting-started/
├── bimct_files/ # Place your .bimct model files here
├── public/ # Static assets (generated)
│ ├── assets/ # BimCT viewer assets (WASM, Cesium, fonts)
│ ├── bimct_files/ # Copied model files
│ ├── bimct-viewer.css # BimCT viewer styles
│ └── favicon.ico # BimCT favicon
├── scripts/
│ └── prepare-bimct-assets.cjs # Asset copying script
├── src/
│ ├── main.ts # Main application entry point
│ ├── style.css # Application styles
│ └── vite-env.d.ts # TypeScript declarations
├── index.html # HTML entry point
├── package.json
├── tsconfig.json
└── vite.config.ts
This example demonstrates:
.bimct files from a URLFull documentation: RendererInitializationOptions
renderer.selectByClass(className) - Select elements by class namerenderer.getHighlightedState() - Get currently highlighted elementsrenderer.setHighlightedState(state) - Restore highlighted elementsrenderer.takeSnapshot(width?, height?) - Capture screenshotrenderer.loadModelFromUrl(url) - Load a BIM modelselectionChangeEvent - Fires when element selection changesmodelLoadedEvent - Fires when model finishes loadingelementClickEvent - Fires when an element is clickedRun npm run sync-assets to manually copy assets to the public folder.
Ensure the bimct-viewer.css is loaded from the root path (/bimct-viewer.css in index.html).
If using BimCT viewer version 190+, you may need to downgrade to version 181 or wait for a package fix. See package.json to change versions.
.bimct file is in the bimct_files folderloadModelFromUrl() matches your file locationThis example is provided for demonstration purposes. The BimCT Viewer library requires a valid license key from Nomitech.
postinstall script automatically copies required assets after npm installmain.ts ('wasm32', 'wasm64', or 'wasm-threads32')public/ folder are git-ignored and recreated on install