Author Topic: Selecting by handle  (Read 2121 times)

0 Members and 1 Guest are viewing this topic.

Fuccaro

  • Guest
Selecting by handle
« on: September 06, 2005, 12:31:19 AM »
I play with various selection methods. If I enter
Code: [Select]
(ssget "X" (list (assoc 0 (entget (entlast)))))it works as expected.

Now I try to select by the handle.
Code: [Select]
(ssget "X" (list (assoc 5 (entget (entlast)))))But why it returns NIL? It should return a selection set containing the last entity, isn’t it? How to select an entity by its handle? Must I iterate the entire database? Please help a confused man!
Thank you

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Selecting by handle
« Reply #1 on: September 06, 2005, 12:53:41 AM »
If you really want selection sets for single entities
and
If you really just want the last entity then dont worry about the handle

ie ;
Code: [Select]
(setq lastent_ss (ssadd (entlast)))
If you want to use the < previously saved> handle to make a selection of a single entity then ;
Code: [Select]
(setq ent_handle (cdr (assoc 5 (entget (car (entsel))))))
;|

do
other
stuff

|;

(setq handle_ss (ssadd (handent ent_handle)))

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Selecting by handle
« Reply #2 on: September 06, 2005, 02:25:32 AM »
ssget doesn't support code 5, see help - rest is explained by Kerry
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

Fuccaro

  • Guest
Re: Selecting by handle
« Reply #3 on: September 07, 2005, 12:41:22 AM »
Yes!
I forgot about the HANDENT function. :oops:

Thank you my friends!