Prevent large, repetitive mesh data when exporting object with bevel + array modifier

I have an application into which I want to import scenes from Blender. To accomplish this, I wrote an exporter. The scene contains objects which have a combination of bevel and array modifiers; sometimes subdivision as well. On export, I write the evaluated mesh, which works fine, but is needlessly large for objects where array modifier makes a dozen or more copies (stairs, bars, etc.). For most of these objects it would be perfectly acceptable for them to be multiple objects with the same mesh instead. I experimented using this script which can apply the array modifier “at object level”. This works, and the objects share the same mesh. My export script can deal with these references perfectly. However, the other modifiers (bevel and subd) sit on the object, not on the mesh datablock. I need to:

  • keep modifiers and their settings the same between objects in the array, as if there only was one modifier stack for all of them.
  • remain non-destructive.
  • in the exporter, use the same mesh for each of the objects with confidence that they are the same, i.e. conform to WYSIWYG.

What’s the best way forward here?