NEED HELP Component for Conditionalizing material

Hello,
I have created my structure model and now here’s what I try to do:
I wasn’t to place a conditional so that:
When a poly surface (closed brep) is close to the line (for example distance < 4) its material would change to glass, and when it is > 4 it will remain as it is. The distance command works only with points so I guess I need to find a way to specify it on my polysurfaces.