Block form urban infill representation

HI,

Looking for some help! Does anyone know how to (screen shot):

1, (red line) Connect the blocks with lines and circles at the end points.
2, (blue line) Close the gap to get max density at the specific scale and/or provide minimum buffer distance from the outline curve for the blocks to be filled in.

Attached are the files. Thanks!
District_Network.gh (40.2 KB)
District_Network.3dm (16.8 MB)