Print Page | Close Window

Hi, help pls, how to extract. with Lisp, the NAME

Printed From: CAD Forum
Category: EN
Forum Name: CAD - general
Forum Description: General discussion about CAD, formats, standards, management, licensing, networking, harware, other CAD applications
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=13872
Printed Date: 03.Jul.2026 at 07:18


Topic: Hi, help pls, how to extract. with Lisp, the NAME
Posted By: dukeNukem
Subject: Hi, help pls, how to extract. with Lisp, the NAME
Date Posted: 03.Jul.2023 at 03:32

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




Replies:
Posted By: Kent Cooper
Date Posted: 03.Jul.2023 at 19:37
By what method?  If you mean to select the nested Xref, and if you can select it on something that is not a complex object [such as a Dimension or a further-nested element], then this should do it:

(cdr (assoc 2 (entget (car (last (nentsel "\nSelect basic object at top level in nested Xref: "))))))

The return from (nentsel) for a nested object ends with a list of what it's nested in, starting with the deepest-nested one and stepping up from there.  So if [for example] you pick on a part of a Block in that Xref, you'll get the file name and Block name in "TWO|test" form, not just the Xref drawing file name -- maybe that would serve your purpose.  But if you pick on a Dimension, you'll get something like "*D|REF6", which presumably would not.



Print Page | Close Window