This script works exectly as autocad rotate (and 3d rotate) command. It rotetes selected objects based on 3 points. Points are picked up in that order: 1. pivot point 2. reference point 3. target point
Script