VBA Selection Sets issue

I have an application I am working on that uses VBA's selection set command. E.g. something like;TempBlockSS.Select acSelectionSetAll, , , fType, fData It was working, but it has stopped working. It sometimes generates an error saying "This command not yet implemented"... but other times it doesn't generate that error. But, even without that specific error, my code doesn't seem to be working at this point. I suppose it is possible that I have made a change to my code to cause the problem.But before I start on a wild goose chase, what is the status of filters with selection set methods VBA?Joe Dunfee

Comments

  • I have solved my problem by uninstalling the current version, and going back to version 8.016. Either 8.017 or 8.018 broke the command.Joe Dunfee

  • This works in V8-19-1Sub Example_Select_Circle() '********* Create the selection setDim ssetObj As AcadSelectionSetSet ssetObj = ThisDrawing.SelectionSets.Add("TEST1") '********** Add all the Circles Dim grpCode(0) As Integer Dim dataValue(0) As Variant grpCode(0) = 0 dataValue(0) = "Circle" Dim groupCode As Variant, dataCode As Variant groupCode = gpCode dataCode = dataValue ssetObj.Select acSelectionSetAll, , , groupCode, dataCode ssetObj.Highlight True End SubOf course you need to dispose of ssetObj between calls or use a new name like TEST2 or such. Jerry

  • reacting to Jerry Johnson post: '********* Create the selection set Dim ssetObj As AcadSelectionSet Set ssetObj = ThisDrawing.SelectionSets.Add("TEST1") ... 'Of course you need to dispose of ssetObj between calls or use a new name like TEST2 or such. Rather than naming the Selection Set you create a referrence to the 'CURRENT' selection set as below: Dim ssetObj As AcadSelectionSet Set ssetObj = ThisDrawing.ActiveSelectionSet ssetObj.Clear 'empty the selection set, since it could contain a previous selection...

  • Thanks for that tip, I've been confused as to what was the best way to do that.Jerry

  • I've used to do following when declaring a SelectionSet:Dim sset As IntelliCAD.SelectionSetOn local error resume next ActiveDocument.SelectionSets.Item("Sset1").Deleteon local error goto 0Set sset = ActiveDocument.Selectionsets.add("Sset1")'>> Macro continues hereI always try to Delete the selectionset, then create it again.When during debugging a macro gets aborted and the Sset.Delete hasn't been executed, creating an existing Sset always generates an error on startup.So I just always try and delete it, the error trap will save me in case the Sset wasn't there.Arno van Eeuwen

  • I think there is a problem. Jerry's code works here too, but if I want to address the individual Items of the selection set I get an error as they do not exist. At least in the Locals Window ssetObj has only four porperties: ApplicationCountNameVisiblePlease can anyone confirm this?Joe, what does your version 8.0.16 say?

  • I made a mistake, it seems to work!At least sObj will become my circle in this testSub Test_SS_Items()Dim ssetObj As AcadSelectionSetDim sObj As AcadEntitySet ssetObj = ThisDrawing.ActiveSelectionSetssetObj.ClearssetObj.Select acSelectionSetAllSet sObj = ssetObj.Item(0)End Sub

  • I started a new job today and don't expect to be nearly as involved with this discussion group.The company I was writing the code for is having some financial difficulties. But, the good news for them is that the program I created (even if not quite 100% finished) is able to allow me to do drawings for them without a lot of time involved.But, I don't have as much time to deal with issues like this selection set bug. So, I will avoid upgrading my BricsCad in fear of breaking my code again.Joe Dunfee

This discussion has been closed.