lucas_3333 发表于 2014-3-5 08:19
E大,请问这个双线能否改为多段线PL?
完成是双线?
- (defun c:2l(/ ent1 ent2 ent3 ent4 wwdy1 str1 pt1 pt2 dis1 ag1 pt1u pt2u sspl)
- (setq ent1 nil ent2 nil ent3 nil ent4 nil sspl nil)
- (defun sk_mkl(p1 p2)
- (entmakex
- (list
- '(0 . "line")
- (cons 10 p1)
- (cons 11 p2)
- )
- )
- )
- (setq cmd_old(getvar 'cmdecho))
- (setvar 'cmdecho 0)
- (or wwdy (setq wwdy 6))
- (if(setq wwdy1 (getreal (strcat "\n请输入宽度<当前:"(rtos wwdy 2 3) ">:")))
- (setq wwdy wwdy1))
- (setq str1 (rtos wwdy 2 2) sspl (ssadd))
- (prompt "\n now dline width is: ")
- (prompt str1)
- (if(setq pt1 (getpoint "\n enter start point:"))
- (progn
- (while (setq pt2 (getpoint pt1 "\n enter next point:"))
- (redraw)
- (if (and ent1 ent2)
- (setq ent3 ent1
- ent4 ent2))
- (setq dis1 (* 0.5 wwdy))
- (setq ag1 (angle pt1 pt2))
- (setq pt1u (polar pt1 (+ ag1 1.5708) dis1))
- (setq pt2u (polar pt2 (+ ag1 1.5708) dis1))
- (setq pt1d (polar pt1 (- ag1 1.5708) dis1))
- (setq pt2d (polar pt2 (- ag1 1.5708) dis1))
- (setq ent1(sk_mkl pt1u pt2u)
- ent2(sk_mkl pt1d pt2d)
- pt1 pt2
- )
- (setvar "FILLETRAD" 0.0)
- (command "FILLET" ent1 ent3)
- (command "FILLET" ent2 ent4)
- (if(and ent1 ent2)
- (setq sspl(ssadd ent1 sspl)
- sspl(ssadd ent2 sspl)))
- (if(and ent3 ent4)
- (setq sspl(ssadd ent3 sspl)
- sspl(ssadd ent4 sspl)
- ))
- )
- ;;因为使用command函数调用pedit命令,有的ACAD版本命令不一样仅在2006测试通过
- (if (and sspl (> (sslength sspl) 2))
- (command "pedit" "m" sspl "" "j" "0.00" "")
- )
- )
- )
- (if cmd_old (setvar 'cmdecho cmd_old))
- (princ)
- )
|