- UID
- 48985
- 积分
- 268
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-5-13
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
;;;线段在上方
(defun c:cheng_upline(/ e0 ss e1 p0 p1 p2 p3 p4 p5 p6 loop i x y x1 x2 r m)
(setq e0 (entsel "\n选择在上方的线段:"))
(setq ss (ssget "x" '((0 . "LINE"))))
(ssdel (car e0) ss)
(setq loop (sslength ss))
(setq p1 (cdr (assoc 10 (entget (car e0)))))
(if (= "LINE" (cdr (assoc 0 (entget (car e0)))))
(progn
(setq p2 (cdr (assoc 11 (entget (car e0)))))
)
)
;(setq w (cdr (assoc 41 (entget (car e0)))))
(setq width (getreal "\n输入打断间距<50>:"))
(if (or (= "" width) (= nil width)) (setq width 100))
(setq i 0)
(setq m 0)
(command "zoom" "w" "0,0" "1,1")
(repeat loop
(setq e1 (ssname ss i))
(setq i (+ i 1))
(if (= "LINE" (cdr (assoc 0 (entget e1))))
(progn
(setq p3 (cdr (assoc 10 (entget e1))))
(setq p4 (cdr (assoc 11 (entget e1))))
)
)
(setq p0 (inters p1 p2 p3 p4))
(if (/= p0 nil)
(progn
(setq x (car p0))
(setq y (car(cdr p0)))
(setq r (angle p3 p4))
(setq x1 (- x (* width (cos r))))
(setq x2 (- y (* width (sin r))))
(setq p5 (list x1 x2 0.0))
(setq x1 (+ x (* width (cos r))))
(setq x2 (+ y (* width (sin r))))
(setq p6 (list x1 x2 0.0))
(if (or (equal p1 p3) (equal p1 p4) (equal p2 p3) (equal p2 p4) (equal p1 p0) (equal p2 p0))
(princ)
(progn
(command "break" e1 p5 p6)
(setq m (+ m 1))
)
)
)
)
)
(command "zoom" "p")
(princ "\n总共完成") (princ m) (princ "项。")
(princ)
)
一个问题:
为什么必须在程序中加入指令:
(command "zoom" "w" "0,0" "1,1")
(command "zoom" "p")
才能正确的完成该函数!?
如果去掉这两个指令则出错!!!
在AUTOCAD R14+天正+晓东工具 调试。 |
|