I want to detect walls to adjust the 3D according to the installations architecture

Hello everybody,
I’m a Web developer, I’m studying Three.js at the moment, I want to implement an AR in my system, I have a 3D electrical installation where the building’s wires and pipes pass, I want to load it and display it on the cell phone screen, it even worked, but the 3D is not accurate, I would like some help to improve the script.

Sorry for some mistakes, I’m Brazilian using the translator. Thanks.