Description of the problem that is addressed in the patch.
With geometry node mesh primitives, it is currently possible to create a cube and then scale it arbitrarily along X, Y and Z axes. You can also subdivide the mesh but the number of subdivisions is equal along all axes. This means that making the basic frame for something like modular buildings isn't trivial.
Description of the proposed solution, and a motivation as to why this is the best solution.
This mesh primitive enhances the Cube mesh primitive and allows the creation of a cuboid with a configurable size and number of vertices in all 3 directions. The Cube primitive is now similar to the Grid primitive except that it works in 3 dimensions. Inspired by watching the modular building creation tutorials and looking at the demo files for the same.
The cuboid is created using the Mesh class, and so that large meshes with millions of faces are created quickly, Edges are calculated using BKE_mesh_calc_edges.
List of alternative solutions, and a motivation as to why these are undesirable
The alternative to a mesh primitive is to use multiple Grid primitives and rotate them into shape, which can get cumbersome and makes the node tree even harder to read.
Limitations of the proposed solution
As with other geometry nodes, UV maps don't work. This was tested in development using the following fragment of code, applying the Geometry nodes modifier and inspecting the UVMap of the resulting mesh.
MLoopUV *mloopuv = static_cast<MLoopUV *>(CustomData_get_layer(&mesh->ldata, CD_MLOOPUV));
if (!mloopuv) {
mloopuv = static_cast<MLoopUV *>(CustomData_add_layer(&mesh->ldata, CD_MLOOPUV, CD_CALLOC, NULL, config.loop_count));
}
for (int i=0; i<config.loop_count; i++) {
mloopuv[i].uv[0] = uvs[i].x;
mloopuv[i].uv[1] = uvs[i].y;
}Screenshots
Here is an example of the node in action.
And an example of what is possible when combined with some attribute math
Some sample files:
- Since the bounding box node was impacted, this file is to test that it works as before.
- Cuboid in action:
- And this one is to test versioning.



