谢谢foolishzy大侠,老是从一个方向删除,如果能从开始捕捉的位置删除就更好了
没明白要实现什么功能 如果想删除左边就从左边开始往前找打断点,想删除右边从右边开始往前找打断点 本帖最后由 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)
(setqn1 (cdr (assoc 90 (entget e1)))
n2 (cdr (assoc 90 (entget e2)))
)
(setqavpt1 (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 手动删除")
)
)
)
非常感谢foolishzy大侠,要的就是这个效果 foolishzy 发表于 2023-6-6 09:51
wanhongron 发表于 2023-6-5 16:31
如果想删除左边就从左边开始往前找打断点,想删除右边从右边开始往前找 ...
会报错呢?numberp:nil
页:
1
[2]