Visitar URL original
GitHub - mcneel/rhino3dm: Libraries based on OpenNURBS with a RhinoCommon style · GitHub
Skip to content
mcneelPublic

About

Libraries based on OpenNURBS with a RhinoCommon style

Topics

Resources

Contributing

Stars

775 stars

Watchers

51 watching

Forks

Repository files navigation

rhino3dm

workflow ci workflow release PyPI PyPI - Downloads npm npm - Downloads NuGet NuGet - Downloads

Read, write and create Rhino 3D models (.3dm files) in Python, JavaScript and .NET.

rhino3dm brings openNURBS, the library behind Rhino's file format, to Python, JavaScript and .NET with RhinoCommon's API.

  • Create, inspect and edit every geometry type Rhino supports: points, point clouds, NURBS curves and surfaces, polysurfaces (B-Reps), meshes, SubDs, extrusions and annotations
  • Work with the rest of a model: layers, materials, object attributes, transforms, views
  • Read and write all of it to and from .3dm files
  • Send geometry to Rhino.Compute for operations that need Rhino
  • Runs on Windows, macOS and Linux, and in the browser

rhino3dm 9.2 (beta)

In 9.2 the Python and JavaScript libraries are generated from RhinoCommon, so their API is RhinoCommon's in every language: the same class names, member names, signatures and behaviour, and the RhinoCommon documentation applies to all three. Most 8.x Python and JavaScript scripts need changes; .NET code mostly does not.

9.2 is a pre-release. The default install is still the latest 8.x; install the beta as shown below.

Python

pip install rhino3dm           # latest stable (8.x)
pip install --pre rhino3dm     # 9.2 beta

Wheels for CPython 3.10 to 3.14 on Windows, macOS and Linux.

import rhino3dm as r

model = r.File3dm()
model.Objects.AddSphere(r.Sphere(r.Point3d(1, 2, 3), 12))
model.Write("sphere.3dm", 8)

rhino3dm.py documentation · API reference · PyPI · Samples

JavaScript

npm install rhino3dm           # latest stable (8.x)
npm install rhino3dm@next      # 9.2 beta

rhino3dm.js is compiled to WebAssembly and runs in every current browser and in Node.js 22+. In a browser you can load it from a CDN without installing anything.

import rhino3dm from 'rhino3dm'

const rhino = await rhino3dm()
const model = new rhino.File3dm()
model.objects.addSphere(new rhino.Sphere({ X: 1, Y: 2, Z: 3 }, 12))
const bytes = model.toByteArray()

For three.js there is a 3dm loader built on rhino3dm.js.

rhino3dm.js documentation · API reference · npm · Samples

.NET

dotnet add package Rhino3dm                 # latest stable (8.x)
dotnet add package Rhino3dm --prerelease    # 9.2 beta

Rhino3dm (formerly Rhino3dmIO) is built from RhinoCommon's own source. One NuGet package carries the native libraries for Windows, macOS and Linux.

using Rhino.FileIO;
using Rhino.Geometry;

var model = new File3dm();
model.Objects.AddSphere(new Sphere(new Point3d(1, 2, 3), 12));
model.Write("sphere.3dm", 8);

Rhino3dm documentation · RhinoCommon API reference · NuGet · Samples

Building from source

See the build guides for Python, JavaScript and .NET, and CONTRIBUTING.

Help and discussion

License

MIT

About

Libraries based on OpenNURBS with a RhinoCommon style

Topics

Resources

Contributing

Stars

775 stars

Watchers

51 watching

Forks

Releases

Packages

Used by

Contributors

Languages