Author Topic: Lisp text search  (Read 1727 times)

0 Members and 1 Guest are viewing this topic.

hcbn1997

  • Newt
  • Posts: 31
Lisp text search
« on: October 26, 2023, 06:09:00 AM »
I have a lisp that searches for text and the content of Mr. Doan Van Ha as follows. The command will be 22, then select the text with the content GJ5 for example (eg picture). After clicking on GJ5, the command will ask and select Object. Now I want the step to select Obejcts to automatically select the full drawing. That is, after pressing command 22 and then pressing the word "GJ5", all the letters in GJ5 in the drawing will be selected, no need to select the area anymore.
I hope everyone can help me fix it. Thanks everyone !!!

hcbn1997

  • Newt
  • Posts: 31
Re: Lisp text search
« Reply #1 on: October 26, 2023, 06:10:09 AM »
pic

danAllen

  • Newt
  • Posts: 135
Re: Lisp text search
« Reply #2 on: October 26, 2023, 02:25:07 PM »
Try this. Added "X" to select all, also added echo of text picked, and princ at end for clean finish.
Code - Auto/Visual Lisp: [Select]
  1. (defun C:22( / txt)
  2.   (setq txt (cdr (assoc 1 (entget (car (entsel "\nChon Text mau: "))))))
  3.   (princ (strcat "\nChon nhom Text..." txt))
  4.   (setq ss (ssget "X" (list '(0 . "*TEXT") (cons 1 txt))))
  5.   (sssetfirst nil ss)
  6.   (princ)
  7. )
  8.  

hcbn1997

  • Newt
  • Posts: 31
Re: Lisp text search
« Reply #3 on: November 20, 2023, 01:39:33 AM »
Try this. Added "X" to select all, also added echo of text picked, and princ at end for clean finish.
Code - Auto/Visual Lisp: [Select]
  1. (defun C:22( / txt)
  2.   (setq txt (cdr (assoc 1 (entget (car (entsel "\nChon Text mau: "))))))
  3.   (princ (strcat "\nChon nhom Text..." txt))
  4.   (setq ss (ssget "X" (list '(0 . "*TEXT") (cons 1 txt))))
  5.   (sssetfirst nil ss)
  6.   (princ)
  7. )
  8.  
thanks you so much