Custom Shape Editor

Typical script development process

  • Write script with or without parameters
  • Make sure you set properties of the published extension. Pay particular attention to the version number
  • Publish. You can create new versions or replace currently published version with new code.
  • Once published, add to a project. You can also add published shapes to a project from the dashboard.
Using console statement
Console display (Click on ‘Show Build log’ button in the status bar)

Use the console.log statements for debug purpose

Custom shape editor provides a way to create your own library of shapes and tools using standard JavaScript and CAD API. These shapes and tools are made available in the part designer catalog.

You can share these with the other members and build a powerful echo system around domain specific extensions relevant for your projects.

You will need basic understanding of Javascript to use this powerful feature.

Custom Shapes

Custom shapes will let you design arbitrarily complicated features using CAD API. These shapes are first class citizens in the sense that you can manipulate them from part designer just like built in shapes: using control handles and other feature editing operations. Custom shapes appear in the shape catalog once you publish them.

How-to Use Custom Shapes in the Part Designer

  • Enter Properties from the ‘Properties’ menu
  • Increment the version number to publish custom shape w/o overwritting existing version.
  • Click on ‘Publish’ menu
  • Verify the information
  • Once published, you will be offered option to choose a Part Project to add this custom shape to. You can also add custom shape to your project from the Part & Shape Library option

Developing a shape

Let us start by creating a simple cube.

//control handles
var controls = {};
var location = { origin: { x:0.0, y:0.0, z:0.0}, up:{x:0.0, y:1.0, z:0.0},forward:{x:0.0, y:0.0, z:1.0}};

function updateControls() { 

function updateParam(update) {

//Main function which returns the solid
function build() {
    return{width:5, height:1, depth:5});


This is the only function you need to implement. This function returns a solid to be consumed by the build process in the part designer.

Script parameters

You can add Number, String, SVG, Face and Line type parameter. Specify min, max and current value. These parameters will appear in the feature editor dialog for you to customize during design.

A global ‘params’ variable is accessible to the build() function. You can access these parameters in the scrip as below

function build(){ 
var radius = params.radius;
var cellsize = params.cellsize;
var thickness = params.thickness;

 var s1 = cadlib.torus({radius:radius, center:{x:0, y:0, z:0}, axis:[0,0,1],innerRadius:5, outerRadius:8});
var bbox = s1.bbox;
var ww = bbox.xmax - bbox.xmin, 
hh = bbox.ymax - bbox.ymin, 
dd = bbox.zmax - bbox.zmin;

const cell ={width:cellsize, height:hh, depth:cellsize});


Control Handles

Control handles will be supported in future updates. Do not delete variable definition


Enter the values in the global location variable if you want to set default orientation. Do not delete variable definition


This will be supported in future updates. Do not delete the definition


This will be supported in future updates. Do not delete the definition