3D mesh for a solid

Using your script I get this result:
3d mesh 7
Is it not possible to have a mesh that fits the geometry of the brep? Of course not with the same size of the mesh. Or even if it uses tetrahedral mesh.

This isn’t the right approach. You should go surface to surface for each of the parts of your geometry like my example. But that may or may not work depending on what other geometry you have. If you use a rectangle of filled voxels to start you will always end up with pixilated edges as you have or cut voxels at the edge.