The code still suffers from its original version as a long standalone script
The new internal API makes this cleaner, but it would be more powerful if the CAD and Mesh classes could be called multiple times, for instance
cad.process_entities(entities1) # cuts and fragments for entities1
<write to file>
cad.process_entities(entities2) # cuts and fragments for entities2, on top of entities1
and similarly for applying resolutions in Mesh. However being stateful like this could get complicated.