这应该有助于事情的开始。。。
- (defun c:Test (/ ss)
- (if (setq ss (ssget '((0 . "LINE,*POLYLINE"))))
- ((lambda (i / pts lst)
- (repeat i
- (mapcar (function (lambda (a b) (setq lst (cons (list a b (distance a b)) lst))))
- (setq pts (AT:GetVertices (ssname ss (setq i (1- i)))))
- (cdr pts)
- )
- )
- (mapcar 'print lst)
- )
- (sslength ss)
- )
- )
- (princ)
- )
- (defun AT:GetVertices (e / p l)
- ;; Return point at each vertex of curve
- ;; e - curve to evaluate (Arc, Line, *Polyline, Spline)
- ;; Alan J. Thompson, 09.30.10
- (if e
- (if (eq (setq p (vlax-curve-getEndParam e)) (fix p))
- (repeat (setq p (1+ (fix p)))
- (setq l (cons (vlax-curve-getPointAtParam e (setq p (1- p))) l))
- )
- (list (vlax-curve-getStartPoint e) (vlax-curve-getEndPoint e))
- )
- )
- )
如果需要进一步帮助,请发布示例图形。 |