- 积分
- 31728
- 明经币
- 个
- 注册时间
- 2005-5-16
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2019-3-27 12:37:42
|
显示全部楼层
;请试用以下程序
(defun c:brs (/ cmd osm dist dis1 ent en1 ptt pt0 pt1 pt2 zcd dqL name)
(vl-load-com)
(setq cmd (getvar "cmdecho"))
(setq osm (getvar "osmode"))
(setvar "cmdecho" 0)
(setvar "osmode" 0)
(vl-cmdf "_undo" "be")
(If (= (setq dis1 (getreal "\n输入打断间距<0.8>:")) nil)
(setq dis1 0.8)
)
(setq dist (* 0.5 dis1))
(while (setq en1 (entsel "\n选择要打断的线:"))
(setq ptt (cadr en1))
(setq ent (car en1))
(setq name (cdr (assoc 0 (entget ent))))
(if (wcmatch name "LINE,*POLYLINE,SPLINE,ARC,CIRCLE,ELLIPSE")
(progn
(setq pt0 (vlax-curve-getClosestPointTo ent ptt))
(setq zcd (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent)))
(setq dqL (vlax-curve-getdistatpoint ent pt0))
(if (<= dist dqL (- zcd dist))
(progn
(setq pt1 (vlax-curve-getpointatdist ent (- dqL dist)))
(setq pt2 (vlax-curve-getpointatdist ent (+ dqL dist)))
(vl-cmdf "_break" ent "f" pt1 pt2)
)
)
)
(alert "你选取的不是直线、多段线、样条曲线、圆、椭圆、圆弧、椭圆弧中一种,请重新选取!")
)
)
(vl-cmdf "_undo" "e")
(setvar "osmode" osm)
(setvar "cmdecho" cmd)
(princ)
) |
|