Python: process mesh so that longest edge length < x
Example subdividing the default cube.

import bpy
import bmesh

threshold = 0.1
obj = bpy.data.objects['Cube']
bm = bmesh.from_edit_mesh(obj.data)

#do ... while
while True:
    edges = [e for e in bm.edges if e.calc_length() &gt; threshold]
    if not edges:
        break
    bmesh.ops.subdivide_edges(
        bm,
        edges=edges,
        cuts=1
        #use_single_edge=True,
        #use_grid_fill=True
        )
    #triangulate
    bmesh.ops.triangulate(bm, faces=bm.faces, use_beauty=True)  

bmesh.update_edit_mesh(obj.data)