Typically to achieve this you can use the hide in views property of the objects. You don’t need the JavaScript for this. You only need to go the the Objects tab and select the ceiling that’s blocking the view and then enable Custom hide in views
and select the view for which it should be disabled.
You can also use custom JS code for this, you’d have to build your own logic around this and hide and show the nodes that represent the ceiling/roof. Take a look at GitHub - shapespark/shapespark-viewer-api: JavaScript API for interacting with the Shapespark 3D scene.
and
How To hide certain object in the scene - #8 by apex-studio
I hope this helps!