Wall References

Hey all,

Looking to get some feedback or a creative way out of this situation where I am stuck at.
I am trying to get the wall references based on its location.

I want to dimension the wall as 240mm in lieu of 250mm as its original thickness. I want to ignore the reference which gives me the 10mm Plaster board.
I have used Genius Loci wall references, Wall edge references, and heaps of other things but none of them is giving me a consistent result.
Does anyone have any creative idea or some solution to this issue?
In short, is there a way to get which reference represents what layer.

I have attached my dynamo script, its a bit of a mess.

Dim Test_MK015.dyn (398.7 KB)

GeniusLoci has a node called Compound Surfaces References which returns the surface, the material and the reference. You may can filter out the references by the corresponding material names. I have never used that node, so not sure if it returns everything or not.