查找一些特定文本并
请随附的cad包含一个图纸和一个带有文本的表格,下面是一些参考id。我现在的问题是如何将表中的文本和右下角的参考号提取到csv。请任何人都可以帮我一个脚本做dat。我有几个DWG,我希望脚本通过该文件夹循环,并将其提取到单个csv。谢谢文本图纸 到目前为止你试过什么?你有没有一种方法可以将一些东西写入dwg?
我首先尝试将一段文本写入csv,然后在此基础上进行构建,而不是尝试直接在几个图形上执行几条不同的信息。 有两件事它不是一个“表格”,而是围绕文本的行,尝试对对象使用正确的措辞,这样更容易提供响应。
这应该很接近了。它确实在excel中的Y上有一个额外的步骤排序,但它是在2004年完成的
; converts column of text to comma seprated file with text value and y value
; put in excell and sort by y value
; by Alan H Nov 2004
(setq x 1)
(while (/= x 4)
(setq howmany (rtos x 2 0))
(setq fileto (strcat "c:/temp/setout" howmany))
(princ fileto)
(setq fout (open fileto "w"))
(while (not (setq ss (ssget ))))
(princ "wow")
(while (setq en (ssname ss 0))
; Entity type
(setq entyp (cdr (assoc 0 (entget en))))
(princ "wow")
(if (= entyp "TEXT")
(progn
(setq xyz (cdr (assoc 10 (entget en))))
(setq txtht (cdr (assoc 1 (entget en))))
;write file out here
(setq textout (strcat txtht "," (rtos (cadr xyz) 2 3)))
;write
(write-line textout fout)
(princ textout)
)
)
; Delete each measured entity from set
(ssdel en ss)
;end while
)
(close fout)
(setq x (+ x 1))
) ;end if loop 3 times
(princ)
页:
[1]