Saving an Xref from the mother drawing

Discussion in 'AutoCAD' started by Dave F, Sep 10, 2003.

  1. Dave F

    Dave F Guest

    Hi
    A2k2

    I've written the routine below to reload all loaded xrefs in a dwg.
    Is there a way to check whether the drawings that are the Xrefs are saved &
    save them if not?

    Thanks in advance

    Dave F.

    Sub fxXrefReload()
    Dim BlkObj As AcadBlock
    Dim objBlock As AcadDatabase
    For Each BlkObj In ThisDrawing.Blocks ' cycles through all the blocks
    in the dwg
    If BlkObj.IsXRef Then ' if it's an Xref?
    Debug.Print BlkObj.Name
    On Error Resume Next
    Set objBlock = ThisDrawing.Blocks(BlkObj.Name).XRefDatabase '
    tests to see if it's loaded
    If Err.Number = 0 Then
    ' if it is...
    BlkObj.Reload
    ' ...reload it
    End If
    End If
    Next ' block
    End Sub
     
    Dave F, Sep 10, 2003
    #1
  2. If you have a drawing open then go through the documents collection, check the 'saved' property, and if it is not saved then save it. But if someone else has it open, you can't do anything anyway, other than ask them very politely to save it for you (But on the bright side, hey, no tricky API coding required!)... also, more seriously, I know acad 2004 has the warning thing about xref's but i don't know if that raises an event or something that can be queried through VBA. Maybe someone else can help you with that.
     
    terencechatfielduk, Sep 10, 2003
    #2
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.