“引线序号球标”诚恳求助
各位师兄,前辈!以下代码淘自明经,原创是哪位真不知道,故在此区域恳求帮忙修正以下问题点
问题点:新建文件刚加载时可以运行,结束后第2次执行命令出错,提示:“ 错误: 参数类型错误: stringp 3”
另请把乱码译成简体汉字,先在此谢谢!
(defun c:cc()
(setvar "cmdecho" 0)
(if (= ccvar nil)(setq ccvar (list 15 15 1 1 "Y" "")))
(setq r(getreal (strcat "\n蛾畖<" (rtos (car ccvar)) ">:")));;砞0碞ぃ穦礶蛾ㄓ
(setq h(getreal (strcat "\nゅ蔼<" (rtos (cadr ccvar)) ">:")))
(setq n(getint (strcat "\n秨﹍絪腹<" (itoa (caddr ccvar)) ">:")))
(setq b(getint (strcat "\n絪腹计<" (itoa (cadddr ccvar)) ">:")))
(initget 0 "Y N")
(setq k (getkword (strcat "\n絪腹秨繷?琌(Y)/(N)<" (nth 4 ccvar)">:")))
(if (= k nil)(setq k (nth 4 ccvar)))
(setq s "" marks (nth 5 ccvar))
(if (= k "Y") (progn
(setq s (getstring (strcat "\n絪腹秨繷<" marks ">:")))
(if (= s "")(setq s marks)(setq marks s))
))
(if (= r nil)(setq r (car ccvar)))
(if (= h nil)(setq h (cadr ccvar)))
(if (= n nil)(setq n (caddr ccvar)))
(if (= b nil)(setq b (cadddr ccvar)))
(setq ss "" bb (itoa n))
(while (setq pt (getpoint "\n匡翴:"))
(setq ceo nil)
(repeat (- b (strlen bb)) (setq ss (strcat ss "0")))
(if (> r 0) (progn (command "circle" pt r) (setq ceo (entget (entlast)))))
(command "text" "J" "mc" pt h "" (strcat s ss bb))
(setq teo (entget (entlast)))
(command "leader" pt (polar pt (/ pi 4) r)"" "" "n")
(setq leo (entget (entlast)))
(setq p1 (cdr (assoc 10 leo)) k 1)
(while (/= k 3)
(setq p (grread T))
(setq k (car p) p (cadr p))
(if (> r 0) (progn
(setq ceo (subst (cons 10 p) (assoc 10 ceo) ceo))
(entmod ceo)
))
(setq teo (subst (cons 11 p) (assoc 11 teo) teo))
(entmod teo)
(setq p (polar p (angle p p1) r))
(setq leo (subst (cons 10 p) (assoc 10 (reverse leo)) leo))
(if (> (distance p p1) 0.0) (entmod leo))
)
(setq n (1+ n) ss "" bb (itoa n))
)
(setq ccvar (list r h n b k marks))
(setvar "cmdecho" 1)
(princ)
)
(princ "\nC:cc")
(prin1)
http://bbs.mjtd.com/xwb/images/bgimg/icon_logo.png 该贴已经同步到 冒个烟圈的微博 有人帮忙吗?自己先顶上 r为球标半径,h为字高,n球标开开始数字,b球标的位数,如个位数1,二位数为01,三位数003,s为数字前加符号,pt应该在屏幕上点击吧。
提示:“ 错误: 参数类型错误: stringp 3”,把(initget 0 "Y N")相关的取掉应该可以了吧,呵呵,具体你试一下。 simpleye 发表于 2015-5-30 20:37 static/image/common/back.gif
r为球标半径,h为字高,n球标开开始数字,b球标的位数,如个位数1,二位数为01,三位数003,s为数字前加符号 ...
好勒。。我试试看。。因为是新手,下午弄了半天 simpleye 发表于 2015-5-30 20:37 static/image/common/back.gif
r为球标半径,h为字高,n球标开开始数字,b球标的位数,如个位数1,二位数为01,三位数003,s为数字前加符号 ...
谢谢你提示。。我试了下可以使用,
但是这样的话,就不能添加序的前缀(如:字母A)了,这个功能还是保留的好,做组立图有一半能用的上添加字母功能,
期待好心人帮忙能在原有功能不变的同时解决问题 我试了都可以的,你是不是修改错了。还有一点,最好在前面设置osmode为0,箭头改为圆点, simpleye 发表于 2015-5-31 07:31 static/image/common/back.gif
我试了都可以的,你是不是修改错了。还有一点,最好在前面设置osmode为0,箭头改为圆点,
在不删除(initget 0 "Y N")
(setq k (getkword (strcat "\n絪腹秨繷?琌(Y)/(N)<" (nth 4 ccvar)">:")))
(if (= k nil)(setq k (nth 4 ccvar)))
这个功能的前提下你能帮我修改好吗?
或者用其它的语句替代它也行,谢谢。
冒个烟圈 发表于 2015-5-31 10:53 static/image/common/back.gif
在不删除(initget 0 "Y N")
(setq k (getkword (strcat "\n絪腹秨繷?琌(Y)/(N):")))
...
(defun c:cc(/ ccvar r h n b k s ss bb pt ceo teo leo p1 p marks)
(setvar "osmode" 0)
加上局部变量和关掉捕种,估计就可以了 kwok 发表于 2015-5-31 16:23 static/image/common/back.gif
(defun c:cc(/ ccvar r h n b k s ss bb pt ceo teo leo p1 p marks)
(setvar "osmode" 0)
加上局部变量 ...
按您说的试了下,结果OK了。非常感谢!!! (defun c:cc ()
(setvar "cmdecho" 0)
(if (= ccvar nil) (setq ccvar (list 15 15 1 1 "N" "")))
(setq r (getreal (strcat "\n圆圈半径<" (rtos (car ccvar)) ">:")))
(setq h (getreal (strcat "\n输入字高<" (rtos (cadr ccvar)) ">:")))
(setq n (getint (strcat "\n起始序号<" (itoa (caddr ccvar)) ">:")))
(setq b (getint (strcat "\n序号位数[前面补0]<" (itoa (cadddr ccvar)) ">:")))
(initget 0 "Y N")
(setq k (getkword (strcat "\n是否设置前缀(Y)/(N)<" (nth 4 ccvar) ">:")))
(if (= k nil) (setq k (nth 4 ccvar)))
(setq s "" marks (nth 5 ccvar))
(if (= k "Y")
(progn
(setq s (getstring (strcat "\n设置前缀<" marks ">:")))
(if (= s "")
(setq s marks)
(setq marks s)
)
)
)
(if (= r nil) (setq r (car ccvar)))
(if (= h nil) (setq h (cadr ccvar)))
(if (= n nil) (setq n (caddr ccvar)))
(if (= b nil) (setq b (cadddr ccvar)))
(setq ss "" bb (itoa n))
(while (setq pt (getpoint "\n指定起点:"))
(setq ceo nil)
(repeat (- b (strlen bb)) (setq ss (strcat ss "0")))
(if (> r 0) (progn (command "circle" pt r) (setq ceo (entget (entlast)))))
(command "text" "J" "mc" pt h "" (strcat s ss bb))
(setq teo (entget (entlast)))
(command "leader" pt (polar pt (/ pi 4) r) "" "" "n")
(setq leo (entget (entlast)))
(setq p1 (cdr (assoc 10 leo)) k1)
(while (/= k 3)
(setq p (grread T))
(setq k (car p) p (cadr p))
(if (> r 0)
(progn
(setq ceo (subst (cons 10 p) (assoc 10 ceo) ceo))
(entmod ceo)
)
)
(setq teo (subst (cons 11 p) (assoc 11 teo) teo))
(entmod teo)
(setq p (polar p (angle p p1) r))
(setq leo (subst (cons 10 p) (assoc 10 (reverse leo)) leo))
(if (> (distance p p1) 0.0) (entmod leo))
)
(setq n(1+ n) ss "" bb (itoa n))
)
(setq ccvar (list r h n b k marks))
(setvar "cmdecho" 1)
(princ)
)
(princ "\n命令:CC")
(princ)
页:
[1]