I need to calculate the length of polygons along / projected on a line. An image to show the idea:

[![enter image description here](https://i.stack.imgur.com/R7B6R.png)](https://i.stack.imgur.com/R7B6R.png)

I have thousands of polygons to be "projected" on lines to verify how many meters of the line they belong to. The polygons are irregular, with different orientation, part of them intersect the line, part of them do not.

I've tried: 

1. *Locate features along line tool* in ArcGIS Pro, but it only
gives the lenght of line for overlapping part of a polygon (tool
description here [ESRI help](http://desktop.arcgis.com/en/arcmap/10.3/guide-books/linear-referencing/locating-features-along-routes-about-locating-feat.htm))
2. *Minimum Bounding Geometry* with 'convex hull' option, but it
only gives distance between antipodal points of a polygon, which is
not parallell to the my line (tool description here [ESRI help](http://help.arcgis.com/En/Arcgisdesktop/10.0/Help/index.html#//00170000003q000000)

Am I missing a tool for this in ArcGIS or QGIS? Would you have a solution for this?