Jump to content

Hi, help pls, how to extract. with Lisp, the NAME of the file of an XREF, but that is inside another XREF


duke

Recommended Posts

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 !!!!

Link to comment
Share on other sites

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

 

xrefs.png

Edited by Emmanuel Delay
  • Agree 1
Link to comment
Share on other sites

  • 9 months later...
Posted (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 by duke
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...