Jump to content

MODIFICATION IN CODE (TO AVOID CASE SENSITIVE IN TEXT SELECTION FROM LISP)


Recommended Posts

Posted (edited)

Dear Helpers,

 

I got a lisp code that can select text elements in entire drawing by user input. But it's not working for case sensitive letters and also not asking for window selection. Please do needful.

 

(defun C:SWT (/ str ss) ; = Find String(s) by Content
(setq str (getstring "\nYour [full or partial] string content to search for: "))
(if (setq ss (ssget "_X" (list (cons 0 "*TEXT") (cons 1 (strcat "*" str "*")) (cons 410 (getvar 'ctab)))))
(sssetfirst nil ss); select/highlight/grip
); if
); defun

 

Regards,

T.Brahmanandam.

Edited by tnvsb
Posted (edited)

MODIFICATION IN CODE (TO AVOID CASE SENSITIVE IN TEXT SELECTION FROM LISP)

 

MODIFICATION IN CODE (TO ACCEPT CASE SENSITIVE IN TEXT SELECTION FROM LISP)

 

(defun C:SWT ( / str ss sss i txt ) ; = Find String(s) by Content
  (setq str (getstring "\nYour [full or partial] string content to search for: "))
  (setq sss (ssadd))
  (if (setq ss (ssget (list (cons 0 "*TEXT") (cons 410 (getvar 'ctab)))))
    (repeat (setq i (sslength ss))
      (setq txt (ssname ss (setq i (1- i))))
      (if (wcmatch (cdr (assoc 1 (entget txt))) (strcat "*" str "*"))
        (ssadd txt sss)
      ); if
    ); repeat
  ); if
  (if sss
    (sssetfirst nil sss); select/highlight/grip
  ); if
  (princ); quiet exit
); defun

HTH., M.R.

Edited by marko_ribar
  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...