Build BIM apps on an open foundation.
Four ways to extend
| Surface | Use when | Status |
|---|---|---|
JavaScript globals window.ClashControl.* | Other JS code on the same page wants to read state or trigger actions | Public |
Addons addons/*.js | You want to ship a reusable extension that loads alongside the app | Public |
Smart Bridge REST localhost:19803 | An external desktop process needs to drive the viewer | Public |
| MCP server | An AI agent (Claude Desktop, ChatGPT, any function-calling LLM) needs tool access | Public |
1. JavaScript globals
Once ClashControl has booted (window._ccThreeReady === true), the following globals are available on every page:
State + dispatch
// Read the live state (read-only snapshot)
const state = window._ccLatestState;
console.log(state.models.length, 'models loaded');
console.log(state.clashes.length, 'clashes detected');
// Dispatch a Redux-style action
window._ccDispatch({ t: 'TAB', v: 'clashes' });
window._ccDispatch({ t: 'ACTIVE', id: state.clashes[0].id });
Model + scene
// Bounding box, camera state, canvas dimensions
const cam = window._ccViewport.getCamera(); // {position, target, fov, ...}
const bounds = window._ccViewport.getBounds(); // {min, max, center, size}
// Programmatic camera moves
window._ccViewport.flyTo(px, py, pz, tx, ty, tz);
window._ccViewport.fitAll();
// Invalidate a render (the viewer is render-on-demand)
window._ccInvalidate(2);
Quality + accessibility checks
// Pull all elements from all loaded models
const all = window._ccLatestState.models.flatMap(m => m.elements);
// Run individual check engines
const dq = window._ccRunDataQualityChecks(all);
const acc = window._ccRunAccessibilityChecks(all);
// Or the aggregated 0–100 score
const score = window._ccComputeQualityScore(all, window._ccLatestState.models);
// => { score: 82, grade: 'B', breakdown: { categories: [...] }, at: ... }
Reference layers
// Load a Gaussian Splat
await window._ccLoadSplat('https://example.com/scan.spz',
{ name: 'site-scan', scale: 1, position: [x,y,z] });
// Load a point cloud (.las / .ply / .pcd / .xyz)
await window._ccLoadPointCloud(file);
// Place model on a satellite basemap via IFC site lat/lon
window._ccGeoplaceModel(modelId, { refLat: 52.0, refLon: 4.3 });
The full list lives in index.html — search for window._cc. They’re grouped by domain and commented. Stable underscore-prefixed names will continue to be supported; the cleaner ClashControl.* namespace is a thin alias.
2. Addon system
Addons are plain JavaScript IIFEs under addons/. The core loads them asynchronously and gates every call behind a typeof check — so a missing or broken addon can’t break the viewer.
// addons/my-feature.js
(function(){
if (typeof window === 'undefined') return;
// Your addon's API on the global object
window._ccMyFeature = function(arg) {
const state = window._ccLatestState;
// ... do something with the model
};
// Register so the core knows you're alive
if (typeof window._ccRegisterAddon === 'function') {
window._ccRegisterAddon({
id: 'my-feature',
name: 'My Feature',
description: 'What it does'
});
}
})();
Add the filename to the loader list in _loadAddonScripts (or self-host as a static asset and load via a <script> tag). Existing addons in the repo are the best reference:
data-quality.js— rule-based checks, exposes the engines as globalsaccessibility.js— geometric checks against thresholdsgeoplace.js— basemap tile rendering, modifies the scenepointcloud.js— file parsing + reference-layer mountingsplat.js— lazy-loaded modern Three + Spark.js
3. Smart Bridge REST API
The optional Smart Bridge binary runs on the user’s machine and exposes ClashControl over HTTP on 127.0.0.1:19803. Useful for desktop apps, command-line tools, or any external process that wants to drive the viewer.
# Get current viewer state
curl http://127.0.0.1:19803/status
# Get the live tool manifest (auto-generated from running addons)
curl http://127.0.0.1:19803/tools
# Get the OpenAPI 3.0 spec (for ChatGPT custom actions, etc.)
curl http://127.0.0.1:19803/openapi.json
# Execute a tool
curl -X POST http://127.0.0.1:19803/call/get_clashes \
-H 'Content-Type: application/json' \
-d '{"limit": 10, "status": "open"}'
Security: bound to loopback only (not network-reachable). CSRF-protected via Origin allow-list. Host header validated. Bodies capped at 1 MB. Details on the Security page.
4. MCP server (for AI agents)
mcp-server.js implements Model Context Protocol over stdio. Claude Desktop, ChatGPT’s Connectors, or any function-calling LLM can hook in and drive 51 tools across model data, clash detection, issue management, and viewport control.
// claude_desktop_config.json
{
"mcpServers": {
"clashcontrol": {
"command": "node",
"args": ["/absolute/path/to/ClashControl/mcp-server.js"]
}
}
}
Or run node mcp-server.js --install to auto-configure Claude Desktop. The Smart Bridge binary bundles this for one-click install on Windows/macOS/Linux.
What you can build
- Cost estimation — walk the IFC element graph via globals, calculate quantities, output a CSV.
- 4D planning — tag elements with construction phase, drive timeline visualization through the viewer’s visibility API.
- Custom quality rules — addon that checks your company’s specific naming conventions and surfaces results in the Data Quality tab.
- Discipline-specific overlays — MEP route checker, structural code compliance, energy modeling preprocessor.
- Integration bridges — push to Procore, ACC, Trimble Connect via the REST API + an external bridge process.
- AI agents — let an LLM run autonomous coordination workflows via MCP.
None of this requires a paid license, an account, or our permission. Fork, build, ship. We’d love to see what you make — tag Discussions.
Stability promise
The window.ClashControl.* namespace and the underscore-prefixed globals listed above are public APIs — we won’t break them in patch releases. The MCP tool manifest and REST OpenAPI spec are versioned independently and exposed at runtime so your client can discover them. Internal helpers (anything in index.html not documented here) can change at any time — treat them as private.
FAQ
- Is there a hosted API on your servers?
- No. ClashControl runs entirely in the user’s browser by design. There’s no hosted backend that holds IFC data. If you need server-side IFC processing, fork the repo and host yourself.
- How do I distribute my addon?
- Today: PR against the repo to land it in
addons/, or self-host as a static JS file and load via your own<script>tag. A plugin gallery is in planning. - What’s the license?
- MIT. Use commercially, modify, distribute. Attribution appreciated.
- Can AI agents really drive the viewer?
- Yes. The MCP server is in production; Claude Desktop users can already say “run clash detection between structural and MEP, then resolve duplicates” and watch it happen.