- 积分
- 519
- 明经币
- 个
- 注册时间
- 2015-1-5
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2015-7-1 14:37:09
|
显示全部楼层
yeahyeah 发表于 2013-8-21 21:10
;;画多段线打断于交点处
(defun c:kk (/ LA P0 PT S PL A d)
(defun c:kk ()
(SETQ LST nil)
(setq laY (getvar 'clayer))
(setq p0 (getpoint "\n第一点:"))
(while p0
(setq pt (getpoint p0 "\n下一点:"))
(setq sS
(ssget "f"
(list (POLAR p0 (angle p0 PT) 2) pt)
(list (cons 0 "*line,LWPOLYLINE,arc,circle,ellipse")
(cons 8 laY);只能在一个图层里
)
)
)
(command "PLINE" "NON" P0 "NON" PT "")
(SETQ E0 (ENTLAST))
(SETQ E0_ANG (angle p0 PT))
(IF SS (setq ss_count 0 ss_total (sslength ss))
)
(WHILE (< ss_count ss_total )
(setq ent (ssname ss ss_count))
(setq ss_count (+ 1 ss_count) )
(IF (/= ENT E0)
(progn
(SETQ BRKPT (MK_INTERS ent e0))
; (SETQ BRKPT (LIST (CAR BRKPT) (CADR BRKPT)))
(IF BRKPT
(progn
(setq para (vlax-curve-getParamAtPoint ent brkpt))
(setq dir1 (vlax-curve-getFirstDeriv ent para))
(setq dir1_ang (angle '(0 0) dir1))
(if (OR(= dir1_ang (/ pi 2)) (= dir1_ang (* pi 1.5)) )
(command "._break" ent "NON" (POLAR brkpt (+ E0_ANG (/ PI 2)) 2) "NON" (POLAR brkpt (+ E0_ANG (* PI 1.5)) 2) )
(if (OR(= dir1_ang 0) (= dir1_ang pi ) )
(progn
(setq Lst (cons p0 (cons pt Lst)))
(setq Lst (cons (POLAR brkpt (+ dir1_ang (* PI 1.5)) 2) (cons (POLAR brkpt (+ dir1_ang (/ PI 2)) 2) Lst)))
)
)
)
)
)
)
)
)
(if Lst
(progn
(SETQ list_ptY (vl-sort Lst (function (lambda (e1 e2) (< (caDr e1) (caDr e2)) ) ) ))
(while (cAr list_ptY)
(setq A (car list_ptY) B (cadr list_ptY) )
(setq list_ptY (CDR(cdr list_ptY)))
(COMMAND "pline" "NON" a "W" 0.8 0.8 "NON" b "")
)
(entdel e0)
(setq lst nil)
)
)
(setq p0 pt)
)
) |
|