Skip to main content
This guide will walk you through creating a simple 3D scene with OpenGeometry and rendering it with Three.js.

Prerequisites

Make sure you have completed the installation steps and have both OpenGeometry and Three.js installed.

Basic Setup

Let’s create a complete example that renders a 3D cuboid in the browser.
1

Create HTML container

First, set up a basic HTML page with a container for your 3D scene:
2

Initialize Three.js scene

Create a main.ts file and set up a basic Three.js scene:
3

Initialize OpenGeometry

Initialize the OpenGeometry before creating shapes:
4

Create a 3D shape

Now create a cuboid and add it to the scene:
The Cuboid class extends THREE.Mesh, so it can be added directly to Three.js scenes. All OpenGeometry shapes work this way.
5

Add animation loop

Finally, create the render loop:

Complete Example

Here’s the complete main.ts file:

Try Other Shapes

OpenGeometry provides many built-in shapes. Try experimenting with different primitives and shapes:

Cylinder Example

Sphere Example

2D Primitives

You can also create 2D primitives like lines, arcs, and curves:

Next Steps

API Reference

Explore the complete API documentation for all shapes and operations

Live Examples

See interactive examples showcasing all features
For more complex examples including sweep operations, offset curves, and advanced CAD operations, check out the OpenGeometry Examples repository.
Last modified on March 14, 2026