(vla-reload ???)

Discussion in 'AutoCAD' started by spencer1971, Nov 9, 2004.

  1. spencer1971

    spencer1971 Guest

    I have been tring to sort this for a while but cannot get it working,
    I have a routine from this forum that replaces xopen and stores the name of the xref (see below). I was originally working in lisp but found this while compiling my lsp routine and it works perfectly.

    (defun C:x-o (/)
    (vl-load-com)
    (setq ENAM (car (entsel "\nSelect block to open: "))
    ELST (entget ENAM)
    EOBJ (vlax-ename->vla-object ENAM)
    )
    (if (vl-catch-all-error-p
    (vl-catch-all-apply 'vla-get-path (list EOBJ))
    )
    (if (not
    (setq BLKNAME (findfile (strcat (cdr (assoc 2 ELST)) ".dwg")))
    )
    (setq BLKNAME (wblk ENAM))
    )
    (setq BLKNAME (vla-get-path EOBJ))
    )
    (PRINC BLKNAME)
    (getstring "\nPress Enter to continue: ")
    (command "vbastmt"
    (strcat "AcadApplication.Documents.Open \"" BLKNAME "\"")
    )
    (princ)
    )

    I then want to hit a button to reload the last selected xref.

    I have had help of this forum and have been toying with (vla-reload ???) but cannot get it working

    Should it be something like this *(I'm OK with lisp but a complete novice with VBA)
    (defun X-load ()
    (vla-reload EOBJ)
    )

    I presume thats wrong cos it don't work.
    Any help would be greatly appreicated, Also any sites as a starting point for VBA

    Spencer
     
    spencer1971, Nov 9, 2004
    #1
  2. spencer1971

    LUCAS Guest

    ;;reload working for blockdef(xref) object
    (defun X-LOAD ()
    (vla-reload
    (vla-item (vla-get-blocks
    (vla-get-activedocument (vlax-get-acad-object))
    )
    (vla-get-name EOBJ)
    )
    )
    )


    of the xref (see below). I was originally working in lisp but found this
    while compiling my lsp routine and it works perfectly.
     
    LUCAS, Nov 10, 2004
    #2
  3. spencer1971

    spencer1971 Guest

    Lucas

    Im getting the same error as when I was trying to get it to work..
    VLA-OBJECT nil

    Could it be that EOBJ is clearing once the x-open.lsp has finished running even though it is undeclared?

    Spence
     
    spencer1971, Nov 10, 2004
    #3
  4. spencer1971

    LUCAS Guest

    ;;IF YOU JUST WANT TO RELOAD(NOT FOR NESTED XREF)
    (defun C:X-OO ()
    (vl-load-com)
    (if (and (setq ENAM (entsel "\nSelect xref to reload: "))
    (vlax-property-available-p
    (setq EOBJ (vlax-ename->vla-object (car ENAM)))
    'PATH
    )
    )
    (vla-reload
    (vla-item (vla-get-blocks
    (vla-get-activedocument (vlax-get-acad-object))
    )
    (vla-get-name EOBJ)
    )
    )
    )
    (princ)
    )
     
    LUCAS, Nov 11, 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.