试试,
需要的函数去开源LISP函数库拷贝回去。
(XD::POLYLINE:SetRadius)LWPOLYLINE 顶点设置倒角半径
 - (defun c:tt ()
- (xdrx_begin)
- (if (and (setq ss (ssget '((0 . "LINE,*POLYLINE"))))
- (setq offset (getreal "\n输入偏移距离<退出>:"))
- (setq fillet (getreal "\n输入圆角半径<退出>:"))
- (setq ss (xdrx_entity_explode ss t))
- (setq ss (xdrx_curve_intersectbreak ss))
- (setq ss (xdrx_geom_searchregions ss 0))
- (setq lst (mapcar
- '(lambda (x) (list (xdrx_getpropertyvalue x "area") x))
- (xdrx_pickset->ents ss)
- )
- lst (xd::list:sort lst '>)
- )
- )
- (progn
- (xdrx_entity_delete (cadar lst))
- (setq lst (mapcar 'cadr (cdr lst)))
- (setq
- ret (mapcar '(lambda (x)
- (if (and (setq ss1 (xdrx_curve_getoffsetcurves
- x
- (- (abs offset))
- )
- )
- (= (sslength ss1) 1)
- (setq e (ssname ss1 0))
- (xdrx_curve_isclosed e)
- )
- (xd::polyline:setradius e -1 (abs fillet))
- )
- )
- lst
- )
- )
- (cond
- ((apply 'and ret)
- (xdrx_prompt "\n成功偏移并圆角了" (length lst) " 条多段线.")
- )
- ((and (setq ret (xd::list:group ret 0.1)) (= (length ret) 2))
- (xdrx_prompt "\n未全部成功.")
- )
- (t (xdrx_prompt "\n没有成功,检查数据."))
- )
- )
- )
- (xdrx_end)
- (princ)
- )
|