Robot inside or outside of an area

Is there a way to figure if the robot is inside or outside of an area?
My idea would have been to define a feature plane that defines the limit of the area.

Next I would like to convert the current position of the TCP into the feature plane so that I can determine if z> 0 then the TCP is within the limit, if z <0, then the TCP is out of limit.

How can I calculate the current TCP position in the feature plane like under the tab “Move” in URScript?

Thank you.

You should consider the functions pose_trans() and pose_inv().
Maybe this topic is useful to get the position of the TCP in respect to a feature coordinate.