Stepping thur blocks

jwhitney

Usenet Archive
Joined
Dec 18, 2003
Messages
6
Reaction score
0
The intent is to step through all the subentities in all the blocks in a dwg to set the object color to bylayer - in 2004 I can't get entget or entnext to go past the main object header. Getting very frustrated - can anyone offer suggestions?

(setq bdef (entget (car (entsel)))) ;gets entity data on block) (setq en (entget (entnext (cdr (assoc -1 bdef))))) ;supposed ; to give the next entity in the block, instead gives the next ; object

searched thru everything I can find on it - that code should work and does not. HELP!

Jeff
 
How about a different approach:

(setq *blocks* (vla-get-blocks
(vla-get-activedocument
(vlax-get-acad-object))))

(vlax-for blck *blocks*
(vlax-for ent blck
(vl-catch-all-apply
'vla-put-color
(list ent acbylayer))
)
)

jwhitney said:
The intent is to step through all the subentities in all the
blocks in a dwg to set the object color to bylayer - in 2004 I can't get entget or entnext to go past the main object header. Getting very frustrated - can anyone offer suggestions?
 
You must get the block definition, not the insert.

(setq bname (cdr (assoc 2 (entget (car (entsel))))))
(setq b_ent (entget (tblobjname "block" bname)))
(setq en (entget (entnext (cdr (assoc -1 b_ent)))))

HTH,
Jeff

jwhitney said:
The intent is to step through all the subentities in all the blocks in
a dwg to set the object color to bylayer - in 2004 I can't get entget or entnext to go past the main object header. Getting very frustrated - can anyone offer suggestions?
 
My obvious error (in hindsight) was trying to entnext from the insert, not the block definition (subtle difference!) Will go thru the tables to get the block and go from there. I had done it once - quite a while ago - and now remember I got there through the tables.

The more I know, the more I know I don't know, in Rumsfeld-speak.

Thanks to all who replied,
Jeff
 

Latest threads

Back
Top