Written by community member Daphne Laméris, and you can see her key sleeve here.

ShapeJS, ever heard of it? I did, but it took me a long time to actually look at it and try to understand it. The whole idea of using code to model a part looked really hard, and is not what I am familiar with. I can use SolidWorks to model, tried Blender twice and Rhino once. In the end, I always stuck to what I knew, SolidWorks. It became time to step out of my comfort zone and try something new.

The great thing about 3D printing is the option for mass customization. For a lot of designs, I already use the co-creator options. This way, I can offer rings in difference sizes and a key sleeve that can be adjusted in size and with text. But every order still takes time to make and that order cannot be produced until I make the model. Therefore, I looked into ShapeJS.

shapeJS key label

With ShapeJS you can use javascript to make models. Numbers and texts filled into  textboxes can be used as parameters in your code. For my key sleeve, this could be the diameter of the key and the key thickness. For a better explanation you can check out the Shapeways.com shapeJS introduction.

So I set the goal to make my key sleeve in ShapeJS. It is a simple shape that needs multiple values of the user as input. The first problem is that I had no experience whatsoever with javascript before I started. Luckily, there are some examples available as well as some text. I read all the text and look at all examples, not understanding most of it. But I changed some values in the examples and saw what it did. Especially the example with the picture is fun, it’s easy to just upload a photo and see what it does. The next step was sketching the key sleeve. How could I build my design from simple shapes with  the Booleans? The original key sleeve was made with SolidWorks. Using code is a different way of modelling. It still works with solids, but you can’t make a sketch as with SolidWorks (well, at least not that I’m aware of). So I wrote down what the code should do:

pseudocode for shapeJS

The picture above was a first rough sketch (made without the intention to show it to anyone else, this is often referred to as “pseudo code” where you write out in plain words what you want to code to do and in what order). I wanted a hollow cylinder by subtracting a small one from the big one. Next a part should be cut out – this is the opening for the key. So I need to make a box, give it a position connected to the key radius and subtract it from the hollow cylinder. The design also needs a hole for the key ring. The position is determined by user input as well as the size of the hole. Finally, the key has some text that needs to be on the front. With this, I had my recipe for what I wanted to make. And then I realized I did not know what my ingredients were. The examples showed how to make a box, but how to make a cylinder? I couldn’t really find a list with explanation of all shapes and functions that would be useful for modeling. I did find more examples, and from that I used the cylinder. I’m not going to describe every step I took to create my model. But I can tell you how it went globally: like creating Frankenstein’s monster. Copy here, paste there. Use a part of this example, use a part of that example. Adjusting things to see how it works. Deleting stuff if I didn’t know what it did. If the script stills runs, okay. If not, put it back. It’s not a sustainable approach for creating very complex shapes, but it is a great way to learn new stuff.

shapeJS

In the end, it worked! With the set input from the user (key diameter, key thickness, keyhole diameter, distance keyhole to top) a key sleeve is created. It took most of my Sunday afternoon and evening (and a bit of my Saturday). Next step is getting in the ShapeJS co-creator pilot so this could actually be used for sale. And then it’s time to learn and create more!