# Capturing mesh information

## Mesh information

Using the helpful tips from Triangular mesh of random points on a sphere, it's easy to generate solids:

reg = DiscretizeGraphics[Sphere[{0, 0, 0}, 5],
MaxCellMeasure -> {"Length" -> 15}]

MeshCellCount[reg]


The interrogation tab provides useful information, but it would be helpful if the data could be captured in a text format.

## Question

How can the information in the information tab (shown below) be harvested with a script?

## Screen capture

I don't think there's anything particularly special in the mesh info tab. All of it can be found with various functions which I've encapsulated below:

meshinfo[mesh_] := {{"Embedding Dimension", RegionEmbeddingDimension[#]},
{"Geometric Dimension", RegionDimension[#]},
{"Vertex Cells" , MeshPrimitives[#, 0] // Length},
{"Edge Cells" , MeshPrimitives[#, 1] // Length},
{"Face Cells" , MeshPrimitives[#, 2] // Length},
{"Volume Cells" , MeshPrimitives[#, 3] // Length},
{"Area", Area[#]},
{"Region Bounds", RegionBounds[#]},
{"Region Centroid", RegionCentroid[#]}} &@mesh

meshinfo[reg] // Grid

Association[Rule @@@ meshinfo[reg]]

• (Here) MeshPrimitives[#, 0] // Length == VertexCount[MeshConnectivityGraph[reg]], MeshPrimitives[#, 1] // Length == EdgeCount[MeshConnectivityGraph[reg]], and MeshPrimitives[#, 2] // Length == Length@FindCycle[MeshConnectivityGraph[reg], {3}, All] Jun 26, 2020 at 20:21
• You can use MeshCellCount instead of listing out and counting all primitives. Jun 27, 2020 at 1:39