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
;;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 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
;;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) )