I'm attaching the script that exports a mesh to Gmsh .msh format. The script also includes the parts that import the geometry, mesh it and declare groups based on it -- I haven't tested the export part without these steps, so thought it would be safer to include them too. As I've mentioned, it works for my examples, but there's no guarantee it works for other types of meshes -- it would be good if someone would have time to turn it into a complete exporter. The script may not be extremely optimized (it's my first Python code), but it seems to work OK.
Mesh generators, CAD programs, and other tools