Explode Blocks

Discussion in 'AutoCAD' started by Pat Bjork, May 5, 2004.

  1. Pat Bjork

    Pat Bjork Guest

    I am writing a new routine that will bind all of the xrefs in the current
    drawing and then explode them. I am able to iterate through the blocks
    collection and bind all of the xrefs, but I can not figure out how to
    explode the blocks after I bind them. Any help would be much appreciated.

    Thanks,

    Pat
     
    Pat Bjork, May 5, 2004
    #1
  2. Pat Bjork

    Paul Turvill Guest

    Out of curiosity ... WHY?
    ___
     
    Paul Turvill, May 5, 2004
    #2
  3. Pat Bjork

    Jeff Mishler Guest

    I would do it like this.

    Dim blk As AcadBlock
    Dim oInsert As AcadBlockReference
    Dim iCode(1) As Integer
    Dim vVal(1) As Variant
    Dim ss As AcadSelectionSet

    iCode(0) = 0: iCode(1) = 2
    vVal(0) = "INSERT"

    On Error Resume Next
    Set ss = ThisDrawing.SelectionSets.Item("explode_xrefs")
    If Err.Number <> 0 Then
    Err.Clear
    Set ss = ThisDrawing.SelectionSets.Add("explode_xrefs")
    End If
    On Error GoTo 0

    For Each blk In ThisDrawing.Blocks
    If blk.IsXRef = True Then
    vVal(1) = blk.Name
    blk.Bind (True)
    ss.Clear
    ss.Select acSelectionSetAll, , , iCode, vVal
    For Each oInsert In ss
    oInsert.Explode
    oInsert.Delete
    Next oInsert
    End If
    Next blk

    HTH,
    Jeff
     
    Jeff Mishler, May 5, 2004
    #3
  4. Pat Bjork

    Pat Bjork Guest

    The blocks are standard blocks and standard notes. I have these blocks
    xrefed into a template drawing. I am xrefing because I would like the most
    up to date block when the drawing is started. I need to bind these and
    explode these so that they can be updated per the project.

    Thanks,

    Pat
     
    Pat Bjork, May 5, 2004
    #4
  5. Pat Bjork

    Jason Wilder Guest

    Hmm, this could be a very handy little routine. Just need to apply a filter
    to it, I only want to bind certain xref's. But this has potential for
    something I'd like to do in the office.

    Thanks Jeff.
     
    Jason Wilder, May 5, 2004
    #5
  6. Pat Bjork

    Jeff Mishler Guest

    You're welcome. I'm glas someone can put it to use.

    Jeff
     
    Jeff Mishler, May 5, 2004
    #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.