Author Topic: Getting the entinity name of a selection set  (Read 2490 times)

0 Members and 1 Guest are viewing this topic.

iliekater

  • Guest
Getting the entinity name of a selection set
« on: January 08, 2007, 05:02:44 PM »
I'd like to obtain the entinity name of a selected set . You see , I have used the ssget function to create a selection set of objects , set it on a variable , but I cannot get its entinity name . I want the entinity's name , in order to delte it (not the objects , but only the entinity - probably by using the entdel function) .
You may wonder why do I want to delete an entinity from the data base , instead of deleting the objects .
Well , you see , I have created a function that , among other things , selects some objects by using the Previous statement
( setq MySS ( ssget "P" ) )
then , at some point , recalls itshelf , but even if the user does not select anything , the command still selects the previously selected object , becouse the entinity still exists , even if now the MySS selection set is null ...

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Getting the entinity name of a selection set
« Reply #1 on: January 08, 2007, 05:18:46 PM »
One way

Code: [Select]
       (setq i -1)
       (while (setq ename (ssname ss (setq i (1+ i))))
         (setq lst (cons ename lst))
       )
       
another way
       
Code: [Select]
(setq lst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
But you can use the command to erase the selectionset.

Code: [Select]
(setq ss (ssget))
(command "_erase" 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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Getting the entinity name of a selection set
« Reply #2 on: January 08, 2007, 05:22:21 PM »
PS to delete the list
Code: [Select]
(mapcar 'entdel lst)
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.

iliekater

  • Guest
Re: Getting the entinity name of a selection set
« Reply #3 on: January 08, 2007, 05:31:32 PM »
Thanks CAB . I don't want to delete the selection set , I only want to delete (or turn nil) the entinity that was created when I selected objects using the Previous statement
( ssget "P" )
becouse that damn entinity still exists despite the fact that the user tried not to reselect anything .
As far as conserning the rest of the code you provided me , I am going to give it a look tomorow . Right now my eyes are closing due  to my fatigue . I am Aaaaaaaaaaaahhh falling ..... A  aa sleep ..
I don't ... de. ...
ZZZzzzzzzzzzzzzzzzzzzzzzz ....

LE

  • Guest
Re: Getting the entinity name of a selection set
« Reply #4 on: January 08, 2007, 05:53:51 PM »
The only way I know is by doing the following:

1. Draw a dummy object.
2. Call command "select" "last"
3. Delete the dummy object
« Last Edit: January 08, 2007, 05:56:43 PM by LE »

Atook

  • Swamp Rat
  • Posts: 1029
  • AKA Tim
Re: Getting the entinity name of a selection set
« Reply #5 on: January 08, 2007, 06:21:08 PM »
What about saving the previous selection set before you do anything, running your routine, then reselecting the previous selection, so it previous again?