SelectionSets Question
Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DWF formats, Design Review, AutoCAD 360, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=4356
Printed Date: 22.Apr.2026 at 07:30
Topic: SelectionSets Question
Posted By: Silentwolf
Subject: SelectionSets Question
Date Posted: 16.Sep.2010 at 13:42
Hi guys, I am Albert and I just became a member of this forum and I am completly new to AutoCad VBA so please be gentle with me :)
As I like to get into Programming a little I looked on the net for some examples and found a small program to select layers in my drawing and then be able to change the drawing with an selected layer of a listbox.
The code below shows what I got but when I make a selection in my list box get an error ("The selection set exists")
Here is the code.
Private Sub CommandButton1_Click()
Dim Entity As Object Dim ss As AcadSelectionSets 'declare variable as local Me.Hide 'hide the dialogue box Set ss = ThisDrawing.SelectionSets.Add("NEWSS") 'create a selection set reference ss.SelectOnScreen 'select the objects to change For Each Entity In ss 'for every entity in the selection set Entity.Layer = ListBox1.Text 'change the layer to the layer name 'selected in the list box Next 'process the next entity End 'end the programme
'declare variable as local Me.Hide 'hide the dialogue box Set ss = ThisDrawing.SelectionSets.Add("NEWSS") 'create a selection set reference ss.SelectOnScreen 'select the objects to change For Each Entity In ss 'for every entity in the selection set Entity.Layer = ListBox1.Text 'change the layer to the layer name 'selected in the list box Next 'process the next entity End 'end the programme
End Sub
|
Could someone please let me know why it does not work or what I am missing?? I use AutoCad 2002.
It would be nice to get an answer from you guys and it would be very much appreciated!
Thanks
Albert
|
|