explode to layer but...

JB

Usenet Archive
Joined
Jul 16, 2000
Messages
68
Reaction score
0
I need to explode a block to the layer it is inserted on with the following requirements;

Before I explode the block;
The block is made up of a circle and a hatch.
The circle is on layer 0 and is Color ByBlock
The hatch is on Layer 0 and is Color 9
The Block is inserted onto layer DETAIL
Layer DETAIL is Color Green
The Block is assigned a color (Red)

After I explode the block;
The Circle needs to be the assigned color (red) on Layer DETAIL The hatch needs to be Color 9 on Layer DETAIL

The colors and layer names may vary from block to block.

I do not want to have to select layers or colors just pick the command, select the block or blocks and press enter.

I just don't know where to begin. A search has turned up similar routines but not exactly what I need.

Thank You! Happy Hollidays!

John B
 
John,

Maybe this helps with where to begin. It's a combination of code and program outline.

(setq ename (car (entsel "\nSelect block: ")))
(setq elst (entget ename)) ;insert data list
(setq blklay (cdr (assoc 8 elst))) ;block layer name
(setq blkclr (cdr (assoc 62 elst))) ;block color if not "bylayer" (command "explode" ename) (setq ss (ssget "P")) ;selection set of the exploded objects (setq idx 0) ;initialize index counter (repeat (sslength ss) (setq ename (ssname ss idx)) (setq elst (entget ename)) ;; a series of "if" tests here - example:
;; (if (= 0 (cdr (assoc 62 elst))) ;object color is "byblock" ;; modify the object color to be what was assigned to the block ;; can be done with command, or entmod, or vlax-put... (setq idx (1+ idx)) ;increment index ) ;repeat

I'll be away for the next week.
Joe Burke
 

Latest threads

Back
Top