;CAD的lisp程序来批量搜索文字并标记.lsp
(defun rg-Split (s p / L r)
(setq r (vlax-create-object "vbscript.regexp"))
(vlax-put-property r 'Global 1)
(vlax-put-property r 'Pattern p)
(read (strcat "(\"" (vlax-invoke r 'Replace s "\" \"") "\")"))
)
(defun c:DrawLineToUserInputText ()
;DrawLineToUserInputText 将需要查询的文字用","分割,会逐个查询并标记直线
(setq inputString (getstring "\nEnter the text strings separated by commas: "))
(setq textStrings (rg-Split inputString ","))
(print textStrings)
(foreach str textStrings
(setq textSet (ssget "X" (list (cons 0 "TEXT") (cons 1 str))))
(if textSet
(progn
(setq ent (ssname textSet 0))
(setq charPoint (cdr (assoc 10 (entget ent))))
(print charPoint)
(setq endPoint (list (car charPoint) (+ (cadr charPoint) 5000)))
(command "_line" charPoint endPoint "")
(command "circle" endPoint 10 "")
)
(prompt (strcat "\nString not found: " str))
)
)
(princ)
)
;CAD的lisp程序来批量搜索文字并标记.lsp
最新推荐文章于 2024-02-23 14:13:47 发布