We are using a very similar approach.
The thing is the wall does not goes all the way trough,
The wall selection shows that my wall end’s at the adjacent wall, So I am using the vertical edges but the wall does not go all the way to the outer edge.
There is probably a way to change that.
I would like to grab that adjacent wall and include its outer face into my dimension references, just don’t know how to yet.
I’ve found in the API a method called ElementsAtJoin from the class LocationCurve, but haven’t figured out how to use that yet.
I will post updates.