Thanks for carrying this on ThomThom. I think you're on to something here and I'm experimenting further.
One of the complicating factors for me is that the face I want to apply texture to is often in a group which is in turn in a group (the wall file I posted earlier was a simplified version of what I'm doing).
I notice that when I run the UVhelper script modified per your homogenous tip earlier, I get better UV values. I also notice that the real-world vertex positions are in global coordinates (returned from the face.outer_loop.vertices.each method). Conversely, when applying a texture, you need to use coordinates that are based on the local coordinate system that the face belongs to.
I'm going to play around further. I've attached my modified uvhelper script. If what I said above is confirmed about local and global coordinates then I'll modify the uvhelper script further to report in local coordinates.
uvhelper.rb