Delete entities in SelectionSet

Discussion in 'AutoCAD' started by Luís Laíns, Apr 26, 2004.

  1. Luís Laíns

    Luís Laíns Guest

    Hi all
    I'm trying to delete all the text entities in paper space that have
    textstring = 0.00
    I do select all the texts (msgbox told me that) but the SS1 selectionset
    doesn't delete any entity.
    Looks to me that I'm missing something in selection sets.....
    Thanks for any help

    Luís

    ----------------------------------------
    Dim SSet1 As AcadSelectionSet
    Dim I As Integer
    Dim objText As AcadEntity

    Set SSet1 = ThisDrawing.SelectionSets.Add("SS1")

    Dim Entity As AcadEntity
    On Error Resume Next
    ReDim ssobjs(0 To ThisDrawing.PaperSpace.Count - 1) As AcadEntity

    ii = 0

    For Each Entity In ThisDrawing.PaperSpace

    Set ssobjs(I) = ThisDrawing.PaperSpace.Item(I)

    If Entity.EntityName = "AcDbMText" Then

    If Entity.textString = 0# Then
    ii = ii + 1
    Set ssobjs(I) = Entity
    ' MsgBox ssobjs(I).textString
    End If

    End If
    Next Entity

    SSet1.AddItems ssobjs
    SSet1.delete
     
    Luís Laíns, Apr 26, 2004
    #1
  2. Luís Laíns

    Jeff Mishler Guest

    Hint: "Delete" removes the selection set from the selectionsets collection
    "Erase" does something else.........

    HTH,
    Jeff
     
    Jeff Mishler, Apr 26, 2004
    #2
  3. Private Sub EraseText()
    Dim ft(0 To 1) As Integer, fd(0 To 1) As Variant
    Dim SS As AcadSelectionSet
    On Error Resume Next
    Set SS = ThisDrawing.SelectionSets.Item("TextCollector")
    If Err Then
    Err.Clear
    Set SS = ThisDrawing.SelectionSets.Add("TextCollector")
    End If
    On Error GoTo 0
    SS.Clear
    ft(0) = 0: fd(0) = "TEXT": ft(1) = 8: fd(1) = "0" Or "0.0" Or "0.OO"
    SS.Select acSelectionSetAll, , , ft, fd
    SS.Erase
    End Sub
     
    Joe C. Parker, Apr 26, 2004
    #3
  4. Luís Laíns

    David Urban Guest

    try

    Dim SSet1 As AcadSelectionSet
    Dim filtertype(1), filterdata(1) As String
    Set SSet1 = ThisDrawing.SelectionSets.Add("SS1")
    filtertype(0) = 0: filterdata(0) = "TEXT"
    filtertype(1) = 1: filterdata(1) = "0.00"
    With SSet1
    .Select acSelectionSetAll, , , filtertype, filterdata
    .Erase
    .Update
    .Delete
    End With

    David Urban
     
    David Urban, Apr 26, 2004
    #4
  5. Luís Laíns

    Luís Laíns Guest

    Thanks for reply but still doesn't work.
    I do select the Text objects, but SS.delete does nothing.
    Any more hints?
    Luis
     
    Luís Laíns, Apr 27, 2004
    #5
  6. Luís Laíns

    Luís Laíns Guest

    Thanks for reply but still doesn't work.
    I do select the Text objects, but SSet1.delete does nothing.
    Any more hints?
    Luis
     
    Luís Laíns, Apr 27, 2004
    #6
  7. Luís Laíns

    Luís Laíns Guest

    Ha Ha, found the cat...
    It wasBut it should be
    If Entity.textString = 0# Then
    Set ssobjs (ii) = Entity
    ii = ii + 1
    (wrong argument in ssobjs()

    Thanks for all the help
     
    Luís Laíns, Apr 27, 2004
    #7
  8. Luís Laíns

    Luís Laíns Guest

    Ha Ha, found the cat...
    It wasBut it should be
    If Entity.textString = 0# Then
    Set ssobjs (ii) = Entity
    ii = ii + 1
    (wrong argument in ssobjs()

    Thanks for all the help
     
    Luís Laíns, Apr 27, 2004
    #8
  9. SS.Delete deletes the SelectionSet object
    SS.Erase deletes all objects in the SelectionSet
    SS.Clear removes all objects from the SelectionSet

    Regards - Nathan
     
    Nathan Taylor, Apr 28, 2004
    #9
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.