Delete block

Discussion in 'AutoCAD' started by chornb1, Sep 17, 2003.

  1. chornb1

    chornb1 Guest

    I'm trying to delete a block named "prelim" in a series of drawings. I can insert a block, but can't figure out how to delete an existing block in a drawing. Any help would be appreciated! Thanks.

    Chris
     
    chornb1, Sep 17, 2003
    #1
  2. chornb1

    Mark Propst Guest

    in ThisDrawing module



     



    Sub purgeblock()
    Dim testblock As AcadBlock
    Set testblock = Me.Blocks.Item("Test")



    testblock.Delete



    Set testblock = Nothing



    End Sub



    "chornb1" <> wrote in message news:...

    I'm trying to delete a block named "prelim" in a series of drawings. I can insert a block, but can't figure out how to delete an existing block in a drawing. Any help would be appreciated! Thanks.

    Chris
     
    Mark Propst, Sep 17, 2003
    #2
  3. chornb1

    Ed Jobe Guest

    Assuming the block hasn't been inserted.




    --
    --
    Ed
    --



    "Mark Propst" <mark-at-atreng-dot-com> wrote in message news:...



    in ThisDrawing module



     



    Sub purgeblock()
    Dim testblock As AcadBlock
    Set testblock = Me.Blocks.Item("Test")



    testblock.Delete



    Set testblock = Nothing



    End Sub



    "chornb1" <> wrote in message news:...

    I'm trying to delete a block named "prelim" in a series of drawings. I can insert a block, but can't figure out how to delete an existing block in a drawing. Any help would be appreciated! Thanks.

    Chris
     
    Ed Jobe, Sep 17, 2003
    #3
  4. chornb1

    10west Guest

    for each ent in thisdrawing.modelspace
    if ent.entitytype = acBlockReference then
    if ent.name = "prelim"
    ent.erase
    end if
    end if
    next

    this will erase on layers that are on
    use selection object mode acselectall to get all entitites

    this is for block refs not defs
     
    10west, Sep 17, 2003
    #4
  5. chornb1

    Mark Propst Guest

    naturally!



    :)



    I was just lazy and assumed since he wants to delete it(which I read as purge since he said block rather than insert), he's already made sure there were no references to it or no method would delete it(purge).



     



    "Ed Jobe" <> wrote in message news:D...



    Assuming the block hasn't been inserted.




    --
    --
    Ed
    --



    "Mark Propst" <mark-at-atreng-dot-com> wrote in message news:...



    in ThisDrawing module



     



    Sub purgeblock()
    Dim testblock As AcadBlock
    Set testblock = Me.Blocks.Item("Test")



    testblock.Delete



    Set testblock = Nothing



    End Sub



    "chornb1" <> wrote in message news:...

    I'm trying to delete a block named "prelim" in a series of drawings. I can insert a block, but can't figure out how to delete an existing block in a drawing. Any help would be appreciated! Thanks.

    Chris
     
    Mark Propst, Sep 18, 2003
    #5
  6. chornb1

    chornb1 Guest

    Thanks to everyone. That did the trick. I actually did need to delete the block reference first, then purge.
     
    chornb1, Sep 18, 2003
    #6
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.