Results 1 to 5 of 5

Thread: how to purge deleted blocks

  1. #1
    Member
    Join Date
    2001-09
    Posts
    34

    Default how to purge deleted blocks

    I have write a vba program that places a block in a drawing.
    If the user delete the block then runs the program it loads the original block with two more attributes.
    Is there a purge command in VBA for a getting rid of the first block.
    my selection set dose not find the first deleted block
    'This subroutine will find if the item mark balloon block already exists in the drawing
    'we will filter the selection by all INSERTed blocks named CONBALL
    Grps(0) = 0: Dats(0) = "INSERT"
    Grps(1) = 2: Dats(1) = "CONBALL"
    On Error Resume Next
    'add the selection set to the drawing
    Set SS = ThisDrawing.SelectionSets.Add("SS")
    'if the selection set already exists an error will be thrown
    'in that case just set the selection set equal to the existing one
    If Err.Number <> 0 Then
    Set SS = ThisDrawing.SelectionSets.Item("SS")
    End If
    'before we add anything to the selection set, clear any existing objects from it
    SS.Clear
    'set the filter variables from the dxfcodes
    Filter1 = Grps
    Filter2 = Dats
    'put all the instances of the Item into the selection set
    SS.Select acSelectionSetAll, , , Filter1, Filter2
    If SS.Count = 0 Then
    'need to purge CONBALL incase it was created and deleted
    'ThisDrawing.PurgeAll.CONBALL
    'if there is no conduit balloon then prompt for number.
    frmConduitnum.Show
    Create_Balloon
    Else


    is there somthing I can do wiht the selection set
    Thanks
    Tim Ashton
    GTC

  2. #2
    I could stop if I wanted to msretenovic's Avatar
    Join Date
    2002-02
    Location
    Galloway, Oh
    Posts
    304

    Lightbulb Re: how to purge deleted blocks

    Give this a try:

    Code:
     ThisDrawing.Blocks.Item(bname).delete
    Where bname is the name of the block you want to purge.
    HTH
    Michael K. Sretenović
    Most folks are about as happy as they make up their minds to be.
    -Abraham Lincoln (1809-1865)
    -16th president of The United States of America (1861 - 1865)

  3. #3
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    482

    Default Re: how to purge deleted blocks

    Quote Originally Posted by msretenovic
    Give this a try:

    Code:
     ThisDrawing.Blocks.Item(bname).delete
    Where bname is the name of the block you want to purge.
    HTH
    Note: This will error if the block is use some place in the drawing

  4. #4
    Active Member
    Join Date
    2000-12
    Location
    Las Vegas
    Posts
    68

    Default Re: how to purge deleted blocks

    Right before the command use the

    Thisdrawing.purge

    This will purge any unused blocks in the drawing.

  5. #5
    Member
    Join Date
    2001-09
    Posts
    34

    Default Re: how to purge deleted blocks

    thanks that was the ticket
    ThisDrawing.Blocks.Item("bname").delete
    Tim Ashton
    GTC

Similar Threads

  1. Replies: 2
    Last Post: 2008-11-27, 08:42 AM
  2. purge deleted records from shp file
    By Ed Jobe in forum AutoCAD Map 3D - General
    Replies: 1
    Last Post: 2008-06-24, 10:27 PM
  3. Purge Blocks Only
    By wpeacock in forum VBA/COM Interop
    Replies: 15
    Last Post: 2007-03-17, 04:08 PM
  4. How to purge phantom blocks?
    By jf1725 in forum AutoCAD General
    Replies: 10
    Last Post: 2006-07-27, 01:52 PM
  5. How to purge these naughty blocks?
    By pravin_kulkarni in forum MDT - General
    Replies: 1
    Last Post: 2005-09-26, 08:03 AM

Posting Permissions

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