Ask the wall for its geometry, retrieve all vertices, and select the maximum one.
The Building Coder shares dozens discussions of detailed geometrical analysis of wall geometry:
https://www.google.com/search?q=wall+geometry+vertices&as_sitesearch=thebuildingcoder.typepad.com
Please perform a minimal Internet search for existing solutions before submitting a new question.