How-to guide·InstallJavaScript · Java · .NETRequires DOWNLOAD_BUILDS

Downloads

Get the single-file JavaScript builds, the Java jar and the .NET package from your BIM.works instance instead of a registry.

For developers who cannot, or do not want to, use the npm, Maven and NuGet registries: a page without a build step, a build machine without internet access, an audit that wants the exact files. A BIM.works instance embeds the builds of its own version and serves them through its API.

Before you start#

  • An account on the instance with the DOWNLOAD_BUILDS feature. Without it the download call is refused.
  • The builds are the instance's own version. Mixing a downloaded build with packages of another version from a registry is not supported.

1. List and download the builds#

Two API calls serve the builds: GetEmbeddedBuilds lists what the instance ships (group id, artifact id, version, classifier, extension, build time, size), and DownloadBuild streams one of them, named by the groupId, artifactId, version, extension and, when it has one, classifier from that list. The instance reads the list from its builds/builds.json, so an instance that was built without embedded builds has nothing to offer.

2. JavaScript: the single-file modules#

The JavaScript packages are also built as one ES module per package, named <package>.bimworks.js for the BIM.works packages and <package>.sascom.js for the two base packages:

File npm package it replaces
jssdk.bimworks.js @bimworks/jssdk
viewercommon.bimworks.js @bimworks/viewercommon
viewer3d.bimworks.js and its workers/ and assets/ folders @bimworks/viewer3d
viewer3d-next.bimworks.js and its workers-next/ folder @bimworks/viewer3d-next
viewer3d-auto.bimworks.js @bimworks/viewer3d-auto; it imports the two viewers by their package names, so the import map lists all three
viewer2d.bimworks.js @bimworks/viewer2d
viewers.bimworks.js and its workers/ folder @bimworks/viewers
commonjs.sascom.js @sascom/commonjs
jsclient.sascom.js @sascom/jsclient

They are ES modules only; there are no ES5 or UMD builds. Serve the files from your own site and import them with an import map, so your code keeps the same bare specifiers as an npm build. The 3D viewers load their web workers from the folder next to their file, so keep it with them: workers/ for Viewer3D, with assets/ beside it for the code its workers load, and workers-next/ for Viewer3D-Next. A page that uses viewer3d-auto.bimworks.js downloads only the viewer it picks, so listing both viewers in the import map costs nothing (Choose the 3D viewer):

XML#
<script type="importmap">
{
  "imports": {
    "@sascom/commonjs": "./lib/commonjs.sascom.js",
    "@sascom/jsclient": "./lib/jsclient.sascom.js",
    "@bimworks/jssdk": "./lib/jssdk.bimworks.js",
    "@bimworks/viewercommon": "./lib/viewercommon.bimworks.js",
    "@bimworks/viewer3d": "./lib/viewer3d.bimworks.js",
    "@bimworks/viewer3d-next": "./lib/viewer3d-next.bimworks.js",
    "@bimworks/viewer3d-auto": "./lib/viewer3d-auto.bimworks.js"
  }
}
</script>
<script type="module">
  import {BimWorksClientFactory} from "@bimworks/jssdk";

  const factory = new BimWorksClientFactory("https://bim.works");
</script>

Take every package a page uses from the same download; the packages share classes (Qid, the object state manager) that must come from one copy. For projects with a bundler or Node.js, the registry is the better route: JavaScript and TypeScript.

3. Java: the client jar#

For Java the instance offers client-<version>.jar, the nl.bimbase.bimworks:client artifact on its own, without its dependencies. It is meant for a repository manager that cannot reach maven.bim.works; install it there (or with mvn install:install-file) and let Maven resolve the dependencies listed on Java. A plain classpath needs the shaded artifact instead, which the instance does not embed.

4. .NET: the package#

For .NET the instance offers the BIM.works_SDK .nupkg of its version. Add its folder as a package source (dotnet nuget add source <folder>) and install it like any package; see .NET for the pre-release switches.

Check#

The version in the GetEmbeddedBuilds list equals the version pill of the instance (the top of this page shows it), and the downloaded file opens: the JavaScript files start with ES import/export statements, the jar and the package are zip archives. Then continue with Log in with an API token.