CAM Posted November 12, 2010 Share Posted November 12, 2010 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 Quote Link to comment Share on other sites More sharing options...
PeterPan9720 Posted November 16, 2010 Share Posted November 16, 2010 (edited) 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 November 16, 2010 by PeterPan9720 further detail Quote Link to comment Share on other sites More sharing options...
CAM Posted November 17, 2010 Author Share Posted November 17, 2010 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 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 19, 2010 Share Posted November 19, 2010 Try select objects enter (ssget "P") this makes a selection set of previous picked objects probably same way with VBA Quote Link to comment Share on other sites More sharing options...
minnies Posted January 15, 2015 Share Posted January 15, 2015 I know it's a old thread, but I have the same problem. Did you found a solution??? Thanks, Quote Link to comment Share on other sites More sharing options...
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.