lyy 发表于 2008-12-17 11:27:00

★★★【增强框选圆角】★★★

本帖最后由 作者 于 2008-12-22 16:14:36 编辑 <br /><br /> <p>;;也发一个全功能的框选圆角程序</p><p>;;对十字交叉的线可感知圆角方向</p><p>;;部分代码参考了网上的程序</p><p>(defun c:yad_fillet(/ yad-dxf yad-entsel yad-movetotop yad-interpt goto_fillet oldpedit oldos acaddoc mspace trm p1 p2 prom lprom r boxlen ss l_bak l_pt ent i)<br/>&nbsp; (defun yad-dxf(en val) (cdr (assoc val (entget en))))<br/>&nbsp; (defun yad-entsel(msg filter / ext ent pt s)<br/>&nbsp;&nbsp;&nbsp; (while (not ext)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq ent (entsel msg))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (cond<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((= (getvar "errno") 52) (setq ext T) (setvar "errno" 0) nil)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((and ent (setq s (ssget "_c" (polar (setq pt (cadr ent)) (* pi 1.25) boxlen) (polar pt (/ pi 4) boxlen) filter)) (setq ext T)) (list (ssname s 0) pt))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (T (prompt "\n圆角需要直线、圆弧、圆或多段线!"))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp; )<br/>&nbsp; )<br/>&nbsp; (defun yad-movetotop(l_ent / extdic tbl)<br/>&nbsp;&nbsp;&nbsp; (setq l_ent (mapcar 'vlax-ename-&gt;vla-object l_ent))<br/>&nbsp;&nbsp;&nbsp; (setq extdic (vla-getextensiondictionary mspace))<br/>&nbsp;&nbsp;&nbsp; (if (vl-catch-all-error-p (setq tbl (vl-catch-all-apply 'vla-item (list extdic "acad_sortents"))))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq tbl (vla-addobject extdic "acad_sortents" "acdbsortentstable"))<br/>&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp; (vlax-invoke tbl "MoveToTop" l_ent)<br/>&nbsp; )<br/>&nbsp; (defun yad-interpt(obj s / n ent ipt pt l_p)<br/>&nbsp;&nbsp;&nbsp; (setq obj (vlax-ename-&gt;vla-object obj) n -1)<br/>&nbsp;&nbsp;&nbsp; (repeat (sslength s)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq ent (vlax-ename-&gt;vla-object (ssname s (setq n (1+ n)))) ipt (vlax-variant-value (vla-intersectwith obj ent 0)))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (and (&gt; (vlax-safearray-get-u-bound ipt 1) 0) (setq ipt (vlax-safearray-&gt;list ipt)))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (while (&gt; (length ipt) 0)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq pt (list (car ipt) (cadr ipt) (caddr ipt)) ipt (cdddr ipt))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (not (vl-member-if '(lambda(e) (equal e pt boxlen)) l_p)) (setq l_p (cons pt l_p)))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp; (vla-delete obj)<br/>&nbsp;&nbsp;&nbsp; l_p<br/>&nbsp; )<br/>&nbsp; (defun goto_fillet(p1 p2 / ent1 ent2 wid ent2ispl s oldent newent)<br/>&nbsp;&nbsp;&nbsp; (setq ent1 (car p1))<br/>&nbsp;&nbsp;&nbsp; (if (not p2) (redraw ent1 3))<br/>&nbsp;&nbsp;&nbsp; (if (or p2 (setq p2 (yad-entsel "\n选择第二个对象:" '((0 . "LINE,XLINE,RAY,LWPOLYLINE,SPLINE,ARC,CIRCLE,ELLIPSE")))))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (and (setq ent2 (car p2)) (member "LWPOLYLINE" (mapcar '(lambda(e) (yad-dxf e 0)) (list ent1 ent2))))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (progn<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (redraw ent1 4)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (= (yad-dxf ent2 0) "LWPOLYLINE")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq ent1 p2 p2 (cadr p1) ent2 (car p1) p1 (cadr ent1) ent1 (car ent1))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq p1 (cadr p1) p2 (cadr p2))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq wid (yad-dxf ent1 40) ent2ispl (= (yad-dxf ent2 0) "LWPOLYLINE"))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (= trm 0)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (progn<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vla-copy (vlax-ename-&gt;vla-object ent1))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (and ent2ispl (not (equal ent1 ent2))) (vla-copy (vlax-ename-&gt;vla-object ent2)))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (yad-movetotop (if (equal ent1 ent2) (list ent1) (list ent1 ent2)))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vl-cmdf "_.undo" "_m")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setvar "qaflags" 1)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if ent2ispl (vl-cmdf "_.explode" ent1 ent2 "") (vl-cmdf "_.explode" ent1 ""))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq s (ssget "_p") oldent (entlast))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setvar "qaflags" 0)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vl-catch-all-apply 'vl-cmdf (list "_.fillet" (setq ent1 (nentselp p1)) (setq ent2 (nentselp p2))))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (cond<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((= trm 0))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((and (equal (setq newent (entlast)) oldent) (/= (getvar "filletrad") 0)) (vl-cmdf "_.undo" "_b"))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (T (vl-catch-all-apply 'vl-cmdf (append (list "_.pedit" (car ent1) "_j")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (equal newent oldent) nil (list newent))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (= (yad-dxf (setq ent2 (car ent2)) 0) "CIRCLE") nil (list ent2))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (list s "" "_w" wid "")))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vl-cmdf "_.erase" s "")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vl-catch-all-apply 'vl-cmdf (list "_.fillet" p1 p2))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (redraw ent1 4)<br/>&nbsp;&nbsp;&nbsp; )<br/>&nbsp; )<br/>&nbsp; (vl-load-com)<br/>&nbsp; (setq oldpedit (getvar "peditaccept") oldos (getvar "osmode")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mspace (vla-get-modelspace (setq acaddoc (vla-get-activedocument (vlax-get-acad-object))))<br/>&nbsp; )<br/>&nbsp; (setvar "peditaccept" 1)<br/>&nbsp; (setvar "osmode" 0)<br/>&nbsp; (setvar "cmdecho" 0)<br/>&nbsp; (setvar "errno" 0)<br/>&nbsp; (vl-cmdf "_.undo" "_c" "_n" "_.undo" "")<br/>&nbsp; (while (/= (getvar "errno") 52)<br/>&nbsp;&nbsp;&nbsp; (princ "\n当前设置:模式 = ")<br/>&nbsp;&nbsp;&nbsp; (princ (if (= (setq trm (getvar "trimmode")) 1) "修剪" "不修剪"))<br/>&nbsp;&nbsp;&nbsp; (princ ",半径 = ")<br/>&nbsp;&nbsp;&nbsp; (princ (getvar "filletrad"))<br/>&nbsp;&nbsp;&nbsp; (initget (if (= trm 1) "U N" "U T"))<br/>&nbsp;&nbsp;&nbsp; (setq p1 (entsel (strcat "\n" (setq prom (strcat "选择对象或指定圆角半径或[放弃(U)/" (if (= trm 1) "不修剪对象(N)" "修剪对象(T)")"]:")))))<br/>&nbsp;&nbsp;&nbsp; (princ "\n")<br/>&nbsp;&nbsp;&nbsp; (setq lprom (getvar "lastprompt") r (substr lprom (1+ (vl-string-mismatch prom lprom)))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; boxlen (abs (/ (* (/ (getvar "pickbox") (cadr (getvar "screensize"))) (getvar "viewsize")) (sin (/ pi 4))))<br/>&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp; (if (numberp (setq r (read r)))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setvar "filletrad" (abs r))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (cond<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((= p1 "U") (vl-cmdf "_.u"))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((= p1 "T") (setvar "trimmode" 1))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((= p1 "N") (setvar "trimmode" 0))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((and (not p1) (/= (getvar "errno") 52) (setq p2 (getcorner (setq p1 (cadr (grread T 6 2))) "\n指定对角点:")))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vla-startundomark acaddoc)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq ss nil l_bak nil l_pt nil)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (cond<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((and (setq ss (ssget "_f" (list p1 p2) '((0 . "LINE,XLINE,RAY,LWPOLYLINE,SPLINE,ARC,CIRCLE,ELLIPSE"))))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vla-addline mspace (vlax-3d-point p1) (vlax-3d-point p2))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq l_bak (list ss (setq l_pt (yad-interpt (entlast) ss))))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (&gt; (sslength ss) 1) (&gt; (length l_pt) 1)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((and (setq ss (ssget "_f" (list p1 (list (car p1) (cadr p2)) p2 (list (car p2) (cadr p1)) p1) '((0 . "LINE,XLINE,RAY,LWPOLYLINE,SPLINE,ARC,CIRCLE,ELLIPSE"))))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vl-cmdf "_.rectang" "_f" 0 p1 p2)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq l_pt (yad-interpt (entlast) ss))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (and l_bak (or (&lt; (length l_pt) 2) (and (= (sslength ss) 1) (&gt; (length (cadr l_bak)) 1)))) (setq ss (car l_bak) l_pt (cadr l_bak)))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (cond<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((not ss)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (princ "\n没有交叉框选到直线、圆弧、圆、椭圆、多段线或样条曲线!")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((or (= (sslength ss) 1) (= (length l_pt) 1))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (goto_fillet (list (setq ent (ssname ss 0)) (car l_pt)) (if (and (= (yad-dxf ent 0) "LWPOLYLINE") (&gt; (length l_pt) 1)) (list ent (cadr l_pt)) nil))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (T<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq p1 (nentselp (car l_pt)) l_pt (cdr l_pt) i -1)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (while (and (setq p2 (nth (setq i (1+ i)) l_pt)) (setq p2 (nentselp p2)) (equal (car p2) (car p1))))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (goto_fillet p1 p2)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vla-endundomark acaddoc)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((and p1 (= (type (setq ent (car p1))) 'ename))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vla-startundomark acaddoc)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (wcmatch (yad-dxf ent 0) "LINE,XLINE,RAY,LWPOLYLINE,SPLINE,ARC,CIRCLE,ELLIPSE")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (goto_fillet p1 nil)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (princ "\n圆角需要直线、圆弧、圆、椭圆、多段线或样条曲线!")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vla-endundomark acaddoc)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp; )<br/>&nbsp; )<br/>&nbsp; (setvar "peditaccept" oldpedit)<br/>&nbsp; (setvar "osmode" oldos)<br/>&nbsp; (princ)<br/>)<br/>(princ "\n框选圆角命令:yad_fillet")<br/>(princ)</p>

xj6019 发表于 2019-12-22 14:12:37

本帖最后由 xj6019 于 2019-12-22 14:40 编辑

好程序顶一下,楼主能改一下吗,框选的时候好不好实现预览功能啊,试用了一下,判断错误率太高了,除非点选可以,框选每次都很难把握规律,如果鼠标动就能暗线或者虚线显示裁剪下去的内容,到自己想要的位置的时候鼠标再点一下就确认,那样就会方便多了,现在的判断规律我试了很多回 也没发现啥规律。
楼主能看到回帖的话给弄一下吧,如果鼠标移动就能提前看到效果,就基本不错了。能看到,就再弄弄呗,毕竟太久的经典代码了

下文没句号。 发表于 2022-6-20 17:56:52

本帖最后由 下文没句号。 于 2022-6-20 17:59 编辑

有点不懂?命令是什么的?yad_fillet是这个吗?那我自己可以改简单点吧。

87825877 发表于 2023-7-11 08:34:55

感谢楼主,是不是只能选两条线?如果可以多选的话,更好用

liminnet 发表于 2008-12-17 12:28:00

caoyin 发表于 2008-12-17 12:41:00

<p>顶一下,不支持相交的spline嘛</p>

liminnet 发表于 2008-12-17 12:47:00

lyy 发表于 2008-12-17 13:56:00

caoyin发表于2008-12-17 12:41:00static/image/common/back.gif顶一下,不支持相交的spline嘛

<p></p>漏了,已补上!

jxlsp 发表于 2008-12-17 14:03:00

非常值得学习一下.

liminnet 发表于 2008-12-17 14:09:00

lyy 发表于 2008-12-17 15:44:00

liminnet发表于2008-12-17 14:09:00static/image/common/back.gif还是不支持SPLINE呢,老大

<p>不好意思,这回真的补上了!</p>

liminnet 发表于 2008-12-17 15:58:00

wuxuloveguo 发表于 2008-12-17 16:34:00

<p>支持好东西!如LS所说多样线的倒角存在BUG!</p>
页: [1] 2 3 4 5 6 7
查看完整版本: ★★★【增强框选圆角】★★★