Optimizing the cut of Reinforcement nets

I want to create a script that can optimize the cut of Reinforcement nets.
When i use Reinforcement net in revit i will get the dimensions of how the Net is cut. The problem is that revit doesnt optimize it, for example if i have two small parts, Revit will use 2 big nets and not one that can be cut in two pieces.
For example if one net has dimensions 5,5m x 2,5m and I have used 20 pieces with dimensions 1,25m x 4,2m and 35 pieces with dimensions 2,25m x 2,5m, how can i optimize the cut of the nets so that the gross weight is as low as possible. One example is given below (this is done with sofistik in revit)


Does anyone already have some script that can do something like this or do you have any idea how to approach this problem.