nentsel assistance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I've been using this lisp for a while. It's modified list command for our office. The problem was that it would go all the way to the root object when selecting xref/block objects. Example: If you selected an xref'd dimension, it would show "line" instead of seeing the dimension.
Here is the selection used:
(while (setq entlst (nentsel "\nSelect object to list: "))
(setq ent (entget (car entlst)))
So I modified the code with the following:
;The next while loop checks for null or invalid selection.
(while (or
(not (setq entlst (nentsel "\nSelect object to list: ")))
(< (length entlst) 3)
);end or
(progn
(princ "\nObject was invalid or was not selected.");;;maybe non nested selection here instead of message?
);pr
);end while
(setq iNest (length (last entlst)))
;The next if statement handles block within blocks. iNest = 1 means no nesting. Since (nentsel) goes all the
;way to the root AutoCAD object we have to traverse back up to the top level of the nesting to get a block name.
(if (= iNest 1)
(progn
(setq ent (entget (car entlst))) ;then pull the list from the standard nentsel call.
);pr
(progn
(setq ent (entget (nth (- iNest 2) (last entlst)))) ;else last last our way back up to the top block definition
);pr
);end if
This works great on xref and block or nested items but now I cannot select standard objects in drawing that are not nested within a block or xref.
Hoping this is something simple I'm missing here. For now the error message loop stops from crashing, but it needs to work on all objects nested and not nested.
Thanks in advance for any assistance received.
-dc