Xref Edit Lisp

Discussion in 'AutoCAD' started by bruceclement, Aug 4, 2003.

  1. bruceclement

    bruceclement Guest

    I've been using the following lisp routine to open a picked xref for editing. It prompts the user to pick the xref on the screen, then it opens the xref (as if the user had used the open command).

    (defun c:xe (/ ent_list x-nam x-ref x-path x)
      (setvar "cmdecho" 0)
     (defun *error* (msg)
       (command "xref" "r" x-nam)
       (princ msg)
       (princ)
     )
      (setq ent_list (entget (car (entsel "\nXREF Edit\nOpens selected XREF for editing.\nSelect Xref to edit:"))))
      (setq x-nam (cdr (assoc 2 ent_list)))
      (setq x-ref (tblsearch "block" x-nam))
      (setq x-path (cdr (assoc 1 x-ref)))
      (command "xref" "u" x-nam)
      (command "vbastmt" (strcat "AcadApplication.Documents.Open " (chr 34) x-path (chr 34)))
      (setq x (getkword "\nPress <ENTER> to reload XREF:"))
      (command "xref" "r" x-nam)
      (princ)
    )

    The problem is that it doesn't work if there is no path or a relative path (..\xref\etc). Does anyone have a routine that will return the path that the xref is "found in," or otherwise provide a mechanism to open an xref that doesn't have a full hard path?

    Thanks!

    Bruce
     
    bruceclement, Aug 4, 2003
    #1
  2. bruceclement

    bruceclement Guest

    Opening the drawing in its own window is far supirior, as demonstrated by the degree to which everyone using the lisp routine I described prefers it over refedit.
     
    bruceclement, Aug 4, 2003
    #2
  3. bruceclement

    bruceclement Guest

    Luis, thanks, but I can't seem to open your attachment (I'm accessing this discussion group via my web browser, and clicking on the attachment brings me to a "no attachement" page). Could you please put the lisp in the message, or email it to me at . Thanks.
     
    bruceclement, Aug 4, 2003
    #3
  4. bruceclement

    bruceclement Guest

    Thanks, guys. The findfile function seems to work.
     
    bruceclement, Aug 5, 2003
    #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.