OpenCAD · WebGL2 library for developers

OpenCAD 3D Viewer Core

This is a WebGL2-based 3D viewer library used by NC, STEP, and SKP viewers. It provides common functions to receive, display, select, and measure scenes created by an interpreter.

Screen showing an example assembly model opened with the OpenCAD STEP viewer. In the center, the two blocks on the base plate, pins, and rings are visible in 3D, and the right panel has a product tree and a list of visible parts.A screen showing an example house model opened with the OpenCAD SketchUp viewer. The red-roofed house, trees, and grass floor are shown in 3D in the center, and the right panel contains a list of 6 tags and 11 materials.Screen showing example G-code opened with OpenCAD NC viewer. In the center, the tool paths for the outer contour, circular pocket, and drill hole are shown in different colors for each tool, and in the right panel there is a playback bar and a list of G-code lines.
The NC, STEP and SKP viewers drawn with this core

About this tool

A common library for OpenCAD that separates the code for parsing files from the code for rendering the display. It accepts a Scene3d scene—composed of triangular meshes, line segments, and points—and enables consistent manipulation and measurement functions across various types of viewers.

Display
WebGL2 shading, edges, wireframe and X-ray, shadows and fog, line and point drawing
Operation
Rotate, pan and zoom, touch controls, view cube and standard views, walking that follows the floor
Selection
BVH-based picking, an index that finds snap points quickly even among hundreds of thousands, per-group visibility and outline color, high-resolution image export
Measure
Two-point measurement that snaps to endpoints, midpoints, circle centers, intersections, perpendicular feet and axis directions, Shift direction lock and axes tracked from other points, minimum distance between faces
Section
Multiple section planes with cut-face fill, per-group origins that keep large coordinates from jittering
Connection
Scene3d scene format shared with NC·STEP·SKP interpreters, a refinement hook that lets apps move snapped points onto the exact curves and surfaces, and single-mesh updates (used for NC stock removal)

Developer integration

  1. Check installation/use examples and Scene3d types on GitHub.
  2. Attach Viewer3d to a screen element and pass the interpreted scene to setScene.
  3. Completed usage examples can be found under "Open Example" in the NC/STEP/SKP viewer.

Support and limitations

  • This is a library for development; there is no dedicated site for opening files. Please use the appropriate viewer for each file format to inspect the actual files.
  • File parsing functionality is not included in this core; it is handled by the respective NC, STEP, and SKP modules.

Use a browser that supports WebGL2 and JavaScript. OpenCAD is a personal open source project released under the MIT license.