Jump to content

Recommended Posts

Posted

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

Posted

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)
   )
 )
)

Posted

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

Posted

Does this help you any?

 

(setq ss (ssget))
(setq ssobj (vla-get-activeselectionset
             (vla-get-activedocument (vlax-get-acad-object))
           )
)
(vla-erase ssobj)

Posted

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

Posted

Many thanks Buzzard, that cleared things up quite nicely :)

 

Good ol' AfraLISP :D

 

Cheers

 

Lee

Posted

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.

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...