这样稳妥一点,但是有“无效的选项关键字”
- (defun c:tt (/ md->3d a en1 en2 pt ss v)
- (defun md->3d (l) ;_by caoyin
- (if (> (length l) 3)
- (cons (list (car l) (cadr l) (caddr l))
- (md->3d (cdddr l)))
- (list l)))
- (setq en1 (car (entsel "\n选择截断线:"))
- en2 (car (entsel "\n选择被截断:"))
- a (md->3d (vlax-invoke (vlax-ename->vla-object en1)
- "intersectwith"
- (vlax-ename->vla-object en2)
- acextendnone))
- a (* 0.5
- (+ (vlax-curve-getparamatpoint en1 (car a))
- (vlax-curve-getparamatpoint en1 (last a))))
- pt (vlax-curve-getpointatparam en1 a)
- a (fix a)
- v (mapcar '-
- (vlax-curve-getpointatparam en1 a)
- (vlax-curve-getpointatparam en1 (1+ a)))
- v (mapcar '(lambda (x) (/ x (distance '(0 0 0) v) 1.)) v)
- v (mapcar '(lambda (x) (* x 10))
- (vl-list* (- (cadr v)) (car v) (cddr v)))
- ss (ssadd)
- ss (ssadd en1 ss)
- ss (ssadd en2 ss))
- (if (and (bpoly (mapcar '+ pt v) ss '(1 0))
- (bpoly (mapcar '- pt v) ss '(1 0)))
- (progn (entdel en1)
- (entdel en2)
- (entdel (car (entsel "\n选择需删除:")))))
- (princ))
|