Steven P Posted August 12, 2023 Posted August 12, 2023 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 Quote
mhupp Posted August 12, 2023 Posted August 12, 2023 (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 August 13, 2023 by mhupp Updated Code 1 Quote
Steven P Posted August 12, 2023 Author Posted August 12, 2023 Thanks - I'll give that a go, should just fit into what I have nicely too Quote
mhupp Posted August 13, 2023 Posted August 13, 2023 (edited) oops put a not in the if statement so it was removing the ones that it should be keeping. Edited August 13, 2023 by mhupp 1 Quote
Steven P Posted August 13, 2023 Author Posted August 13, 2023 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 1 Quote
Recommended Posts
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.