xhlicaofen 发表于 2018-4-16 11:59:55

错误: 参数类型错误: stringp

(defun c:XJP1(/ en ent txt text nent );文字加多少PCS
(setq TXT1 (getint "\n请输入材料数量:"))
(if (setq en(car (entsel)))
    (progn
      (setq ent (entget en))
      (= (cdr (assoc 0 ent)))
      (setq txt (cdr(assoc 1 ent)))
      (if (= txt "")(setq txt ""))
      (setq text (CONS 1(strcat txt " ")))
      (setq text (CONS 1(strcat TEXT TXT1)))
      (setq text (CONS 1(strcat TEXT " PCS")))
      (setq nent (subst text (assoc 1 ent) ent))
      (entmod nent)
    )
)
(princ)
)
总是提示 错误请问需要怎么改呢. 谢谢大家指点一下.

bssurvey 发表于 2018-4-16 13:57:34

(defun c:XJP1(/ en ent txt text nent );文字加多少PCS
   (setq TXT1 (getint "\n请输入材料数量:"))
   (if (setq en(car (entsel)))
   (progn
       (setq ent (entget en))
       (= (cdr (assoc 0 ent)))
       (setq txt (cdr(assoc 1 ent)))
       (if (= txt "")(setq txt ""))
       (setq text (CONS 1(strcat txt " " (itoa TXT1) " PCS")))    ;三行改一行
      (setq nent (subst text (assoc 1 ent) ent))
       (entmod nent)
   )
   )
   (princ)
)

xhlicaofen 发表于 2018-4-16 14:24:57

bssurvey 发表于 2018-4-16 13:57
(defun c:XJP1(/ en ent txt text nent );文字加多少PCS
   (setq TXT1 (getint "\n请输入材料数量:"))
...

谢谢, 谢谢 ,非常感谢.我整得没办法,就做了条件IF 语句暂代用的

血司 发表于 2018-4-16 14:43:17

(setq text (CONS 1(strcat TEXT TXT1)));;;TXT1是getint获取的,是整数型,strcat需要字符串型参数

xhlicaofen 发表于 2018-4-16 14:47:32

血司 发表于 2018-4-16 14:43


谢谢,楼上的已经帮我解决了,我就是半桶水, 语法不是很会. 东学一点西学一点.
页: [1]
查看完整版本: 错误: 参数类型错误: stringp