Author Topic: Select all TEXT smaller than ...  (Read 1560 times)

0 Members and 1 Guest are viewing this topic.

Hangman

  • Swamp Rat
  • Posts: 566
Select all TEXT smaller than ...
« on: July 21, 2011, 03:31:11 PM »
I am trying to select all the text in a drawing 1/8" or smaller and I've come across a blank spot in my head.
Code: [Select]
(setq A (ssget "_X" (list (cons (0 "Text")
                                (40 **???**)
                          )
                   )
       )
)

I know this should be a simple thing, but I'm at a mental loss.
What do you suggest?

Thanks.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Select all TEXT smaller than ...
« Reply #1 on: July 21, 2011, 03:42:03 PM »
It's been a while, but I think this is what you are looking for.
Code: [Select]
(ssget "_X" '((0 . "Text")
                     (-4 . "<=")
                     (40 . 0.125)
                    )
)

Hangman

  • Swamp Rat
  • Posts: 566
Re: Select all TEXT smaller than ...
« Reply #2 on: July 21, 2011, 04:39:01 PM »
It's been a while, but I think this is what you are looking for.
Code: [Select]
(ssget "_X" '((0 . "Text")
                     (-4 . "<=")
                     (40 . 0.125)
                    )
)

I was thinking I needed the [  (list (cons  ] because I was using two or more codes when I posted my question.
Then after posting my question, I got to think'n, ... 'I don't think there is a conditional operator for DXF' ... .
I'd of never thought of using the [  (-4 . "<=")  ] in this manner.  Glad you were here Jeff.

So I just learned something new today.  This works perfectly.  Thank you Jeff.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: Select all TEXT smaller than ...
« Reply #3 on: July 21, 2011, 05:02:39 PM »
Hi .

This is a little bit long than the use of dxf operator but it is a good practice of looping to get (filter) what you in need of .

Code: [Select]
  (if
    (setq s (ssget "_x" '((0 . "TEXT"))))
     (progn
       (repeat (setq j (sslength s))
         (setq e (ssname s (setq j (1- j))))
         (if (<= (cdr (assoc 40 (entget e))) 0.125)
           (ssdel e s)
         )
       )
       (sssetfirst nil s)
     )
     (princ)
  )

Tharwat

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Select all TEXT smaller than ...
« Reply #4 on: July 21, 2011, 05:58:49 PM »
Hangman,

In the Visual LISP IDE Help Documentation, have a read of the following sections:

Code: [Select]
+ Using the AutoLISP Language
|
+--+ Using AutoLISP to Manipulate AutoCAD Objects
   |
   +--+ Selection Set Handling
      |
      +--+ Selection Set Filter Lists
         |
         +--> Relational Tests
         |
         +--> Logical Grouping of Filter Tests