Webgl-threejs

Result of BIM codesprint 2011

View the Project on GitHub opensourceBIM/WebGL-threeJS

This project started at openBIMweek 2011. Now maintained by the community.

ThreeJs viewer consists of a server side part (serializer plugin) and a clientside part (ThreeJs based javascript scenegraph).

How to deploy the server side part

Use plugin binaries

In order to add the serzializer plugin to your BimServer instance, just grab the plugin jar file from the list below and drop it into the BimServer plugin folder. Make sure to use the plugin version matching your BimServer version.

Binary releases can be found on Github.

threejs-20150924-0.5.jarSerializer plugin for Bimserver 1.4 final with bug fix
threejs-serializer-0.4.jarSerializer plugin for Bimserver 1.2 RC7
threejs-serializer-0.3.jarSerializer plugin for Bimserver 1.2 beta
threejs-serializer-0.2.jarSerializer plugin for Bimserver 1.1 final
threejs-serializer-0.1.jarSerializer plugin for Bimserver 1.1 beta

Heavyweight plugin development

Use this method, if you need the full-blown Bimserver under your fingertips for debugging.

  1. checkout the BimServer source code and setup your IDE for BimServer development, e.g. for Eclipse as explained here

  2. create a new project (Eclipse) or module (other IDEs) and checkout the ServerPlugin

  3. Add the following line to org.bimserver.LocalDevPluginLoader.java: pluginManager.loadPluginsFromEclipseProject(new File("../JsonModelFormat2Serializer"));

Lightweight plugin development

Use this method, if you don't want to poke around the full Bimserver sources and are brave enough to mess around with the Bimserver starter.

  1. checkout the Plugin code only (no need for the Bimserver sources)
  2. compile with debugging enabled and deploy to a binary Bimserver instance (drop in plugin directory)
  3. use your favorite debugger for remote debugging
  4. the JVM has to be started with remote debugging enabled. Depending on your debugger and settings the respective options look similiar to this: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005. Because the Bimserver starter spawns another JVM for the actual Bimserver (including the plugin you want to debug), you have to pass these options to the child JVM. You can do so by appending them to one of the memory settings in the Bimserver starter form separated by a space, because there is no sanity check. Alternatively run the Bimserver starter from the command line and copy the child JVM spawning command which is printed there.

How to run the client side part

Serve the web application

Because the communication between client and server through the JSON API relies on CORS you have to serve the client files from an origin different from the Bimserver location. For local development fire up a simple Webserver exposing the client html and javascript files. Some options:

Watch models

Open index_served.html and fill in the fields in the upper part in order to load models from the server.

The functionality is very simple at present:

Embedding is not yet streamlined, you'd have to fiddle with the html/javascript on your own currently.

Useful tools for developing and debugging