Jump to content

Recommended Posts

Posted

So I can join 2 selection sets together, loop through one selection set and ssadd each item as it goes

(simple example set 1: 1, 2, 3,  set 2: 4 5 6 -> 1, 2, 3, 4, 5, 6).

 

is there a nice way to create a selection set that is the intersection of 2 selection sets - that is if an entity is in both then retain it, otherwise discard it

(simple example set 1: 1, 2, 3, set 2: 2, 3, 4 -> 2, 3 but using selection sets)

 

I could do something with (ssmemb .....) but wondered if there was anything a bit cleverer

 

ta

Posted (edited)

With comparing you have to pick the long list. Made a simple function that will output the entity names that are in both. just feed it the selection set names.

 

 

Then its just ssadd to an new selecton set.


 

(setq sspoly (ssget))
(setq ss (ssget))
...
(setq ssb (ssadd))
(setq lst (MH:SSI SSpoly SS))
(while lst
  (ssadd (car lst) ssb)
  (setq lst (cdr lst))
)

 

 

SSI.lsp

Edited by mhupp
Updated Code
  • Like 1
Posted

Thanks - I'll give that a go, should just fit into what I have nicely too

Posted (edited)

oops put a not in the if statement so it was removing the ones that it should be keeping.

Edited by mhupp
  • Like 1
Posted

A quick test cut down the time to do what I was doing from 12 to 4 seconds so a big improvement - barely time to get a drink, but short enough for me to stop wondering if it was all going wrong though (but overall a mornings work to 4 seconds is acceptable).

 

Cheers

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...