Author Topic: How to list all subentitys of a block?  (Read 3288 times)

0 Members and 1 Guest are viewing this topic.

taner

  • Guest
How to list all subentitys of a block?
« on: October 13, 2008, 10:05:39 PM »
Dear all,

How to list all subentitys of a block? thanks!

taner

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to list all subentitys of a block?
« Reply #1 on: October 13, 2008, 10:14:39 PM »
What sort of list ?
What information do you want ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

taner

  • Guest
Re: How to list all subentitys of a block?
« Reply #2 on: October 13, 2008, 10:28:24 PM »
What sort of list ?
What information do you want ?

ename of subentity without sequence

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How to list all subentitys of a block?
« Reply #3 on: October 13, 2008, 10:37:11 PM »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to list all subentitys of a block?
« Reply #4 on: October 14, 2008, 05:25:54 AM »


taner, just for interest, what do you propose doing with the entity list when you have it. I'd like to make you aware that the entitys do not reside in the block reference, but in the block definition in the block table. I haven't had a good look at the code Alan referenced, but I'm sure you'll see from that what I mean.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

taner

  • Guest
Re: How to list all subentitys of a block?
« Reply #5 on: October 14, 2008, 06:03:29 AM »
when i get the ename list of the subentitys,I can change some kinds of type(such as line,circle)entity's color ,layer etc.

thanks.

taner

  • Guest
Re: How to list all subentitys of a block?
« Reply #6 on: October 21, 2008, 08:14:06 PM »
I solved it finally.

Quote
(defun th-subelst-blk (blkname / blk lst)
  (setq blk (vla-item (vla-get-blocks (vla-get-activedocument
                           (vlax-get-acad-object)
                  )
            ) blkname
       )
  )
  (vlax-for each blk (if (/= (vla-get-objectname each) "AcDbBlockReference")
             (setq lst (cons each lst))
             (setq lst (append
               (th-subelst-blk (vla-get-name each))
               lst
             )
             )
           )
  )
  lst
)

ronjonp

  • Needs a day job
  • Posts: 7529
Re: How to list all subentitys of a block?
« Reply #7 on: October 21, 2008, 11:09:10 PM »
That works pretty well....but you still have to account for attributes. :-)


*edit From my tests this morning, it grabs attributes too....I'll just shut up now :ugly:. Good Job!
« Last Edit: October 22, 2008, 08:55:26 AM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to list all subentitys of a block?
« Reply #8 on: October 22, 2008, 11:00:47 AM »
That works pretty well....but you still have to account for attributes. :-)


*edit From my tests this morning, it grabs attributes too....I'll just shut up now :ugly:. Good Job!
Depends what attributes you are talking about.  This will grab the attribute definition, not the attribute reference, so if you want to change the existing attributes of the inserts already inserted, then this way will not work.  But if you don't, then it will.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.