1. Products
  2.   CAD
  3.   JavaScript
  4.   JSCAD

JavaScript Library to Create Parametric 2D & 3D CAD Designs

Open Source JavaScript CAD Library allows programmers to to create parametric 2D & 3D designs. Create your own renderer for 3D & 2D Geometries via Free API.

JSCAD is an open-source free JavaScript library that allows software developers to create and manipulate 3D models in a browser environment inside their own JavaScript applications. The library is designed to be easy to handle as well as very flexible, making it an excellent choice for a wide range of applications. JSCAD provides a set of tools and functions for creating complex models with ease, as well as a range of customization options for adjusting the appearance and functionality of your models.

JSCAD is a powerful tool for creating 3D models that can be used in a wide range of applications, from gaming and entertainment to scientific research and industrial design. The JSCAD library supports a wide range of file formats, including STL, OBJ, and 3MF, making it easy to export your models for use in other software applications. The library is very versatile and allows users to combine different shapes and elements to create complex structures and models, making it a versatile tool for designers, engineers, and hobbyists.

JSCAD has a very user-friendly interface and is designed to be very spontaneous. The library provides a range of customization options, allowing users to adjust the appearance and functionality of their models to suit their specific needs and preferences. With its wide range of customization options, advanced features, and support for a range of file formats, JSCAD is a powerful tool that can be used for a wide range of applications.

Previous Next

Getting Started with JSCAD

The recommended way to install is using npm. Please use the following command a smooth installation.

Install JSCAD via npm

 npm install @jscad/modeling 

You can also install it manually; download the latest release files directly from GitHub repository.

Create New Design via JavaScript API

The open source OpenCascade library supports multi-threading for certain operations. The library does not provide native support for multi-threading, as JavaScript is a single-threaded language. However, developers can use Web Workers in their application to perform certain tasks in a separate thread, which can improve performance and responsiveness. There following example demonstrates how to use a Web Worker to perform a heavy computational task in a separate thread while keeping the main UI responsive.

Create a Design & Export to STL Format via JavaScript

 const {CAG, CSG} = require('@jscad/csg');

// create a simple shape like a cube:

const cube = CSG.cube({
  center: [0, 0, 0],
  radius: 10

//export your design in a desired format:

const stlSerializer = require('@jscad/stl-serializer');
const stlData = stlSerializer.serialize(result);

Convert Designs Format in JavaScript Apps

The open source JSCAD library gives software developers the ability to convert format of any design to the other supported file formats. The library has included support for various popular file formats, such as STL, AMF, DXF, JSON, X3D, SVG images and many more. To convert the format of an existing file, first you need to load an existing file and choose the output file formats. The designs can be easily shared with others as file attachments to mail, messages, etc.

Load the Design & Convert It's Format via JavaScript API

const {CSG} = require('@jscad/modeling')
const {STL} = require('@jscad/stl-serializer')

// Load the design file in the desired format
const stlString = fs.readFileSync('design.stl', 'utf8')

//Convert the STL format to a JSCAD CSG object:

const design = STL.parse(stlString)
const stlString = STL.serialize(design)
fs.writeFileSync('manipulated_design.stl', stlString)

CAD Shape Transformations via JavaScript Apps

The JSCAD library makes it easy for software developers to creating 3D shapes and models inside their own JavaScript applications. The original shape can be transformed any number of times. The library has provided a set of functions and features for shape transformation, such as rotating Shapes by any given angle about the X, Y, and Z axis, scale shapes by any factor, shapes translation (moved) to another location, align or center shapes across X, Y, and Z axis, mirror (reflect) Shapes, and so on.

Shape Rotation About Single Axis via JavaScript API

const { cuboid } = require('@jscad/modeling').primitives
const { rotateX,rotateY,rotateZ } = require('@jscad/modeling').transforms
const myshape = cuboid({size: [5, 20, 5]})
let newshape = rotateX((Math.PI * 2 / 4), myshape)
newshape = rotateY((Math.PI * 2 / 24), newshape)
newshape = rotateZ((Math.PI * 2 / 12), newshape)