I am trying to write a lisp program that will enable me to get the distance of a polyline that has arcs in it.
For example: You need to get the distance between 2 points on a drawing and between those points are several straight lines and a few arcs.
I have a lisp program called distm, that I got from this site. It doesn't say who created it, but it works great for getting the total distance of several individual lines, However it doesn't allow you to select arcs.
Is there a way to modify it so it will pick arcs? If so, How? Is there already a lisp routine that allows someone to pick straight and curved polylines?
I am learning lisp still and don't quite fill comfortable enough to tackle the modifications myself. But, if I had some guidance then I could definately modify it without dificulty.
The (distm) lisp routine is below:
(defun c:distm (/ dipt1 dipt2)
(setq FIRSTPT (getpoint "Pick point ")
dipt2 (getpoint FIRSTPT "\nNext point ")
dx (- (car dipt2) (car firstpt))
dy (- (cadr dipt2) (cadr firstpt))
ang (angle firstpt dipt2)
distm (distance firstpt dipt2)
)
(princ (strcat "\n\n Distance is "
(rtos (distance firstpt dipt2))
", "
)
)
(princ
(strcat " Angle is " (angtos ang 0 6) " Deg., ")
)
(princ (strcat "\n Delta X is " (rtos dx) ", "))
(princ (strcat " Delta Y is " (rtos dy) ", "))
(while (/= dipt2 nil)
(setq dipt1 dipt2)
(setq dipt2 (getpoint dipt1 "\n\nNext point "))
(if (/= dipt2 nil)
(progn
(setq distm (+ distm (distance dipt1 dipt2))
dx (- (car dipt2) (car dipt1))
dy (- (cadr dipt2) (cadr dipt1))
ang (angle dipt1 dipt2)
)
(princ (strcat "\n\n Distance is "
(rtos (distance dipt1 dipt2))
", "
)
)
(princ
(strcat " Angle is " (angtos ang 0 6) " Deg., ")
)
(princ (strcat "\n Delta X is " (rtos dx) ", "))
(princ (strcat " Delta Y is " (rtos dy) ", "))
(princ
(strcat "\n Running Total Distance is " (rtos distm))
)
)
)
)
(princ
(strcat "\n\n Final Total Distance is "
(rtos distm)
)
)
(princ)
)
Thanks for any help you can give me!!
PS. However wrote this routine, it's great I use it everyday. CONGRATS!!
** edited Subject line MST **