Something like this :
(defun c:dii ( / ftoa x1 y1 z1 x2 y2 z2 x1w y1w z1w x2w y2w z2w x1o y1o z1o x2o y2o z2o p1 p2 d ducs docs dwcs dx dy dz v dxw dyw dzw w dxo dyo dzo ax vprim vprimd axy ocs stringid1 stringid1w stringid1o stringid2 stringid2w stringid2o string1 string2 string3 string4 string5 string6 string7 string8 string9 string10 string11 string12 string13 string14 string15 alertstring )
(defun ftoa ( n / m a s b )
(if (numberp n)
(progn
(setq m (fix ((if (< n 0) - +) n 1e-8)))
(setq a (abs (- n m)))
(setq m (itoa m))
(setq s "")
(while (and (not (equal a 0.0 1e-6)) (setq b (fix (* a 10.0))))
(setq s (strcat s (itoa b)))
(setq a (- (* a 10.0) b))
)
(if (= (type n) 'int)
m
(if (= s "")
m
(if (and (= m "0") (< n 0))
(strcat "-" m "." s)
(strcat m "." s)
)
)
)
)
)
)
(while (not p1) (setq p1 (getpoint "\nPick or specify start point : ")))
(while (not p2) (setq p2 (getpoint p1 "\nPick or specify end point : ")))
(setq d (distance p1 p2))
(grdraw p1 p2 6 1)
(setq dx (car (setq v (mapcar (function -) p2 p1))))
(setq dy (cadr v))
(setq ducs (sqrt (+ (* dx dx) (* dy dy))))
(setq dz (caddr v))
(setq ocs (trans (list 0.0 0.0 1.0) 1 0 t))
(setq dxo (car (mapcar (function -) (trans p2 1 ocs) (trans p1 1 ocs))))
(setq dyo (cadr (mapcar (function -) (trans p2 1 ocs) (trans p1 1 ocs))))
(setq dzo (caddr (mapcar (function -) (trans p2 1 ocs) (trans p1 1 ocs))))
(setq docs (sqrt (+ (* dxo dxo) (* dyo dyo))))
(setq dxw (car (setq w (trans v 1 0))))
(setq dyw (cadr w))
(setq dzw (caddr w))
(setq dwcs (sqrt (+ (* dxw dxw) (* dyw dyw))))
(setq ax (cvunit (atan dy dx) "radians" "degrees"))
(setq vprim (list (car v) (cadr v) 0.0))
(setq vprimd (distance (list 0.0 0.0 0.0) vprim))
(setq axy (cvunit (atan (caddr v) vprimd) "radians" "degrees"))
(setq x1 (car p1)
y1 (cadr p1)
z1 (caddr p1)
)
(setq x2 (car p2)
y2 (cadr p2)
z2 (caddr p2)
)
(setq x1w (car (trans p1 1 0))
y1w (cadr (trans p1 1 0))
z1w (caddr (trans p1 1 0))
)
(setq x2w (car (trans p2 1 0))
y2w (cadr (trans p2 1 0))
z2w (caddr (trans p2 1 0))
)
(setq x1o (car (trans p1 1 ocs))
y1o (cadr (trans p1 1 ocs))
z1o (caddr (trans p1 1 ocs))
)
(setq x2o (car (trans p2 1 ocs))
y2o (cadr (trans p2 1 ocs))
z2o (caddr (trans p2 1 ocs))
)
(prompt "\n\nID pt1 in UCS : (")(princ (rtos x1 2 50))(prompt " ")(princ (rtos y1 2 50))(prompt " ")(princ (rtos z1 2 50))(prompt ")")
(prompt "\nID pt1 in WCS : (")(princ (rtos x1w 2 50))(prompt " ")(princ (rtos y1w 2 50))(prompt " ")(princ (rtos z1w 2 50))(prompt ")")
(prompt "\nID pt1 in OCS : (")(princ (rtos x1o 2 50))(prompt " ")(princ (rtos y1o 2 50))(prompt " ")(princ (rtos z1o 2 50))(prompt ")")
(prompt "\n\nID pt2 in UCS : (")(princ (rtos x2 2 50))(prompt " ")(princ (rtos y2 2 50))(prompt " ")(princ (rtos z2 2 50))(prompt ")")
(prompt "\nID pt2 in WCS : (")(princ (rtos x2w 2 50))(prompt " ")(princ (rtos y2w 2 50))(prompt " ")(princ (rtos z2w 2 50))(prompt ")")
(prompt "\nID pt2 in OCS : (")(princ (rtos x2o 2 50))(prompt " ")(princ (rtos y2o 2 50))(prompt " ")(princ (rtos z2o 2 50))(prompt ")")
(prompt "\n\nDistance 2D projection in UCS plane : ")(princ (rtos ducs 2 50))
(prompt "\n\nDX in UCS : ")(princ (rtos dx 2 50))
(prompt "\nDY in UCS : ")(princ (rtos dy 2 50))
(prompt "\nDZ in UCS : ")(princ (rtos dz 2 50))
(prompt "\n\nDistance 2D projection in WCS plane : ")(princ (rtos dwcs 2 50))
(prompt "\n\nDX in WCS : ")(princ (rtos dxw 2 50))
(prompt "\nDY in WCS : ")(princ (rtos dyw 2 50))
(prompt "\nDZ in WCS : ")(princ (rtos dzw 2 50))
(prompt "\n\nDistance 2D projection in OCS plane : ")(princ (rtos docs 2 50))
(prompt "\n\nDX in OCS : ")(princ (rtos dxo 2 50))
(prompt "\nDY in OCS : ")(princ (rtos dyo 2 50))
(prompt "\nDZ in OCS : ")(princ (rtos dzo 2 50))
(prompt "\n\nDistance 3D : ")(princ (ftoa d))
(prompt "\n\nAngle around Z axis from X axis as 0.0 degree reference : ")(princ (ftoa ax))(prompt " degrees")
(prompt "\nAngle of picked points vector to XY plane : ")(princ (ftoa axy))(prompt " degrees")
(setq stringid1 (strcat "\nID pt1 in UCS : " (rtos x1 2 50) "," (rtos y1 2 50) "," (rtos z1 2 50)))
(setq stringid1w (strcat "\nID pt1 in WCS : " (rtos x1w 2 50) "," (rtos y1w 2 50) "," (rtos z1w 2 50)))
(setq stringid1o (strcat "\nID pt1 in OCS : " (rtos x1o 2 50) "," (rtos y1o 2 50) "," (rtos z1o 2 50)))
(setq stringid2 (strcat "\n\nID pt2 in UCS : " (rtos x2 2 50) "," (rtos y2 2 50) "," (rtos z2 2 50)))
(setq stringid2w (strcat "\nID pt2 in WCS : " (rtos x2w 2 50) "," (rtos y2w 2 50) "," (rtos z2w 2 50)))
(setq stringid2o (strcat "\nID pt2 in OCS : " (rtos x2o 2 50) "," (rtos y2o 2 50) "," (rtos z2o 2 50)))
(setq string1 (strcat "\n\nDistance 2D projection in UCS plane : " (rtos ducs 2 50)))
(setq string2 (strcat "\n\nDX in UCS : " (rtos dx 2 50)))
(setq string3 (strcat "\nDY in UCS : " (rtos dy 2 50)))
(setq string4 (strcat "\nDZ in UCS : " (rtos dz 2 50)))
(setq string5 (strcat "\n\nDistance 2D projection in WCS plane : " (rtos dwcs 2 50)))
(setq string6 (strcat "\n\nDX in WCS : " (rtos dxw 2 50)))
(setq string7 (strcat "\nDY in WCS : " (rtos dyw 2 50)))
(setq string8 (strcat "\nDZ in WCS : " (rtos dzw 2 50)))
(setq string9 (strcat "\n\nDistance 2D projection in OCS plane : " (rtos docs 2 50)))
(setq string10 (strcat "\n\nDX in OCS : " (rtos dxo 2 50)))
(setq string11 (strcat "\nDY in OCS : " (rtos dyo 2 50)))
(setq string12 (strcat "\nDZ in OCS : " (rtos dzo 2 50)))
(setq string13 (strcat "\n\nDistance 3D : " (ftoa d)))
(setq string14 (strcat "\n\nAngle around Z axis from X axis as 0.0 degree reference : " (ftoa ax) " degrees"))
(setq string15 (strcat "\nAngle of picked points vector to XY plane : " (ftoa axy) " degrees"))
(setq alertstring (strcat stringid1 stringid1w stringid1o stringid2 stringid2w stringid2o string1 string2 string3 string4 string5 string6 string7 string8 string9 string10 string11 string12 string13 string14 string15))
(alert alertstring)
(princ)
)
HTH.
M.R.