Rhino File from Three.js - Surface from Polyline + unit settings fails

Hey there,

I want to use the rhino3dm.js library to create a Rhino file from a Three.js scene.
It works for BREPS, Points and Polylines (to NurbCurves with degree 1)

But it fails when I want to create a Planar Surface from a closed Polyline (no create() on Surface Class)

And I also can’t figure out how to change the doc units (to meter) like I am used to from Rhino Common

Any help would be greatly appreciate!

For the units I tried this one but it doesn’t work:

this.doc = new this.rhino.File3dm()
this.doc.AdjustModelUnitSystem(UnitSystem.Meters, false);

Maybe @fraguada

Okay apparently, this does the job:

const unitSystem = this.rhino.UnitSystem.Meters
this.doc.settings().modelUnitSystem = unitSystem 

If someone would have a solution for the Surface issue I would be more than happy!

Hello Niklas,
There is no method for creating a Planar surface from a closed polyline in rhino3dm. These kinds of operations are only found in Rhino, accessible via RhinoCommon.

1 Like

Hi @fraguada
Thank you! At least good to know.

So it’s just the methods mentioned here: Home - Documentation. ?

And is there any plan to extend rhino3dm?
We would like to offer the user to export his Three.js model to Rhino Geometry (more than just meshes) to continue modeling in Rhino

But maybe it is also just not possible to provide all the Rhino functionality in rhino3dm :sweat_smile:

We are continuously working on rhino3dm.

rhino3dm is an open source, royalty free, and free to use library for reading, writing, and creating Rhino 3dm geometry and data. It is based on our open source project openNURBS. Most things that involve creating NURBS geometry like surfaces and breps is only available via Rhino with a suitable license.

Not all things in openNURBS are yet wrapped in rhino3dm, but we are working on it.

Three.js mostly works on Meshes, so creating NURBS from the data you get from Three.js is not trivial. If you have an example of geometry in Three.js you want to convert to Rhino geometry as NURBS, please share it here. Primitives might be straightforward to do (spheres and boxes).

If you need Rhino functions that are not in rhino3dm, you could look at Rhino.Compute.

1 Like