Notice you posted the same question in the Dynamo forum. This might be indeed the way to go.
One of the first issues might be to find an algorithm which can calculate this.
Louis
Please mention Revit version, especially when uploading Revit files.
Thank you!