vivekgrs Posted January 21, 2009 Share Posted January 21, 2009 hi everybody, i am trying to zoom to the feature which was selected previous using vba. i had tried a lot but i failed. if anyone help me regarding this. i used object.select acselectionsetprevious for this issue. but its not working regards m.arunachalam Quote Link to comment Share on other sites More sharing options...
SEANT Posted January 21, 2009 Share Posted January 21, 2009 The board could give more direct help if you post a sample of the relevant code. Without that we would just be guessing. Quote Link to comment Share on other sites More sharing options...
vivekgrs Posted January 21, 2009 Author Share Posted January 21, 2009 this is my code Dim ssEntites As AcadSelectionSet Set ssEntites = ThisDrawing.SelectionSets.Add("AS_BUILT_PIPE") ssEntites.Select acSelectionSetprevious msgbox ssentites.count Quote Link to comment Share on other sites More sharing options...
SEANT Posted January 21, 2009 Share Posted January 21, 2009 Try something like this: Sub Example_Select() Dim ssEntites As AcadSelectionSet For Each ssEntites In ThisDrawing.SelectionSets If ssEntites.Name = "AS_BUILT_PIPE" Then ssEntites.Delete Next Set ssEntites = ThisDrawing.SelectionSets.Add("AS_BUILT_PIPE") ssEntites.Select acSelectionSetPrevious MsgBox ssEntites.Count End Sub Quote Link to comment Share on other sites More sharing options...
vivekgrs Posted January 21, 2009 Author Share Posted January 21, 2009 hi seant, Thank u for your immediate reply. i had tried ur coding that is also giving the same result. i had select one entity and run your code. for selecting the entity i had used ThisDrawing.Utility.GetEntity acent, bpt, "select the line :" MsgBox ssEntites.Count - it is giving 943.but it wants to give 1. is there any possibility to check which entity is selected in the drawing can u guide me whether im going in correct way or not. Quote Link to comment Share on other sites More sharing options...
SEANT Posted January 21, 2009 Share Posted January 21, 2009 I have to say that is odd. If you ran the sample I posted (Sub Example_Select()) with either 1 entity currently selected, or only 1 entity having been previously selected, and the MsgBox shows 943 – I can’t even guess why. The problem may be traceable but might require your posting the drawing along with all of your preloaded lisp and VBA routines, which may have reactors running. Quote Link to comment Share on other sites More sharing options...
vivekgrs Posted January 21, 2009 Author Share Posted January 21, 2009 hi seant, Once again thanks for your help.its working when i had used selectonscreen option for selecting entity. but i had used ThisDrawing.Utility.GetEntity acent, bpt, "select the line :" i need one more query is there any possibility to check which entity is selected in the drawing and add in the selectionset thanks Quote Link to comment Share on other sites More sharing options...
SEANT Posted January 21, 2009 Share Posted January 21, 2009 hi seant, Once again thanks for your help.its working when i had used selectonscreen option for selecting entity. but i had used ThisDrawing.Utility.GetEntity acent, bpt, "select the line :" i need one more query is there any possibility to check which entity is selected in the drawing and add in the selectionset thanks Correct me if I'm wrong but it sounds like you have the original problem figured out. with regard to the last query, the process would be something like this: Dim CurrentSSet as As AcadSelectionSet Dim ExistSSet as As AcadSelectionSet . . . . . . . ' Iterate through CurrentSSet ' Collect the objects found into an array of objects ' to be added to the Existing selection set. ReDim ssobjs(0 To CurrentSSet.count - 1) As AcadEntity Dim I As Integer For I = 0 To CurrentSSet.count - 1 Set ssobjs(I) = CurrentSSet.Item(I) Next ' Add the array of objects to the selection set ExistSSet.AddItems ssobjs . . . . . . . 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.