马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
(defun XD::Curve:Trim (ss bound pt / #direction #pointOnLine dis1 p1 p2 tf x xline)
(if (= (type ss) 'PICKSET)
(setq ss (xdrx_pickset->ents ss))
)
(cond
((= (type bound) 'LIST))
((= (type bound) 'ENAME)
(if (setq tf (xdge::type bound))
(progn
(if (xdrx_string_regexps "kLine[2|3]d" tf)
(progn
(xdge::getpropertyvalue bound "pointOnLine" "direction")
(setq bound (list #pointOnLine (mapcar
'+
#pointOnLine
#direction
)
)
)
)
(setq bound (xdge::getpropertyvalue bound "hasstartpoint"
"hasendpoint"
)
)
)
)
(setq bound (xdrx_getpropertyvalue bound "vertices"))
)
)
)
(setq p1 (car bound)
p2 (cadr bound)
xline (xdge::constructor "kLine3d" p1 p2)
)
(xdrx_setmark)
(mapcar
'(lambda (x)
(apply
'xdrx_curve_getsplitcurves
(cons x (xdrx_entity_intersectwith x xline))
)
)
ss
)
(setq ss (append
ss
(xdrx_pickset->ents (xdrx_getss))
)
dis1 (xdrx_point_dist2Line pt p1 p2)
)
(mapcar
'(lambda (x)
(if (> (* dis1 (xdrx_point_dist2line (xdrx_getpropertyvalue x "midpoint")
p1 p2
)
) 0
)
(xdrx_entity_delete x)
)
)
ss
)
(xdge::free xline)
t
)
测试代码:
(defun c:tt()
(if (and (setq ss (ssget '((0 . "*line,arc,circle,ellipse"))))
(setq e (xdrx_entsel "\n拾取裁剪边界<退出>:" '((0 . "line"))))
(setq pt (getpoint (xdrx_getpropertyvalue (car e) "midpoint") "\n裁剪方向<退出>:"))
)
(xd::curve:trim ss (car e) pt)
)
(princ)
)
|