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
By furczak · 2017-03-26
Tags: reference rotation 3ds max transform align modeling object 2d 3d as autocad command
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

Z axis fixed version of script rotates object only in XY surface. It is recomened to use always that function, if only possible. Rotating objects in 3d space needs more attention and accurate scenes.
To install:
1. run script
2. choose Customize/Customize User Interface
3. choose prefered menu type
4. find script (RotateRef and RotateRefZ) under Retouchaid category to add