Using AutoLISP to select all text longer than one character

Using AutoLISP to select all text longer than one character

Anonymous
Not applicable
984 Views
3 Replies
Message 1 of 4

Using AutoLISP to select all text longer than one character

Anonymous
Not applicable

The title says it all. Is there an AutoLISP guru who can pass on the correct incantation? I can't figure out what the filter-list parameter should be for this.

0 Likes
Accepted solutions (1)
985 Views
3 Replies
Replies (3)
Message 2 of 4

trevor.bird.au
Advocate
Advocate

Hi Samuel,

 

I hope the following helps.

 

It is only selecting TEXT objects, not MTEXT, and hasn't been tested on all the control codes and special character codes that could be prefixing your text.

 

It should select "Ø12" but not "Ø1", but if you need to select text like "Ø1" then remark out or delete relevant lines.

(defun c:ssgettext ( / sstext )
  (setq sstext
    (ssget
      '(
        (0 . "TEXT")

        (-4 . "<AND")

          (-4 . "<OR")
            (1 . "??*")     ; e.g. "AB"
            (1 . "%%???*")  ; e.g. "%%c12" (Ø12)
          (-4 . "OR>")

          (-4 . "<NOT")
            (1 . "%%??")    ; e.g. "%%c1" (Ø1)
          (-4 . "NOT>")

        (-4 . "AND>")
      )
    )
  )

  (if sstext
    ;;  Grip and select.
    (sssetfirst nil sstext)
  )

  (princ)
)

Regards,

Trevor

0 Likes
Message 3 of 4

john.uhden
Mentor
Mentor
Accepted solution

I haven't tried it, but how about '(1 . "??*")

John F. Uhden

0 Likes
Message 4 of 4

Anonymous
Not applicable

Thanks! This is exactly what I needed. I hadn't used wildcards in ssget before, so it didn't even occur to me to use them here.

0 Likes