How does the section view work?

The solidworks has a very strong section view tool, you can hide any part of your solid body to check the style from any side or even interrior structure.

Does anyone know how can solidworks do that?

SolidworksApi macros