# Create custom mesh

Hey,

i have a little project, where i stack cylinders over each other, and produce the final product.
It can be seen here: https://modellfabrik-webshop.netlify.app/

Right now i am working with three different cylinder sizes, which i load through .OBJ files.
I want to be able to dynamically change the heights of these cylinders and rewrite this program in a dynamic way. So i was having a look at the Meshbuilder and got this done so far:
https://www.babylonjs-playground.com/#EDGV77#2

So my custom cylinder looks almost like the .OBJ one, except for the bottom site. Iâ€™m not sure how i can accomplish this notch without specifying all faces manually. Later i want to be able to change the height of the cylinder dynamically.

Is there a way to somehow â€śsubstractâ€ť this top pin from the bottom side, so these cylinders could be stacked on top of each other?

Best,
Niklas

You can use CSG to build this mesh (Babylon.js - Constructive Solid Geometries demo), but an easier way would be to use a lathe to build the circular shape:

https://www.babylonjs-playground.com/#165IV6#3181

4 Likes

Actually i will work on this project again tomorrow and see if i can get it working. But on first glance this seems really promising. Thanks alot!

hi
you can use geometryBuilder

http://editor.5kb.me/#110334!rim

https://www.babylonjs-playground.com/#85R0C0#33

short document

// that make a rim mannager
var rim = new GB.Rims();

// you make rim and then you can attach them by connect

`````` rim.PushRim(geo,{
name:'start',                                    // rim name
count:setting.seg+1,                     // rim segment
``````

// point is a fun that called per point in rim p is {x:0,y:0,z:0} and i is a point index
// you can manage the p.xyz and at least you return p;

``````    point:function(p,i){
p.y = setting.h0;
return p;
},
``````

repeat:2
});