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 :slight_smile:

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

Sorry for my late reply and thanks alot for your answer.

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.x = sin(i*360.*deg/setting.seg)*setting.rad4;
        p.z = cos(i*360.*deg/setting.seg)*setting.rad4;
         p.y = setting.h0; 
         return p;
    },

// that repeat your rim ** that help you make solid edge in mesh
repeat:2
});

// connect help you for make face

rim.Connect(geo,
[rimName1] ,
[rimname2] ,
[flip] ,
[rimrepeat number for rimname 1],
[rimrepeat number for rimname 2 ] )

2 Likes

Thanks alot, i had no idea i could use external tools like this.
This might be super useful for future meshes too :slight_smile: