CAD Forum - Database of tips, tricks and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 9064
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

 

HelpCAD discussion

 
CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.

How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedSelectionSets Question

 Post Reply Post Reply
Author
Silentwolf View Drop Down
Newbie
Newbie


Joined: 16.Sep.2010
Location: Austria
Using: AutoCAD 2002
Status: Offline
Points: 2
Direct Link To This Post Topic: SelectionSets Question
    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

Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,374 seconds.