anupmadhu 发表于 2022-7-5 20:05:23

选择并移动多行文字(&T)

我在附图中有很多植物的名字。我所需要的是根据文本字符串来选择那些,例如:如果键入IXO,则应选择所有包含IXO的文本。
 
由于空间限制,随附图纸的PDF。
 
 
我使用tharwat的下面提到的代码来查找总数,但结果是在记事本中可以有人将其更改为excel。
(defun c:ctxt (/ s i e f o x y l lst)
;;    Tharwat 18. mar. 2014    ;;
(princ "\n Select texts to export to txt file :")
(if (setq s (ssget '((0 . "TEXT") (1 . "#*"))))
   (progn (setq o (open (setq f (strcat (getvar 'DWGPREFIX) (vl-filename-base (getvar 'DWGNAME)) ".txt")) "w"))
          (write-line (strcat "DESCRIPTION" "\t" "QTY") o)
          (repeat (setq i (sslength s))
            (setq e (entget (ssname s (setq i (1- i))))
                  x (cdr (assoc 1 e))
                  b ""
            )
            (while (wcmatch (setq a (substr x 1 1)) "1,2,3,4,5,6,7,8,9,0")
            (setq b (strcat b a)
                  x (substr x 2)
            )
            )
            (if (setq y (assoc (setq x (substr x 2)) l))
            (setq l (subst (cons x (+ (atof b) (cdr y))) y l))
            (setq l (cons (cons x (atof b)) l))
            )
          )
          (foreach x l (write-line (strcat (car x) "\t" (rtos (cdr x) 2 1)) o))
          (close o)
          (startapp "notepad.exe" f)
   )
)
(princ)
)
A4_CC2-PL-01型号(1)。pdf

SLW210 发表于 2022-7-5 21:19:25

请阅读代码发布指南并编辑您的帖子,将代码包含在代码标签中。
页: [1]
查看完整版本: 选择并移动多行文字(&T)