drafter007 Posted June 26, 2012 Posted June 26, 2012 I have a list with multiple selection sets, i want to join them into a single selection set, ho? Quote
MSasu Posted June 26, 2012 Posted June 26, 2012 Parse them with SSNAME, first item had index 0, and add to the first one using SSADD function. To get the size of a selection set use SSLENGTH. Quote
Tharwat Posted June 26, 2012 Posted June 26, 2012 maybe something like this would work ..... Try it ... (setq s (ssget)) (setq ss (ssget)) (repeat (setq i (sslength s)) (ssadd (ssname s (setq i (1- i))) ss) ) Quote
marko_ribar Posted June 27, 2012 Posted June 27, 2012 You can use ACET functions for Selection sets : (setq sss (acet-ss-union (list ss1 ss2 ss3 ... ssn))) M.R. Quote
drafter007 Posted June 27, 2012 Author Posted June 27, 2012 Only with express tools... nobody has a function similar to acet-ss-union? Quote
MSasu Posted June 27, 2012 Posted June 27, 2012 It is a mater of minutes to write one by yourself using the info above. If you got stuck, then post your attempt here for debug support. Quote
pBe Posted June 27, 2012 Posted June 27, 2012 Only with express tools... nobody has a function similar to acet-ss-union? What exactly do you have in mind drafter007? It appears that tharwats snippet will accomplish what you need. Quote
MSasu Posted June 27, 2012 Posted June 27, 2012 The Express function work with any number of selection sets, while Tharwat's example is limited to only two. I think that this is the reason of OP's complain. But said example code can be used effectively as a starting point to a dedicated function similar with the one from Express pack. This should be easy taking into consideration that OP had already some experience playing with selection sets. Quote
pBe Posted June 27, 2012 Posted June 27, 2012 ..... But said example code can be used effectively as a starting point to a dedicated function.... That is correct , I meant to say exactly that Quote
drafter007 Posted June 27, 2012 Author Posted June 27, 2012 But i still want to see a function made by some guys with more experience ...please... Quote
Tharwat Posted June 27, 2012 Posted June 27, 2012 But i still want to see a function made by some guys with more experience ...please... You should be thankful for all people whom treated you as a man to help you out with your question and not to be ungrateful . Quote
Lee Mac Posted June 27, 2012 Posted June 27, 2012 Here is one way: ;; Selection Set Union - Lee Mac ;; Returns the union of a list of Selection Sets (defun LM:ss-union ( lst / out ) (setq lst (vl-sort lst '(lambda ( a b ) (> (sslength a) (sslength b)))) out (car lst) ) (foreach ss (cdr lst) (repeat (setq i (sslength ss)) (ssadd (ssname ss (setq i (1- i))) out) ) ) out ) Here is a 'cheats' way: (defun ss-union ( lst ) (apply 'vl-cmdf (append '("_.select") lst '(""))) (ssget "_P") ) Quote
drafter007 Posted June 27, 2012 Author Posted June 27, 2012 Thanks Lee! One more beer i owe you... Quote
pBe Posted June 27, 2012 Posted June 27, 2012 Here is one way: (defun LM:ss-union ( lst / out )..... ..... ) There you go After looking the linky MSasu posted on his previous post. My thought was the "list with multiple selection sets" you are refering to are a list of enames as elements. but reading further ahead , you change your aapproach to collecting points then ssget "_CP" But anyhoo, Hope you dont mind me asking, are those selection sets resulted from a single call to a lisp routine? Quote
drafter007 Posted June 27, 2012 Author Posted June 27, 2012 Yes, a single call, but i modified the lisp to have multiple selection - multiple points of selection - so i have a list with multiple selection sets... Sorry for my way of working and for my bad explanations... Quote
Lee Mac Posted June 27, 2012 Posted June 27, 2012 Thanks Lee! One more beer i owe you... You're welcome drafter007, though, I would encourage you to attempt to code these tasks yourself before expecting a solution to be provided. Quote
marko_ribar Posted June 27, 2012 Posted June 27, 2012 Only with express tools... nobody has a function similar to acet-ss-union? Every AutoCAD has ACET functions loaded and no need to do anything but use them... My solution is fastest as it was made by Autodesk for exactly these purposes... You can also check : (acet-ss-remove (smaller ss2) (bigger ss1)) - returns ss difference (ss1-ss2) (acet-ss-intersection ss1 ss2) - returns ss with objects that are both in ss1 and ss2 (acet-ss-union (list ss1 ss2 ss3 ... ssn)) - returns ss addition (ss1+ss2+ss3+...+ssn) M.R. Quote
pBe Posted June 27, 2012 Posted June 27, 2012 I'll go with the OP on this one Marko. I would think its not the just having to use a particular function that interest the OP, but how it was done I applaud the forum members who help/assist/advice/suggest and even write the code itself to help others. Cheers Quote
marko_ribar Posted June 27, 2012 Posted June 27, 2012 pBe, I've also tried this once on www.augi.com : http://forums.augi.com/showthread.php?138426-sel-sets-subfunctions&p=#1 But results were slow if ssets were large, so after a while doing my research on this topic, my conclusion was that the best thing is to use already predefined functions... Maybe, you don't agree with me, but to me they do the job fine and more important I think faster then any of above proposed codes... M.R. (test it and if you disagree reply...) Quote
Lee Mac Posted June 27, 2012 Posted June 27, 2012 Every AutoCAD has ACET functions loaded and no need to do anything but use them... Some users don't have Express Tools installed / loaded. 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.