本帖最后由 作者 于 2004-12-25 19:39:11 编辑
;;;2004版测试通过- ;;;多义线长度逐段计数或逐段累加计数
- (defun c:test025 (/ s1 eobj i leng pt0 pt1)
- (vl-load-com)
- (setq s1 (entsel "\n\t选择对象<退出> : ")
- eobj (vlax-ename->vla-object (car s1))
- i -1
- Leng 0
- )
- (while (setq pt0 (vlax-curve-getPointAtParam eobj (setq i (1+ i))))
- (if (setq pt1 (vlax-curve-getPointAtParam eobj (setq n (1+ i))))
- (progn
- ;(setq Leng (+ Leng (distance pt0 pt1)));逐段累加计数
- (setq Leng (distance pt0 pt1)) ;逐段计数
- (princ (strcat "\nLeng" (rtos i 2 0) " = "))
- (princ Leng)
- )
- )
- )
- (princ)
- )
|