本帖最后由 foolishzy 于 2023-6-6 09:53 编辑
wanhongron 发表于 2023-6-5 16:31
如果想删除左边就从左边开始往前找打断点,想删除右边从右边开始往前找打断点 - (defun c:tt (/ a getaverpt e1 e2 n1 n2 avpt1 avpt2)
- (defun getaverpt (ename num / n lst sum_aver_pt)
- (setq n 0
- lst (list)
- )
- (while (< n num)
- (setq lst (append lst (list (vlax-curve-getPointAtParam ename n)))
- n (1+ n)
- )
- )
- (setq sum_aver_pt (list 0 0 0))
- (mapcar (function (lambda (x)
- (princ x)
- (setq sum_aver_pt
- (list
- (+ (car sum_aver_pt) (car x))
- (+ (cadr sum_aver_pt) (cadr x))
- 0
- )
- )
- )
- )
- lst
- )
- (setq sum_aver_pt
- (list
- (/ (car sum_aver_pt) num)
- (/ (cadr sum_aver_pt) num)
- 0
- )
- )
- )
- (vl-cmdf "BREAK" (setq p1 (getpoint)) (setq p2 (getpoint)))
- (setq e1 (entlast))
- (entdel (entlast))
- (setq e2 (entlast))
- (entdel e1)
- (setq n1 (cdr (assoc 90 (entget e1)))
- n2 (cdr (assoc 90 (entget e2)))
- )
- (setq avpt1 (getaverpt e1 n1)
- avpt2 (getaverpt e2 n2)
- )
- (if (and
- (< (distance avpt1 p1) (distance avpt1 p2))
- (> (distance avpt2 p1) (distance avpt2 p2))
- )
- (entdel e1)
- (if
- (and
- (> (distance avpt1 p1) (distance avpt1 p2))
- (< (distance avpt2 p1) (distance avpt2 p2))
- )
- (entdel e2)
- (princ "\n 手动删除")
- )
- )
- )
|