Author Topic: Trim selection set, Filter for quantity?  (Read 2472 times)

0 Members and 1 Guest are viewing this topic.

matrix2005in

  • Guest
Trim selection set, Filter for quantity?
« on: June 19, 2006, 10:25:57 PM »
hi

i would like to trim my selection set to fixed number.

eg:-if my selection set contains 250 objects i want trim to 150...when my command starts it should only select 150
is it possible??
 :roll:

mathew
« Last Edit: June 20, 2006, 08:36:41 AM by CAB »

kpblc

  • Bull Frog
  • Posts: 396
Re: Trim selection set
« Reply #1 on: June 20, 2006, 12:07:37 AM »
I think it's impossible. You can use filters for your selection.
Sorry for my English.

MickD

  • King Gator
  • Posts: 3637
  • (x-in)->[process]->(y-out) ... simples!
Re: Trim selection set
« Reply #2 on: June 20, 2006, 12:53:39 AM »
Why not create a new selection set out of the first adding only 150 items from the first??
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

FengK

  • Guest
Re: Trim selection set
« Reply #3 on: June 20, 2006, 04:04:15 AM »
Not sure what you're trying to do.
If you have a selectionset ss,
(setq count (sslength ss))
(if (> count 150)
  (repeat (- count 150)
    (ssdel (ssname ss 0) ss)
  )
)


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Trim selection set, Filter for quantity?
« Reply #4 on: June 20, 2006, 08:50:19 AM »
You may want to retain the first 150 items like this.
Code: [Select]
(defun c:test ()
  (setq ss (ssget))
  (setq i (sslength ss))
  (while (and (setq ename (ssname ss (setq i (1- i))))
              (> (sslength ss) 150)
         )
    (ssdel ename ss)
  )
 (sslength ss)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

matrix2005in

  • Guest
Re: Trim selection set, Filter for quantity?
« Reply #5 on: June 20, 2006, 01:47:30 PM »
thanks CAB
thats working...gr8

 :-)