This web app provides access to the powerful OpenCascade geometry kernel, either directly or though the higher-level APIs provided. It uses a modern code editing environment linked to an advanced model viewer that lets you select and interact with the resulting shape as well as its surfaces, edges and vertices.
This is not intended as a fully-fledged CAD app (that is coming later), but rather as a tool to let you programmatically generate complex shapes that you can use in other tools and applications. Thus, its core focus is on the creation of single or composite shapes that you can then transfer or export to other environments.
This app was inspired by the work of Johnathon Selstad (zalo) and his Cascade Studio project on GitHub. It was the first viable example of using the OpenCascade.js WASM module I had seen and greatly influenced my approach to building this app.
The best way to get started with this app is to look at some of the included example scripts. These are in the OpenCascade Examples and PD.Shape Examples items in the CODE menu, located in the main navigation bar at the top of the application browser tab.
Using OpenCascade classes and methods directly can be quite daunting, so this app provides a high-level CAD API that lets you use OpenCascade in a much simpler and more intuitive way. The app also provides a lower-level OCC API that offers much greater flexibility and control, but still with a similarly simple and intuitive method structure.
In addition to these APIs, the app offers direct access to the PD.Shape and PD.Polyhedron classes for creating complex faceted geometry using a wide range of shape generation algorithms, and then converting them to OpenCascade shells and solids to operate further on.
The following are some of the stand-out features of this app:
I have been experimenting with constructive solid geometry in Javascript for quite a while now, especially after the release of CSG.js on GitHub back in 2011. I watched with interest as that code was used in THREE.js, Babylon.js, OpenJSCAD and some other tools.
Unfortunately CSG.js and its variants don't preserve polygonal boundaries very well as each operation can split surfaces into multiple triangular fragments or shards. That's fine if you are just rendering the surfaces, but architectural and engineering drawings need to show edges and boundary outlines, and the resulting shapes often look like they have been chopped up by a band of particularly angry Ninjas.
I have tried all sorts of solutions attempting to piece adjacent coplanar shards back together into usable bounded polygons, but never with sufficient success or robustness to be useful. I then came across OpenCascade.js, via the Cascade Studio project, and that geometry kernel seemed to solve most of these issues.
As with most of my apps, this one began life as a development tool that let me quickly and easily test the implementation of my OpenCascade support library, and visually validate the results. I have since extended it to include my own PD.Shape
and PD.Polyhedron
classes, as well as some of my array-based geometry utilities. I think the result is an app that at least rivals the likes of OpenJSCAD, and in several respects may even be better.
Most modern browsers will automatically download generated files into a default location, typically the 'Downloads' folder in your user area, and will not overwrite any existing files.
To see a 'File Save As' dialog and control the full filename, you need to specifically set your browser to prompt you for the location of each download within its advanced settings.