How can i reload xref's from all the documents that i have opened?

Discussion in 'AutoCAD' started by MRL, Jun 28, 2004.

  1. MRL

    MRL Guest

    Hello,

    Here is my code, but it's not working properly.
    It's only reloading the xrefs in my active document.

    How can i reload all my xref's from all the documents that i have opened?

    Martin

    (vlax-for @each (vla-get-Documents (vlax-get-acad-object))
    (vlax-for @block (vla-get-Blocks @each)
    (if (= :vlax-true (vla-get-IsXRef @block))
    (vla-Reload @block)
    )
    )
    )
     
    MRL, Jun 28, 2004
    #1
  2. MRL

    Joe Burke Guest

    Martin,

    I'm not sure about this, but I suspect the reload method only applies to the active
    document. Others here know more about this than I do.

    And may I suggest, you shouldn't do (vla-get-Documents... within a vlax-for
    statement. The Documents collection is static when the program runs.

    So rather:
    (setq docs (vla-get-Documents (vlax-get-acad-object)))
    .... do stuff with docs ...

    Joe Burke
     
    Joe Burke, Jun 29, 2004
    #2
  3. MRL

    MRL Guest

    Hi Joe,

    Has it something to do with vl-propagate ?

    Martin


    Joe Burke schreef:
     
    MRL, Jun 29, 2004
    #3
  4. MRL

    Joe Burke Guest

    Martin,

    Sorry, I don't know what the problem is. I tried the code you posted. The logic seems
    sound, regardless of my comment. As you said, it errors when it tries to process open
    files which are not the active file. And it appears to do what it should with the
    active file.

    I don't think vl-propagate is an issue since your code doesn't create symbols other
    than temporary vlax-for items. vl-load-all might be an issue if each doc in the
    documents collection must be made active for vla-Reload to work as expected. But
    somehow that doesn't seem right to me.

    We need some guru help here. I would like to know what the answer or problem is, as
    much as you would.

    Regards
    Joe Burke
     
    Joe Burke, Jun 30, 2004
    #4
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.