214175581 发表于 2024-5-3 16:03:44

求问!不知道为什么在text命令选择点时候会出现string nil问题。txt文件附上

代码如下:


(defun split(str p)
(setq i (+ 1 (strlen p)))
(setq sl '())
(while (setq pa (vl-string-search p str))
    (setq sl (cons (substr str 1 pa) sl)
          str (substr str (+ pa i)))
)
(reverse (cons str sl))
)

(defun c:pipe(/)
(setq filep (getfiled "选择一个管段txt文件" "" "txt" 8))
(setq f (open filep "r"))
(setq info (read-line f))
(while (setq info (read-line f))
    (setq l (split info (chr 9)))
    (command "text" "j" "l" (list (atof(nth 3 l)) (atof(nth 4 l)))(nth 5 l)
             (strcat (nth 0 l) "," (nth 1 l) "," (nth 2 l)))
)
)

ssyfeng 发表于 2024-5-3 19:00:58

文件编码不对,另存为ANSI编码就可以了

试试我这个

214175581 发表于 2024-5-3 16:07:41

这是cad运行出现的问题

start4444 发表于 2024-5-4 21:44:46

高度 角度 都要吧 (command "text" "j" "m" (list (atof(nth 3 l)) (atof(nth 4 l)))(abs (atof (nth 5 l))) 0 (strcat (nth 0 l) "," (nth 1 l) "," (nth 2 l)))
页: [1]
查看完整版本: 求问!不知道为什么在text命令选择点时候会出现string nil问题。txt文件附上