@Shanky1999 wrote:
....
I know xlines and rays dont have any vertex, but can we create a lisp which can create a line from the intersection of these two xlines and measure them ?
They do have defined points, like Lines (DXF codes 10 & 11). The 11 value is a unit vector relative to the origin 10 value [Osnappable as the ENDpoint of a Ray, or the MIDpoint of an Xline].
There's no need to create a Line. This will report, in your current settings for angular mode and precision, the two angles [projected onto the current drawing plane if they are in different Coordinate Systems] between two selected objects of either or both kinds:
(defun C:XLRA ; = XLine/Ray Angle
(/ e1 e2 e1data e2data e1ang e2ang)
(setq
e1 (car (entsel "\nOne XLINE or RAY: "))
e2 (car (entsel "\nOther XLINE or RAY: "))
e1data (entget e1)
e2data (entget e2)
e1ang (rem (angle '(0 0 0) (cdr (assoc 11 e1data))) pi)
e2ang (rem (angle '(0 0 0) (cdr (assoc 11 e2data))) pi)
angbetween (abs (- e1ang e2ang))
); setq
(prompt
(strcat
"\nAngles between those two XLINES/RAYS are "
(angtos angbetween) " and " (angtos (- pi angbetween)) "."
); strcat
); alert
(prin1)
)
It will say the angles are 0° and 180° if they're parallel.
It leaves the 'angbetween' variable [in radians] available for you to use in any way you need.
It could be made to do things like verify you selected the right kind(s) of thing(s), that you didn't select the same thing twice, etc.....
Kent Cooper, AIA