Jump to content

About ActiveSelectionSet


CAM

Recommended Posts

Hi,

I have written a code using Vba, which by selecting the command in userform, it asks to select the object in Acad Window and do some manipulations.

But I want to select the object first and then hit the command.

For the same i have used ActiveSelectionSet Property (ThisDrawing.ActiveSelectionSet). This is working fine and I have checked whether the selected object has been added to activeselectionset or not by using ThisDrawing.ActiveSelectionSet.count.

Then I have deselected the object and again I checked whether the object has been deleted form the selection set. But the Count is still same. How can I delete the object from the ActiveSelectionSet after the object has been deselected.

 

Is there anyone who has worked or familiar with ActiveSelectionSet proerty.Please help me with this.

Thanks in Advance

Link to comment
Share on other sites

May you try to use SelectionSet by selecting the object by SelectOnScreen instead ActiveSelectionSet

With intCode Array and GV Array you can define previously the object type (see DXF group code for a correct use)

 

GV(0) = "INSERT"
'---------------------------------------------------
'Revise the block name "tendnum1" for your application

GV(1) = "block"
 
intCode(0) = 0: ' 
intCode(1) = 2: 

ThisDrawing.SelectionSets.Add ("BOM")
Set Ssnew = ThisDrawing.SelectionSets("BOM")

 '   ->Ssnew.Select acSelectionSetCrossing, PT2, PT1, intCode, GV

 '   ->Ssnew.Select acSelectionSetAll, PT2, PT1, intCode, GV

 Ssnew.SelectOnScreen

 

PLS remember to delete the selection set before starting with a new selection, usually I insert the below code at the beginning of the routine.

 

For Each Paperino In ThisDrawing.SelectionSets
  If Paperino.name = "BOM" Then
     ThisDrawing.SelectionSets("BOM").Delete
     Exit For
  End If
Next

 

Bye

Edited by PeterPan9720
further detail
Link to comment
Share on other sites

Hi Peter,

Thanks for ur reply. But with the code what you have sent, we need to first run the code so that it prompts us to select the objects on screen, Right? But what I need is first I want to select the object on screen and then if I run the code the selected object should get assign to the selection set. So the ActiveSelectionSet Property serves this purpose. But the problem what I am facing is if I deselect the object from screen, it is not getting removed from the selectionSet.

 

Do you have any Idea how I can do this?

Thanks

Link to comment
Share on other sites

  • 4 years later...

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