XREF Reloading Programmatically

Discussion in 'AutoCAD' started by Steven Craig Basham, Jan 14, 2004.

  1. Can anyone point me in the right direction to be able to reload xref'd
    blocks via VBA? I need to reload them before I create a new plot in case
    the x-ref was changed after being referenced in.

    Thank you so much!
     
    Steven Craig Basham, Jan 14, 2004
    #1
  2. Is this the best way?

    Dim curBLOCK As AcadBlock
    Dim myBlocks As AcadBlocks
    Set myBlocks = ThisDrawing.Blocks
    For Each curBLOCK In myBlocks
    If curBLOCK.IsXRef Then
    curBLOCK.Reload
    End If
    Next curBLOCK
     
    Steven Craig Basham, Jan 14, 2004
    #2
  3. This code works fine with this exception.... I receive an Automation error
    if the referenced file HAS been changed AND is still open. I modified the
    code to on error resume next and clear the error since do harm seems to come
    from it. But I'm sure that's not the right thing to do... any suggestions?
     
    Steven Craig Basham, Jan 14, 2004
    #3
  4. Steven Craig Basham

    Anne Brown Guest

    Everyone -

    Here is a tip on using the discussion groups to your best
    advantage. Please do not change the subject line of discussion
    group messages to which you are replying. It breaks the ability
    of the search engine to group the messages, makes it harder to
    follow the thread and is quite confusing. If it is a new subject,
    please start a new message; if a reply, put your text answer in
    the body of your message and leave the header the same.

    Thanks for your future cooperation.
     
    Anne Brown, Jan 14, 2004
    #4
  5. Anne, thank you for that information... I did not know that. :)

    Everyone else, I ran into another problem... some of my designer have
    xref's attached, but unloaded.... is there a propery you know of that
    allows me to check whether an xref is load or unloaded, so I can reload
    accordingly?

    Thank you so much for your time!
     
    Steven Craig Basham, Jan 14, 2004
    #5
  6. Steven Craig Basham

    Jeff Mishler Guest

    Check for the curBLOCK.count > 0

    If an Xref has been inserted into a drawing and then is unloaded, the
    count will be 0.

    Jeff
     
    Jeff Mishler, Jan 14, 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.