I don't follow.
If you repeatedly call (setq ename (entnext ename)) you can encounter any number of 'complex' entities followed by its subentities, and terminated by a SEQEND entity.
Your code doesn't check for a 66 (subentities follow) entry in the entity's data, and AFAIK, that's the only way to generically identify a 'complex' entity without specifically testing its type to see if its a heavy polyline or a block with attributes.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com
"Jason Piercey" wrote in message news:5800852@discussion.autodesk.com...
I am noticing something very, very strange here. Attributes
are "appearing" as subentities where they shouldn't be.
In the attached sample drawing ("test.dwg") use the following
code and select the viewport, a dimension, or a leader and
look at the resulting list. Seems that some leaders will return
a list and some won't.
This sample drawing was part of a sheet set and this view
was placed via the SSM.
These are the results I get:
Command: (nents (car (entsel)) "attrib")
"VIEWPORT"
(
7ec20ac0> )
Command: (nents (car (entsel)) "attrib")
"DIMENSION" (
7eccecb8> )
Command: (nents (car (entsel)) "attrib")
"LEADER" (
7eccee70> )
Umm... how can a viewpor
t, dimension, or a leader have attributes?
It is like these entities are linked to the "label block for views"
specified in the sheet set. Surely this is not acceptable behavior.
I get these results in 2007 and 2008. Anyone else confirm?
; Jason Piercey . June 2nd, 2003
; get list of sub entity names
; [ename] - entity name or vla-object - block, insert or polyline
; [filter] - string, re: wcmatch()
; return: list of enames or nil
; revised: July 10th, 2003 - accepts ename or vla-object
(defun nEnts (ename filter / data ent rtn)
(or (= 'ename (type ename))
(setq ename (vlax-vla-object->ename ename)) )
(setq filter (strcase filter))
(print (cdr (assoc 0 (entget ename)))); <-- added this today for giggles.
(while (and ename (setq ename (entnext ename)))
(setq data (entget ename))
(setq ent (cdr (assoc 0 data)))
(if (wcmatch ent filter)
(setq rtn (cons ename rtn)) )
(if (= "SEQEND" ent) (setq ename nil))
)
(reverse rtn)
)
--
Autodesk Discus
sion Group Facilitator