chenying0527 发表于 2011-7-9 17:12:52

请高手看看,我这程序错在哪里了

运程这个程序后
(defun c:CJ()
(setq a (entsel))
(setq x1 (atof a))
(* ( x1 2))
)
出现    "错误: 参数类型错误: stringp (<图元名: 7ef870e0> (818.549 335.279 0.0))"
这是什么原因。
请高手赐教

gxynd 发表于 2011-7-9 20:41:10

a的值为(<图元名: 7ef870e0> (818.549 335.279 0.0)),一个图元和一个点表,又不是字符串,怎么有办法转为数字

chenying0527 发表于 2011-7-9 21:14:59

那怎么才能转成字符串呢?

chenying0527 发表于 2011-7-9 21:16:55

有是新手,还不太会的

zhynt 发表于 2011-7-9 21:23:19

你不会是要用这个程序来选图中的文字再乘以2吧。
那就应该这样:
(defun c:CJ()
(setq a (atof (cdr (assoc 1 (entget (car (entsel)))))))
(setq x1 (* a 2))
)

chenying0527 发表于 2011-7-9 21:25:22

说对了,又学到些东西了。
页: [1]
查看完整版本: 请高手看看,我这程序错在哪里了