# Generate a mesh given a vertex group from another mesh

Lets say I have a square meshed with a lot of triangles. I would like to generate a box following the position of a vertex group of the square mesh.

This is my input, with the vertex group selected.

I would like to obtain as a result something like this

That boxes should have a different material.

I am trying to achieve this using geometry nodes, but I am completely new to them and I have no idea where to start. Any tip would be very useful!

• You can try duplicating the mesh, then mask modifier > VG > Inverse ? and then a skin modifier Sep 29, 2021 at 15:17
• Guess I can do it that way, but I preferred something using geometry nodes, as I would learn another way to do it Sep 29, 2021 at 15:24

First you would have to prepare the inputs of your node accordingly. Just create two new inputs and set their type to Boolean. Assign the identifiers of your two vertex groups to these two inputs in the properties panel.

This way your node group gets the information which vertices fall into a certain group.

Then you have several options:

1. First, separate the vertices of the two vertex groups from your mesh and convert both to a curve. Assuming that it is indeed a rectangle or a square, you capture the length of one of the two curves. This will give you the side length.

With this side length you create a cube.

The two curves previously captured are resampled with three points, so that if you extract the center point of each, you get the center point for instantiating the cube.

2. Another variant would be (assuming that it is a square) to simply offset the cube by half of a side length in each direction.

There are several other (also simpler) possibilities, depending on what exactly you want to achieve and what your starting point is, but these examples should be able to point you in the right direction.