To cut threads in the end of a pipe, for instance when creating a lighting position, one uses a die in a ratcheting handle, with the pipe in a stationary or rotating vice. Photos courtesy of the best name in pipe tools, Ridgid.