如果我理解正确,请快速阅读一段代码:
- (defun c:addpl ( / e l p x ) (vl-load-com) (setq x 0.0)
- (while
- (progn (setvar 'ERRNO 0) (setq e (entsel "\nSelect Polyline Segment: "))
- (cond
- ( (= 7 (getvar 'ERRNO))
- (princ "\nMissed, try again.")
- )
- ( (not e)
- nil
- )
- ( (eq "LWPOLYLINE" (cdr (assoc 0 (entget (car e)))))
- (princ
- (strcat "\nSegment: "
- (rtos
- (setq l
- (-
- (vlax-curve-getdistatparam (car e)
- (1+
- (setq p
- (fix
- (vlax-curve-getparamatpoint (car e)
- (vlax-curve-getclosestpointto (car e) (trans (cadr e) 1 0))
- )
- )
- )
- )
- )
- (vlax-curve-getdistatparam (car e) p)
- )
- )
- )
- )
- )
- (princ (strcat "\tTotal: " (rtos (setq x (+ x l)))))
- )
- ( (princ "\nPlease select an LWPolyline.") )
- )
- )
- )
- (if (< 0.0 x)
- (princ (strcat "\nTotal: " (rtos x)))
- )
- (princ)
- )
|