muck 发表于 2022-7-5 16:25:51

提取AutoCAD文本(非属性

有没有办法通过在块插入中拾取文本来将文本提取到嵌入到块中的变量中。
 
我对提取属性不感兴趣。我在找东西
这将提取autocad文本(不需要多行文字)。只有AutoCAD文本。
我会看一些从一个区块中提取多行文字的东西。
 
 
 
我正在寻找的东西在Lisp,或VB。net或C#net。我想任何编程语言
可与AutoCAD一起使用。
 
任何解决方案。
 
非常感谢。

BIGAL 发表于 2022-7-5 17:46:37

这是一个旧的李mac,我创建了一个两行文字块
 
; by lee-mac
(defun get-block-entities ( blk / ent lst )    ;; Define the function, declare local variables      (if ;; If the following returns a non-nil value      ;; i.e. if the block exists in the drawing      (setq ent (tblobjname "block" blk)) ;; get the BLOCK entity      (while (setq ent (entnext ent))            ;; Step through the entities in the block definition                        (setq lst (cons ent lst))            ;; Construct a list of the block components                  ) ;; end WHILE            ) ;; end IF      (reverse lst) ;; Return the list    ) ;; end DEFUN
 
然后我做到了
 

(entget (nth 0 lst))
((-1 . <Entity name: 7ffffb4cd60>) (0 . "TEXT") (330 . <Entity name: 7ffffb4cd20>) (5 . "129EE") (100 . "AcDbEntity") (67 . 0) (8 . "DEFAULT") (100 . "AcDbText") (10 -0.930106 -5.26808 0.0) (40 . 2.5) (1 . "bbbb") (50 . 0.0) (41 . 0.7) (51 . 0.0) (7 . "hfs_simplex") (71 . 0) (72 . 0) (11 0.0 0.0 0.0) (210 0.0 0.0 1.0) (100 . "AcDbText") (73 . 0))
; look for assoc 0 is "Text"
页: [1]
查看完整版本: 提取AutoCAD文本(非属性