获取最新图纸版本bl
大家好,这是我的第一篇帖子,如果我违反了论坛的任何规则,我很抱歉。我感谢你的帮助!我正试图编写一个脚本,从我们的图纸中获取最新版本号,然后将该信息保存到文本或CSV文件中。每个图形都有一个修订块,如下面标记的图像。在LISP中我该怎么做?
谢谢
欢迎来到论坛,我的朋友。感谢上帝,我们社区里有李这样的人。你不需要重新发明轮子,因为李已经完成了这类任务。使用Lee Mac的全局属性提取器和编辑器lisp(使用此lisp,您可以要求从一堆图形中提取某些属性-不一定是所有标记),然后它将在CSV文件中显示最终结果。
工藤敬李 这是一个类似的示例,演示了如何根据标记名更改属性值,但可以使用GET而不是PUT,并将值写入csv
; changes to issued for construction
: thanks to lee mac for original code
(vl-load-com)
; 1.Get current date in mm/dd/yy format.
(defun ddmmyy (/ x today)
(setvar "cmdecho" 0)
(setq x (getvar "CDATE")) ; get current date
(setq today ( rtos x 2 4)) ; convert to a string
(setq date (strcat (substr today 7 2) "." (substr today 5 2) "." (substr today 3 2) ))
)
(setq oldtag1 "DRAWING_STATUS") ;attribute tag name
(setq newstr1 "ISSUED FOR CONSTRUCTION")
(setq oldtag2 "REV_NO");attribute tag name
(setq newstr2 "0")
(setq ss1 (ssget "x"'((0 . "INSERT") (2 . "DA1DRTXT"))))
(setq inc (sslength ss1))
(repeat inc
(foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 (setq inc (1- inc)) )) 'getattributes)
(if (= oldtag1 (strcase (vla-get-tagstring att)))
(vla-put-textstring att newstr1)
) ; end if
(if (= oldtag2 (strcase (vla-get-tagstring att)))
(vla-put-textstring att newstr2)
) ; end if
) ; end for
) ;end repeat
(setq oldtag1 "REV-NO")
(setq newstr1 "0")
(ddmmyy)
(setq oldtag2 "DATE")
(setq newstr2 date)
(setq oldtag3 "AMENDMENT")
(setq newstr3 "ISSUED FOR CONSTRUCTION")
(setq ss2 (ssget "x"'((0 . "INSERT") (2 . "REVTABLE"))))
(setq inc (sslength ss2))
(repeat inc
(foreach att (vlax-invoke (vlax-ename->vla-object (ssname ss2 (setq inc (1- inc)))) 'getattributes)
(if (= oldtag1 (strcase (vla-get-tagstring att)))
(vla-put-textstring att newstr1)
)
(if (= oldtag2 (strcase (vla-get-tagstring att)))
(vla-put-textstring att newstr2)
)
(if (= oldtag3 (strcase (vla-get-tagstring att)))
(vla-put-textstring att newstr3)
)
)
)
(setq ss1 nil)
; (setq ss2 nil)
(princ)
谢谢巴巴吉!我已经下载并运行了脚本。我可以很好地使用编辑器,但当我在名为revision\u text的原始屏幕截图中的块上使用它时,提取器会给我一个错误:
bad argument type: VLA-OBJECT nil
我注意到,如果我编一个随机块名,我不会得到错误,它只会返回什么。那个街区有什么不对劲吗?
你能和我们一起住吗? 实际上,我已经非常接近使用DATAEXTRACTION命令所需的功能。它将我的revision_文本块的内容输出到电子表格。我只需要添加一个文件名或其他东西,这样我就可以将每一行关联到它的绘图文件。知道怎么做吗?
页:
[1]