duke Posted July 3, 2023 Posted July 3, 2023 Hi, help pls, how to extract. with Lisp, the NAME of the file of an XREF, but that is inside another XREF For example, the main XREF, the one displayed on the screen, is called ONE, but within the ONE file, there was already an XREF, within ONE, called TWO. I need to extract that Xref name (TWO) to a variable. Please. And thanks a lot for the help guys !!!! Quote
Emmanuel Delay Posted July 5, 2023 Posted July 5, 2023 (edited) This seems to work: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/list-of-xrefs/td-p/1898983 So, it depends what you want. I made "a.dwg", "b.dwg", "c.dwg", "d.dwg" "b.dwg" has 2 xrefs attached: "c.dwg" as attached xref, and "d.dwg" as overlay XREF. Now on "a.dwg" I attach "b.dwg" "c.dwg" will appear in the XREFS in "a.dwg", "d.dwg" will not. THat's exactly what ATTACH/OVERLAY is intended for. So, what my scrip here below does, is list the XREFS as they are listed in the XREFS pane. Are you happy with this? Anything more you want with this? ;======================================================================= ;;Make and sort table of xref's ;; (defun TXREF (/ tst1 LXREF LXREFPATH) (setq MTBLE (tblnext "block" t) LXREF nil) (while (/= MTBLE nil) (setq tst1 (assoc 1 MTBLE)); path of xref (if (/= tst1 nil) (progn (setq LXREF (append LXREF (list (cdr (assoc 2 MTBLE))))) ;xref name (setq LXREFPATH (append LXREFPATH (list (cdr (assoc 1 MTBLE))))) ;xref name );end progn );end if (setq MTBLE (tblnext "block")) );end while (list LXREF LXREFPATH) ;; returns a list of the XREF name; then a list of the XREF paths );end defun (defun c:test ( / xrefs) (setq xrefs (TXREF)) (princ xrefs) (princ) ) Edited July 5, 2023 by Emmanuel Delay 1 Quote
duke Posted April 26 Author Posted April 26 (edited) Friend, almost a year later, I noticed that you had responded to me, how sorry I feel for you, I simply abandoned the idea that the XREF thing could be done. I apologize because I had not seen it. These days I will be reviewing the code. And I reiterate my APOLOGIES, please!! I forgot to mark FOLLOW TOPIC!! I am very stupid!! Edited April 26 by duke Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.