Permalink
Switch branches/tags
Find file Copy path
badc474 Oct 20, 2018
2 contributors

Users who have contributed to this file

@sbaer @scotttd
49 lines (30 sloc) 2.46 KB

rhino3dm.js

rhino3dm.js is a javascript library with an associated web assembly (rhino3dm.wasm) that is OpenNURBS plus additional C++ to javascript bindings compiled to web assembly. The library based on OpenNURBS with a RhinoCommon style. The libraries will run on on all major browsers as well as node.js.

CircleCI


Usage

Rhino3dm.js requires two filesrhino3dm.wasm and rhino3dm.js. It is easiest to simply reference the latest build directly from our servers:

<html>
  <!-- stuff -->
  <body>
    <script async type="text/javascript" src="https://files.mcneel.com/rhino3dm/js/latest/rhino3dm.js"></script>
    <!-- more stuff -->
  </body>
</html>

API Docs

The latest rhino3dm.js API Documentation

Download the files

If it would be better to download a static build locally, download the latest build of the two files:

Place these in the same folder. The rhino3dm.js references the rhino3d.wasm.

Note: A list of builds is available on our Circleci project. You can replace latest with dujour/BUILD_NUMBER if you know what you're looking for!

Example

There a few samples are available in the Github Repo Samples folder

An advanced sample creates a 3dm file viewer in a web browser. The html+javascript to create the viewer is around 300 lines (including comments) and runs on all browsers including mobile devices.

rhino3dm.js is used to read a 3dm file and create an instance of a File3dm class in the browser’s memory. It then walks through the objects in the model and calls compute.rhino3d.com to create meshes and isocurves for the polysurface. These meshes and isocurves are then added to a three.js scene for display.

Build from source

If the pre-compiled libraries above do not work in your situation, you can compile the libraries from their source. For detailed instructions go to rhino3dm.js and rhino3dm.wasm