After rotating a block (3D) I figured out I can find the angles like this:
(setq ent (car (entsel)))
(setq vec (cdr (assoc 210 (entget ent))))
(setq rx (atan (/(cadr vec) (caddr vec))))
(setq ry (atan (/ (car vec) (caddr vec))))
(setq rz (cdr (assoc 50 (entget ent))))
(print (strcat "Rotation X-Axis: " (angtos rx)))
(print (strcat "Rotation Y-Axis: " (angtos ry)))
(print (strcat "Rotation Z-Axis: " (angtos rz)))
But what if I want to rotate the block back to "normal", with no rotation, like it was when inserted. The z is easy by modifying the DXF code, but I have trouble to get the X and Y back to zero.
I moved the block for testing purposes to (0,0,0) and tried this (just X):
(setq p (list 0.0 0.0 0.0) )
(setq q (list (+ 1 (car p)) (cadr p) (caddr p))) ; p q = x-axis
(setq ra (+ rx pi))
(command "_.rotate3d" ent "" "x" "_non" "0,0,0" (angtos ra))
And the same for the Y axis.
It seems to work, but can I modify the angles by directly set the vector to the 0,0,1 position?