Skip to main content

How to add a sphere using the code editor

In a future release we will be adding the ability to add a sphere by revolving a circle. In the current version, you can add a sphere (and almost anything else) using JSCAD in the code editor.

1. Go to CADit.app

2. Click on the "add object" button

3. Click "Add your own" to open the code editor

4. Delete everything in the code editor and copy/paste the following code

   const { primitives } = jscad;

const sphere = primitives.sphere({
radius: 20,
segments: 64
});

return sphere;

You can edit the radius to change the size but you don't need to, you can just resize it later in the visual editor

5. Click on GENERATE

6. Click on EXIT CODE MODE

7. Now we have a sphere!

The sphere in the 3d view isn't displaying depth properly right now. That will be fixed soon.

For some perspective, here is the sphere with a star