AstroNout Posted August 12, 2011 Share Posted August 12, 2011 Hi guys I've been doing some tweaking on my programs, but now i seem to have a problem with my active selectionset. Can I empty it? Because it's a read-only object, and the problem is that I use the active selectionset in my program. It runs just fine the first time, but the second time, it takes the last entity of the last run as the active selectionset. Here's the code: Sub DErase() Dim aEnt As AcadEntity Dim aLayer1, aLayer2 As AcadLayer Dim aSSet As AcadSelectionSet Dim strLayerName As String On Error GoTo Delete Set aSSet = ThisDrawing.SelectionSets.Add("sset") On Error GoTo Continue If ThisDrawing.ActiveSelectionSet.Count = 0 Then aSSet.SelectOnScreen Else Set aSSet = ThisDrawing.ActiveSelectionSet End If For Each aEnt In aSSet aLayer1 = aEnt.Layer strLayerName = "D_" & aLayer1 Set aLayer2 = ThisDrawing.Layers.Add(strLayerName) aEnt.Layer = "D_" & aLayer1 aEnt.Update Next ThisDrawing.SelectionSets.Item("sset").Delete Exit Sub Delete: ThisDrawing.SelectionSets.Item("sset").Delete Exit Sub Continue: Resume Next End Sub Thanks for the suggestions! 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.