How-to guides
One task per page, in every SDK. A guide assumes you know what you want and shows the shortest way to it.
Guides are grouped by area. Most guides show the same task in JavaScript, Java, .NET and, where the OpenAPI covers it, as an HTTP call; pick the language tab once and the site remembers it.
Using BIM.works#
The BIM.works web application at a glance, and one guide per everyday task in it.
- Navigate the 3D viewerOrbit, pan, zoom and walk with the mouse, the keyboard, touch and a game controller; select, hide and colour objects; where the pivot point comes from.
- Measure in the 3D viewerMeasure distances, paths, areas (gross, net or hull), angles, room widths and heights with the lasers, and the clearance between two objects, from the ruler menu of the 3D viewer.
- Connect two viewersThe 3D model on one side and a plan of it on the other, connected but independent: the plan shows where the 3D camera is, and dragging it there moves the 3D view. The minimap does the same.
- Upload in the UIDrop files on the Models tree or use the upload button; what happens to zips and ifczips, how progress and errors show.
- Read the validation reportOpen the validation report of a model version or a failed check-in, read its stages and its findings by rule, find the objects a rule fired on, and run the schema check again.
- Set a geo referenceGive a model its position on earth from the Location section of its popup: extract it from IfcSite, IfcMapConversion, an EPSG code or a WKT string, correct it on the map, or write it into the IFC file.
- Set the scale of a drawingGive a PDF or DWG drawing its real size from one length you can read on it, or from the scale printed on the sheet, so that measurements on it are in real millimetres, with or without an IFC model.
- Place a drawing on the mapGive a PDF or DWG drawing a geo reference, by taking over the location of the model it is aligned onto or from a DWG's own coordinates, so it shows in GEO mode next to the IFC models and the GIS layers.
- Run an IDS checkAdd an IDS to the Actions tree by dropping the file or with Add new → IDS Check, run it on the loaded models and read the result tree.
- Use the Actions treeQueries, visualisations, checks, reports, sequences, transactions and compares are all actions in one tree; how to add, run, organise and share them.
- Edit a modelMove, rotate and delete objects in the 3D viewer and change their property values in the Features panel; commit each change at once or record several and commit them together as a new version.
- Preview a transactionWrite BUL statements as a transaction in the Actions tree and see, before you commit, which objects each statement selects and which of them will change, coloured in the 3D viewer.
- Compare versionsCompare a version with the one before it in two clicks, or any two models, and see what was added, removed and changed coloured in the viewer, side by side, swiped or blinking, with the moves measured, every change listed and the result exported.
- Link data to objectsLink a file, a web link, a text or an identifier to one or more objects in the features panel, open or download it, see how it followed its object to later versions, replace it from a version on, and unlink or delete it.
- Manage API tokensCreate, edit, rotate and delete API tokens on a folder: scopes, the mandatory expiry, CORS and IP allow-lists, and the secret that is shown once.
- Share a modelOpen a read-only viewer link for a model, a folder or the loaded models; what the link contains, how long it lives and what it cannot do.
- Limit the visible features of a workspaceDecide which attributes, properties, quantities, classifications and other features the visitors of a published workspace see, as a white-list or a black-list that the server enforces in every call.
Install#
Where the SDKs come from and how to add them to a project.
- JavaScript and TypeScriptInstall the @bimworks packages from the private npm registry — the TypeScript SDK generated from the OpenAPI, or the classic JavaScript SDK with the viewers — or use the single-file builds with an import map.
- JavaAdd the Java SDK (nl.bimbase.bimworks:sdk, generated from the OpenAPI) or the classic Java client from the private Maven repository, and check that it connects.
- .NETInstall the .NET SDK (BIMworks.Sdk, generated from the OpenAPI) or the classic BIM.works_SDK package from nuget.org or the BIM.works feed, including pre-release versions, and check that it connects.
- PHPInstall the PHP SDK, the bimbase/bimworks Composer package, from the private registry, and check that it logs in.
- PythonInstall the bimworks package from the private Python index with uv, Poetry or pip, pinned to that index, and check that it imports.
- DownloadsGet the single-file JavaScript builds, the Java jar and the .NET package from your BIM.works instance instead of a registry.
Authentication#
Choose how your application logs in, which token it needs, and how long each token lives.
- Create an API tokenCreate a long-lived, revocable API token on a folder, in the UI or with the CreateApiToken call, and store its secret.
- Log in with an API tokenCreate a client from an API token in JavaScript, Java, .NET, PHP or with a plain HTTP call, and know what the login gives you.
- Log in with a username and passwordLog in with an account's credentials for development and testing, and know why production code uses an API token instead.
- Create a versions tokenIssue a short-lived token for an exact set of model versions in your backend and use it in the browser.
- Create a nodes tokenIssue a short-lived token for a set of nodes, including the versions they will get later, and use it in the browser.
- Create a recursive-node tokenIssue a short-lived token for one folder and everything below it, and use it in the browser.
- Use an anonymous tokenGive a user without an account a private folder: create an anonymous token, store it, and log in with it for an hour at a time.
- Refresh an expired tokenKeep a browser page working past the lifetime of its delegated token with the JavaScript SDK's expired-token handler, and what the other SDKs do instead.
Models#
Upload, find, download, change, compare, delete and restore models in the tree of nodes and versions, with every SDK and over HTTP.
- Upload a modelUpload a model from a file or a stream into a folder, follow the progress, and find the version it created.
- Upload models concurrently from .NETUpload a batch of models with one .NET client so the server checks them in at the same time, wait for all of them, read each result, and know what may run on which thread.
- Upload from a URLLet BIM.works download a model straight from cloud storage with a pass-through URL, and when to download it yourself instead.
- List the treeFind the root node, list a folder, walk a subtree, and look a node up by path or by one of its versions.
- Create a folderCreate a folder node under a parent, or get the existing one, in every SDK and over HTTP.
- Download a modelDownload the original file of a version, the same model as ifcXML or converted to IFC4, or a whole folder as a zip archive.
- Export to glTFExport a model, or the objects a BQL condition selects, as binary glTF (GLB) for three.js, Blender, game engines and AR viewers; what is in the file, the one-time download URL, several models in one file, and exporting through a versions token.
- Change a model with BULSend BUL statements to CommitTransaction to change property values, move, rotate or delete objects, try them first as a dry run, and get the new version they create.
- Compare two versionsCompare a version with the one before it from code, read the categories, the similar changes and a shared move, follow objects to the new version, and turn an upload's changes into BUL.
- Delete and restore a nodeSoft-delete a node so it disappears from listings, and restore it later; what cannot be deleted and when a restore fails.
3D viewer#
Embedding the Viewer3d in your own page and driving it from JavaScript: switching models, the camera, navigation modes and walking, selection and colours, x-ray and the proximity fade, storeys and floor plans, hiding, section planes, measuring, the grid, DWG drawings, PDF floor plans aligned with a model, point clouds, geo mode, offline use and screenshots.
- Show your users' models in your web appYour backend keeps the API token and gives each visitor a short-lived versions token for the models they may see; your page loads the 3D viewer with that token and asks for a new one when it expires.
- Embed the viewerPut a Viewer3d in a page, load a model and know when it is fully loaded; where the viewer's modules come from, calling the API from another origin and switching web workers on.
- Choose the 3D viewerRun Viewer3D-Next (WebGPU) where the browser can and Viewer3D (WebGL) where it cannot, downloading only the one in use, or keep to one of the two; what decides, how to steer it with rules, and what happens when WebGPU fails.
- Switch between modelsLoad several models once and switch between them — show one at a time, highlight one with the others grey, or swap the loaded model for another — without reloading.
- Navigation modesStart the default, walk, game or drone mode, define a custom mode with its own key bindings, and know which forwardMode values the viewer actually implements.
- Set the camera from codeChoose the first view of a model, jump to the front, side and top views, zoom, switch to orthographic, save and restore a viewpoint, and fly to a viewpoint a BQL query computes.
- Walk through a buildingWalk through a building at eye height with collision, gravity, stairs, jumps and storey jumps on the walkable surfaces the server computes, show a route, and name the room and zones the camera is in.
- Select and colour objectsSelect objects by Qid or by query, listen to selection changes, choose SHIFT or AUTO multi-selection, and set, batch and reset colours through the ObjectStateManager.
- X-ray a set of objectsPut any set of objects in x-ray from code, without selecting them, so the viewer draws them with translucent faces and edges through the walls, floors and ceilings in front of them.
- Animate state changesChange visibility, ghosts, the selection, the x-ray set, colours and the camera in one ObjectStateManager call that animates, step after step, running together, queued or replacing what runs, and stopped at its start, where it is or its end.
- Show building storeysList the storeys of one or more models as one set of floors, show a floor on its own and fit the view to it, toggle floors with checkboxes, and show or hide the objects that are in no storey.
- Show a floor planTurn the 3D viewer into a floor plan — one storey, an orthographic camera looking down, 2D mode (a drag turns the plan, nothing tilts), the ceilings hidden and every room labelled with its number, name and area — the replacement for the 2D viewer.
- Show models in several viewportsA 3D view and a floor plan of the same models side by side, or more viewports, loaded once: one ModelManager, a Viewer3d per viewport, each with its own state and camera, closable in any order.
- Hide and isolateHide objects, show only a set, show a storey on its own, fit the view to a selection and bring everything back; what the H key, the middle button and F do.
- Fade walls near the cameraMark walls, roofs and coverings as soft occluders so they fade out and become click-through as the camera comes close, and zooming into a building reveals the interior without hiding anything by hand.
- Annotate a modelEvery way to put information on objects in the 3D viewer — labels, icons, templates, live data and BVL — on one model.
- Section planesStart section planes on the sides of the models, on a right-clicked face or as a section box around them, let the user place and drag planes with Ctrl + left drag, list the planes by name, and remove them one by one or all at once.
- Show the reference gridSwitch on an infinite metric grid in the ground plane that the camera orbits and zooms over, that double-click flies to, and whose intersections snap like vertices.
- Geo modeSwitch the viewer between LOCAL and GEO placement, know why the switch can fail, and add basemaps, terrain and 3D Tiles as GIS layers.
- Measure areas, angles and with the laserStart the distance, path, point, area, angle and laser measurements from code, draw stored measurements again, and listen to what the user measures.
- Measure the distance between two objectsCompute the shortest distance between the surfaces of two objects, or vertically or horizontally, interactively or from two Qids, and draw or restore the result as a measurement.
- Show DWG drawingsLoad a DWG drawing into the 3D viewer next to IFC models, switch between model space and its paper-space layouts, read its layers, and align it under the building.
- Align PDF floor plansPut PDF floor plans under the building in the 3D viewer — two points clicked on the sheet and in the model, in two viewers side by side, give the alignment of one plan, and the storey elevations place the plans of the other floors.
- Show point cloudsUpload an E57, LAS or LAZ point cloud (COPC included) and stream it into the 3D viewer next to an IFC model, with the upload settings for unit, colour and intensity.
- Work offlinePrepare models for offline use while online, then load them in the 3D viewer without a connection — what is stored, what works offline and what does not, errors, storage, and keeping the offline set up to date.
- Take a screenshot in the browserTurn what the 3D viewer shows into a PNG, with or without a background, and render a series of images at a fixed size from a viewer that is never on the page.
2D viewer#
The Viewer2d, which draws the floor plans BIM.works generated per storey, is being phased out; for new work, show plans in the 3D viewer with an orthographic camera.
- Show floor plans in the 2D viewerCreate a Viewer2d, list the storeys and show one, colour, select and label objects, load it with a versions token, and destroy and unload it again.
Geo referencing#
Read, extract and store the geo reference of a model version, and set the alignment matrix, from JavaScript, Java and the OpenAPI.
- Get the geo referenceRead the geo reference stored on a version, in WGS84 or converted to another EPSG system, from JavaScript, Java or the OpenAPI, and detect a model that has none.
- Extract a geo reference from an EPSG code or WKTDerive a geo reference from the coordinates in the model, given the CRS they are in as an EPSG code or a WKT definition, or from IfcSite and IfcMapConversion; nothing is stored until you set it.
- Get the footprintGet the outline of a model on the ground with BQL — the projection, its smallest rectangle or a slice at a height — as GeoJSON or WKT in WGS84, placed by the version's geo reference, and draw it on a map.
- Set the geo referenceStore a geo reference and its anchor point on a version from JavaScript or Java, and refresh the loaded model in the viewer.
- Set the alignmentStore, read and clear the 4×4 alignment matrix of a version, and let the server compute one from point pairs.
Query#
Run BQL queries against model versions from every SDK and over HTTP, count and validate them, bind parameters, and query several models at once.
- Run a BQL querySend a BQL query to one or more versions in JavaScript, Java, .NET, PHP or over HTTP, and read the records that come back.
- Count resultsGet the number of objects a query matches without fetching them, with a count call or with a COUNT aggregate.
- Use query parametersWrite $name placeholders in a query and bind their values at call time, instead of building query strings from user input.
- Query models that use different classification systemsDefine one virtual classification that reads NL-SfB where a model has it and translates Uniclass where it does not, so a query names one code instead of an OR per system.
- Validate a queryCheck that a query parses and uses only available features before running it, from the SDKs or with an empty model set over HTTP, and read the line and column of what fails and the warnings, with suggestions, of a query that parses.
- Convert 2.x queries to 3.0Send the BQL queries, BVL visualisations and BCL checks your application keeps itself, written for BIM.works 2.x, in one request and get them back in the 3.0 syntax, with what changed, or with the error that is left for you to fix.
- Query multiple modelsRun one query over several versions, tell the results apart by version, and select the models under a folder over HTTP.
- LLM assistanceTurn a sentence into a BQL query or a BVL visualisation with TextToAction, run it on the server with Query or ResolveBvl, and show the result in the 3D viewer, all through the OpenAPI.
Checks#
Run IDS and BCL checks against models from the SDKs and the OpenAPI, and get the results as JSON or BCF.
- Run an IDS check via the APIValidate an IDS and check one or more versions against it from JavaScript, Java, .NET or the OpenAPI, read the per-object results and the status per specification, and download them as BCF.
- Get the validation report via the APIRead the validation report of a version or of a failed check-in with filters by stage, rule, severity and object, run the schema check again, and choose how much the instance checks.
- Check a building's plotHold every building's plot area — its walls, slabs and the rest merged at the ground — against a limit with a BCL check, see the outline each result measured in the 3D view, and read the measured value, the limit and the outline from code.
Rendering#
Images and drawings the server renders — a screenshot of a viewpoint, an SVG floor plan, section or elevation — and the render backend an instance needs for them, with or without a GPU.
- Render a screenshot on the serverAsk the server for an image of a model version from the viewpoint of the 3D viewer, which the camera gives in the metres the API works in.
- Export a vector drawingExport an orthographic view of a model as SVG instead of a raster screenshot — a floor plan cut above a storey, a section or an elevation, with every product its own group — and restrict, colour and label it with BQL and BVL.
- Configure the render backendChoose the OpenGL or Vulkan render backend of an instance, let it render on a software Vulkan device where there is no GPU, enable vector exports, and fix UNIMPLEMENTED_ERROR and NO_3D_RENDERER.
Debugging#
Turn up the logging of the JavaScript libraries and inspect what the viewer and the SDK do in the browser.
- JavaScript loggingSet the log level of all BIM.works JavaScript libraries from code with log.setLogger, or from the browser console with bimworks.setLogLevel, optionally persisted in localStorage.
Task API#
Calls that have no typed SDK method yet, made through the task API with the JavaScript SDK's low-level client.
- Link data to objects from codeLink a file, a URL, a text or an identifier to objects of a version with the JavaScript SDK or the OpenAPI, list what a later version shows, download a file, replace or delete an item, and confirm, re-attach or end a link.