Lee Mac Posted April 20, 2009 Posted April 20, 2009 Sorry for all these threads, but I am just trying to fill in the gaps in my knowledge, and clear up a few things that have been "bugging" me. I have looked at trying to work with Selection Sets in VL, but have been unsuccessful, so I have a few questions: How do you create a selection set in VL? (as opposed to "ssget") Can use use a SelectionSet created with "ssget" with VL functions? such as vla-erase? Or does the SelectionSet need to be converted somehow, like in "vlax-ename->vla-object"? I thank you for your time and patience Cheers Lee Quote
chauncy274 Posted April 20, 2009 Posted April 20, 2009 Here is a little routine that I wrote with the help of some members from TheSwamp. It grabs everything on color 160 and changes everythings color to bylayer. The guy who helped me added in the vl functions to work with my original selection set. I'm no expert but I think your right, you need to convert it as you mentioned. Hope it helps. (defun c:returnbylayer (/ n ent) (vl-load-com) (setq n -1) (if (setq ss1 (ssget "_X" '((62 . 160)))) (while (setq ent (ssname ss1 (setq n (1+ n)))) (vla-put-color (vlax-ename->vla-object ent) 256) ) ) ) Quote
Lee Mac Posted April 20, 2009 Author Posted April 20, 2009 Thank you for your reply Chauncy - it is much appreciated. The selection set in your code has been created with ssget, and then when shuffling through the set, each member has been converted to a vla-object in turn. But with vla-erase, it requires a selection set, and so this method would not work - so my question would be, do I use the selection set created by "ssget" or to I need to convert it in some way to another form. Or can I create a selection set in VL. But thank you for your time Chauncy Lee Quote
ronjonp Posted April 20, 2009 Posted April 20, 2009 Does this help you any? (setq ss (ssget)) (setq ssobj (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)) ) ) (vla-erase ssobj) Quote
Lee Mac Posted April 20, 2009 Author Posted April 20, 2009 Thanks Ronjonp, I can see how that would work - but is there a way to create the initial selection set using VL? Thanks for your reply Lee Quote
The Buzzard Posted April 20, 2009 Posted April 20, 2009 Lee, Not sure if you had checked this out yet or if its helpful, But give it a look. http://www.afralisp.net/vl/selsets.htm The Buzzard Quote
Lee Mac Posted April 20, 2009 Author Posted April 20, 2009 Thanks Buzzard, I shall have a browse Lee Quote
Lee Mac Posted April 20, 2009 Author Posted April 20, 2009 Many thanks Buzzard, that cleared things up quite nicely Good ol' AfraLISP Cheers Lee Quote
The Buzzard Posted April 20, 2009 Posted April 20, 2009 I know what you mean. Sometimes we forget it is there and never realize just how much there is at that site. A real valuable asset to programmers. 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.