See the top rated post in this thread. Click here

Results 1 to 4 of 4

Thread: The named selection set exists error

  1. #1
    Member
    Join Date
    2003-02
    Location
    Calgary, AB
    Posts
    44
    Login to Give a bone
    0

    Default The named selection set exists error

    I used:

    Set gssetObjs = ThisDrawing.SelectionSets.Add("MainSelSet")

    to create my selection set.

    Unfortunately my project had crashed after creating this selection set.

    Therefore the selection set object, gssetObjs, no longer exists obviously, but the Named selection set still seems to be in memory. Without restarting AutoCAD, how can delete my "MainSelSet" selection set.

    --------------------------

    Upon searching the internet I found a solution:

    On Error Resume Next
    ThisDrawing.SelectionSets("MainSelSet").Delete

    Set gssetObjs = ThisDrawing.SelectionSets.Add("MainSelSet")
    Last edited by cgerhardt; 2006-10-03 at 05:27 PM. Reason: Found solution

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,568
    Login to Give a bone
    0

    Default Re: The named selection set exists error

    You don't need to worry about deleting it, just reuse it. Try this function.

    Code:
    Public Function AddSelectionSet(SetName As String) As AcadSelectionSet
    ' This routine does the error trapping neccessary for when you want to create a
    ' selectin set. It takes the set and the proposed name and either adds it to the selectionsets
    ' collection or sets it.
        On Error Resume Next
        Set AddSelectionSet = ThisDrawing.SelectionSets.Add(SetName)
        If Err.Number <> 0 Then
            Set AddSelectionSet = ThisDrawing.SelectionSets.Item(SetName)
        End If
    End Function
    You can then clear the ss if you wish.
    Code:
    Dim ss As AcadSelectionSet
    Set ss = AddSelectionSet("MySS")
    ss.Clear
    C:> ED WORKING....


    LinkedIn

  3. #3
    AUGI Addict MikeJarosz's Avatar
    Join Date
    2015-10
    Location
    New York NY
    Posts
    1,497
    Login to Give a bone
    1

    Default Re: The named selection set exists error

    You do have your immedite window open, don't you? You can type:


    ThisDrawing.SelectionSets("MainSelSet").Delete

    In the immediate window. While developing a program, the immediate window is your best friend.

  4. #4
    Woo! Hoo! my 1st post
    Join Date
    2008-07
    Posts
    1
    Login to Give a bone
    0

    Default Re: The named selection set exists error

    Without deleting the existing same selectionset and adding may lead to error sometimes

    Try the following:

    Sub MySelectionSet()
    Dim ss As AcadSelectionSet
    On Error Resume Next
    Set ss = ThisDrawing.SelectionSets.Add("Suman")
    If Err.Number <> 0 Then
    ThisDrawing.SelectionSets.Item("Suman").Delete
    Set ss = ThisDrawing.SelectionSets.Add("Suman")
    End If
    ss.SelectOnScreen

    MsgBox "Number of entities in the Selectionset is" & vbCrLf & ss.Count
    End Sub

Similar Threads

  1. 2012: Converting Points Error Message= Invalid Selection Set!
    By ryni4321363492 in forum AutoCAD Civil 3D - General
    Replies: 1
    Last Post: 2013-03-05, 03:01 AM
  2. 2010: error: Unable to load customization file That customization Group already exists
    By aheintze351177 in forum AutoCAD 3D (2007 and above)
    Replies: 0
    Last Post: 2013-01-09, 10:06 PM
  3. Replies: 0
    Last Post: 2011-05-30, 07:07 AM
  4. Lost In Selection Set Error Handling...
    By dsthilare in forum VBA/COM Interop
    Replies: 3
    Last Post: 2008-12-04, 09:53 PM
  5. Fatal error on selection of properties
    By paula in forum AutoCAD LT - General
    Replies: 1
    Last Post: 2005-08-09, 10:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •