AutoLISP指定路径,计算长度,代码如下。
(defun c:test (/ pt pts dis p1)
(while (setq pt (getpoint "\n端点: "))
(if (not p1)
(setq p1 pt)
)
(setq pts (cons pt pts))
(if (>= (length pts) 2)
(grdraw pt p1 1)
)
(setq p1 pt)
)
(setq dis 0)
(if pts
(mapcar '(lambda (x y)
(setq dis (+ dis (distance x y)))
)
(reverse (cdr (reverse pts)))
(cdr pts)
)
)
(if (not (zerop dis))
(princ (strcat "\nDistance = " (rtos dis 2 4)))
)
(redraw)
(princ)
)
代码完。
这个弧形就计算不了。