Author Topic: remove duplicate selected objects  (Read 2605 times)

0 Members and 1 Guest are viewing this topic.

daron

  • Guest
remove duplicate selected objects
« on: November 21, 2003, 03:22:24 PM »
I'm writing a routine that will get the area of selected objects nested or otherwise. I can select objects all day, but I want to avoid selecting the same object twice. Does anybody have a function that will search through the list of objects, look at the handles and let me know that the object has already been selected and remove the object from the list? Thanks.

SMadsen

  • Guest
remove duplicate selected objects
« Reply #1 on: November 21, 2003, 03:49:27 PM »
What 'object' is the list containing? VLA object, enames or handles? Is it a list or a selection set? Selection set to list or vice visa?

If a list then EQ is excellent at comparing.

daron

  • Guest
remove duplicate selected objects
« Reply #2 on: November 21, 2003, 04:30:39 PM »
Thanks for the help. Equal seems to be a little better. I never could understand the difference between the three options. That really helped answer the differences.

SMadsen

  • Guest
remove duplicate selected objects
« Reply #3 on: November 21, 2003, 04:31:57 PM »
Huh? Is'at all?

daron

  • Guest
remove duplicate selected objects
« Reply #4 on: November 21, 2003, 04:37:38 PM »
I don't know, but you made me rethink how I was going about this. It seems that with equal, I can compare an entire entity selection. I'll let you know if I run into another road block. Thanks again.

SMadsen

  • Guest
remove duplicate selected objects
« Reply #5 on: November 21, 2003, 04:40:10 PM »
Well, if lists are the objectives then MEMBER is probably sufficient. But I'm sure you know all about that.

daron

  • Guest
remove duplicate selected objects
« Reply #6 on: November 21, 2003, 04:42:25 PM »
No, I've never used it. I have been trying to figure out vl-member and remove functions, but I can't seem to figure them out. I'll look into member though.

John Kaul (Se7en)

  • Administrator
  • Needs a day job
  • Posts: 9263
remove duplicate selected objects
« Reply #7 on: November 21, 2003, 05:09:50 PM »
Remeber with any of the VL functions, you have to meke them objects first, so i would just check to see if there are any duplicates before you start creating objects.

Just my thoughts.
“Common sense is not so common.” ~Voltaire

--> Donate to TheSwamp.org <--

daron

  • Guest
remove duplicate selected objects
« Reply #8 on: November 21, 2003, 06:19:25 PM »
Thanks Se7en, that's exactly what I did.
Thanks Stig for making me work through some functions.
Here's what I came up with. Pretty nice piece of code. Now all I have to do is make it reusable.
Code: [Select]
(while (setq nent (nentsel "\nSelect object to check the area of: "))
 (if (= alist nil)
      (setq alist (append alist (list (car nent))))
      (progn
   (setq tlist alist)
   (if (not (member (car nent) alist))
(setq alist (append alist (list (car nent))))
(progn
     (prompt
  "\nObject selected previously, will not be added to selection."
     )
     (setq alist tlist)
)
   )
      )
 )
     )