xlist function

xlist function

Anonymous
Not applicable
2,946 Views
8 Replies
Message 1 of 9

xlist function

Anonymous
Not applicable

I put my xref function onto a layer named XREF in my current file. My goal is to check which layer a specific linework is on when I working with the current file. So I use the XLIST function to check. However, I could only read the lines are on XREF layer, where I put my xref file on. I am not able to know exactly which layer the line is on in the xref file. Therefore, I am not able to edit the specific layer unless reopen the xref file. Any ideas?

0 Likes
2,947 Views
8 Replies
Replies (8)
Message 2 of 9

rkmcswain
Mentor
Mentor
Is this because the dialog is not wide enough?

If so, see this:

http://lynn.blogs.com/lynn_allens_blog/2009/07/an-autocad-hip-tip-for-xlist-with-long-layer-names.ht...

R.K. McSwain     | CADpanacea | on twitter
Message 3 of 9

deke01
Advocate
Advocate

It may be because the entity resides on a layer of an attached xref within the drawing you xref'd.
For that you will need to use the "probe.lsp" and associated "probe.dcl" files that can be found with a little search on this site. https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-file-in-autocad-mac/m-p/7299599/...

0 Likes
Message 4 of 9

Anonymous
Not applicable

No *.dcl required.

 

just paying back what little I can.

B. Watts

 

0 Likes
Message 5 of 9

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... I use the XLIST function to check. However, ... I am not able to know exactly which layer the line is on in the xref file. Therefore, I am not able to edit the specific layer unless reopen the xref file. Any ideas?



Slightly stale thread, but since it's been revived....

 

If all you need is the Layer  of a nested object, will this do?

(cdr (assoc 8 (entget (car (nentsel)))))

Kent Cooper, AIA
Message 6 of 9

Anonymous
Not applicable
That post was the result of the intersection of:
- having just used xlist ten minutes before
- needing to look something up(unrelated to xlist) on https://forums.autodesk.com/ and spotting the xlist thread along the way
- lunch & web surfing time.
The forum has been a lot of help over the years, so I decided to contribute back, while gnashing my tomato provolone panini.
I didn't notice the timestamp.
Best regards
b

.
0 Likes
Message 7 of 9

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... to know exactly which layer the line is on in the xref file ... to edit the specific layer ...



So suppose a Line or something is drawn on Layer 0 and is part of a Block definition?  If you want to edit the Layer on which it appears, i.e. the Layer whose properties determine how it looks in the drawing, to change that if you change the Layer's color or linetype or something, then you don't  want to be told Layer 0 if you pick on it, but rather the Layer that the Block is inserted on.  [My previous suggestion will give you Layer 0, being the lowest-nested-level Layer of the object.]  And what if that Block is also inserted on Layer 0 and is nested into another Block definition?  And maybe another?  And what if that one's nested in an Xref?  And that's nested in another Xref?

 

Here's a command that finds the "apparent" layer, i.e. the lowest-nested-level Layer that is not Layer 0, of any selected object or nested object, to any nesting level.  [It also works on top-level objects, not just nested ones.]

(defun C:LNO
; = Layer of Nested Object [not Layer 0 if nested in object on another Layer]
  (/ ent edata lay)
  (setq
    edata (entget (car (setq ent (nentsel))))
    lay ; = Layer it's on
      (if (= (cdr (assoc 8 edata)) "0"); deepest-nested on Layer 0
        (cond ; then
          ((> (length ent) 2); nested entity [other than Attribute] in Block/Xref
            (setq nestlist (last (nentselp (cadr ent)))); stack of references nested in
            (while
              (and
                nestlist ; still nesting level(s) remaining
                (= (setq nlay (cdr (assoc 8 (entget (car nestlist))))) "0"); = Nested Layer still 0
              ); and
              (setq nestlist (cdr nestlist)); move up a level if present
            ); while
            nlay
              ; return lowest-level non-0 Layer of nested or containing reference(s);
              ; 0 if that all the way up
          ); non-Attribute nested entity on Layer 0 condition
          ((= (cdr (assoc 0 edata)) "ATTRIB"); Attribute in Block
            (cdr (assoc 8 (entget (cdr (assoc 330 edata))))); Block's Layer
          ); Attribute on Layer 0 condition
          ("0"); none-of-the-above condition
        ); cond - then
        (cdr (assoc 8 edata)); else - Layer of entity/nested entity
      ); if & lay
  ); setq
); defun
Kent Cooper, AIA
Message 8 of 9

Anonymous
Not applicable

Lee Mac level elegant.  Hope you don't mind, but I gonna play with it.

 

One of my wishlist items that acad is inching closer to;

...an effortless deep inquiry into nested, daisy-chained objects...

- Either in a "rollover & show" info of the embedded object the way they have now, but with a toggle or scroll bar to drill down, beyond level 0, thru its linked reference pointers.

- or maybe make the "Name" cell in the PropertiesDB a hot button that would sprout pop-up trees.

 

...maybe throw in a toggle to see it DXF format.

 

I see the building blocs for it all over acadspace but its not quite coalesced yet.

 

"You hear that AUTODESK?"

0 Likes
Message 9 of 9

granat1
Contributor
Contributor

תודה רבה

MERCI BEAUCOUP

0 Likes