IF语句不起作用, 求助
(defun c:xh ()(setvar "cmdecho" 0) ;命令回显
(setq tx (getint "\n起始数字:"))
(if (= tx nil)(= tx 1))
(setq yq (getdist "\n序号球直径:"))
(if (= yq nil)(= yq 5))
(while
(setq os (getvar "osmode"));系统变量
(setq po (getpoint "\n引线起点:"))
(setvar "osmode" 0);设置系统变量
(command "line" po pause "")
(setq pt (cadr (grread pause)))
(setq ang (angle po pt))
(command "circle" "2p" pt (polar pt ang yq) "")
(setq cir entlast)
(setq cirdata (cdr (assoc 10 (entget (cir)))))
(command "text" "j" "m" cirdata "" "" tx "")
(setq tx (1+ tx))
(setvar "osmode" os)
)
)
两句IF语句不起作用,请求大家帮助.
(if (= tx nil)(setq tx 1))
..........
(if (= yq nil)(setq yq 5)) 谢谢版主,没想到是这样,呵呵 我也偷学了 这个lsp不错,但是设置半径为5和 设置半径为 50 ,球筐是放大了,但是字符并没有放大,如何解决?? lengxiaxi 发表于 2014-11-18 21:17 static/image/common/back.gif
这个lsp不错,但是设置半径为5和 设置半径为 50 ,球筐是放大了,但是字符并没有放大,如何解决??
这个程式我已更新了,你看下能不能用
(defun c:xhq ( / gj tx yq)
(setvar "cmdecho" 0)
(setvar "osmode"512)
(setq tx (getint "\n起始值<1>:"))
(if (= tx nil)(setq tx 1))
(setq yq (getdist "\n文字高度:"))
(if (= yq nil)(setq yq 5))
(initget "p")
(setq gj(getkword "\n[设置递增/递减(P)]<递增>:"))
(if (= gj nil)(dz))
(if (setq gj "P") (dj))
)
(defun dz()
(while
(setq po (getpoint "\n引线起点:"))
(command "line" po pause "")
(setq len entlast)
(setq pt(cdr(assoc 11(entget(len)))))
(setq ang (angle po pt))
(command "circle" "2p" pt (polar pt ang (* 2 yq)))
(setq cir entlast)
(setq cirdata (cdr (assoc 10 (entget (cir)))))
(command "text" "j" "mc" cirdata yq "" tx)
(setq tx (1+ tx))
))
(defun dj()
(while
(setq po (getpoint "\n引线起点:"))
(command "line" po pause "")
(setq len entlast)
(setq pt(cdr(assoc 11(entget(len)))))
(setq ang (angle po pt))
(command "circle" "2p" pt (polar pt ang (* 2 yq)))
(setq cir entlast)
(setq cirdata (cdr (assoc 10 (entget (cir)))))
(command "text" "j" "mc" cirdata yq "" tx)
(setq tx (1- tx))
)
)
Comming 发表于 2014-11-29 09:07 static/image/common/back.gif
这个程式我已更新了,你看下能不能用
(defun c:xhq ( / gj tx yq)
(setvar "cmdecho" 0)
嗯,可以用了。我此前也转发过你这个lsp,请版主修改了。效果和你这个一样。引脚如果能改为箭头就完美了。 本帖最后由 Comming 于 2015-1-17 21:18 编辑
lengxiaxi 发表于 2014-11-29 12:03 static/image/common/back.gif
嗯,可以用了。我此前也转发过你这个lsp,请版主修改了。效果和你这个一样。引脚如果能改为箭头就完美了。 ...
引脚改为箭头了,你用一下,看看还有什么问题需要改进!在我能力之内会帮你解决。(defun c:xhq (/ gj tx yq os)
(setq os (getvar "osmode"))
(setvar "cmdecho" 0)
(setq tx (getint "\n起始值<1>:"))
(if (= tx nil)
(setq tx 1)
)
(setq yq (getdist "\n文字高度:"))
(if (= yq nil)
(setq yq 5)
)
(initget "p")
(setq gj (getkword "\n[设置递增/递减(P)]<递增>:"))
(cond ((= gj nil) (dz))
((= gj "p") (dj)))
(princ)
(setvar "osmode" os)
)
(defun dz ()
(while (>= tx tx)
(yx)
(setq tx (1+ tx))
)
)
(defun dj ()
(while (<= tx tx)
(yx)
(setq tx (1- tx))
)
)
(defun yx ()
(setvar "osmode" 512)
(setq apt (getpoint "\n引线起点:"))
(command "leader"apt(setq bpt (getpoint apt "\n引线终点:"))"""""n")
(setq ang (angle apt bpt))
(setvar "osmode" 0)
(command "circle" "2p" bpt (polar bpt ang (* 2.5 yq)))
(setq cir entlast)
(setq cirdata (cdr (assoc 10 (entget (cir)))))
(command "text" "j" "mc" cirdata yq "" tx)
) Comming 发表于 2015-1-16 11:33 static/image/common/back.gif
引脚改为箭头了,你用一下,看看还有什么问题需要改进!在我能力之内会帮你解决。
当中两句修改成(setq bpt (getpoint apt "\n引线终点:")),看起来会直观一点。 ljpnb 发表于 2015-1-16 14:34 static/image/common/back.gif
当中两句修改成(setq bpt (getpoint apt "\n引线终点:")),看起来会直观一点。
好主意,我已在8楼更新了程式。
页:
[1]
2