home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Current Shareware 1994 January
/
SHAR194.ISO
/
cad_util
/
v8n8_cad.zip
/
BLEDIT.LSP
next >
Wrap
Lisp/Scheme
|
1993-07-23
|
1KB
|
40 lines
(defun c:bledit ( / blk ent ent_lst ent_def old new)
(setq blk (nentsel "\nSelect block: "))
(while (/= nil blk)
;
;(cadddr blk) is only present when nentsel selects an ;entity
;that is nested within a block.
;
(if (= nil (cadddr blk)) (alert "Not a block.")
(progn
(setq ent_lst (list (last (last blk))))
(setq ent (cdr (last (tblsearch "block" (cdr (assoc 2 (entget (car ent_lst))))))))
;
;Steps through nested entity data extracting all blocks
;and adding their entity name to the ent_lst variable
;
(while (/= nil ent)
(if (= "INSERT" (cdr (assoc 0\(entget ent))))
(setq ent_lst (append ent_lst (list (cdar (entget ent)))))
)
(setq ent (entnext ent))
)
;
;Steps backwards through list of entity names and ;prompts for new layer.
;Last entity prompted is main block. This causes the ;redraw to
;display the changes on the screen.
;
(foreach ent (reverse ent_lst)
(setq ent_def (entget ent) old (assoc 8 ent_def)
new (cons 8 (getstring (strcat "\nNew layer for block " (cdr (assoc 2 ent_def)) " <"(cdr old) ">: "))))
(if (= "" (cdr new)) (setq new old))
(setq ent_def (subst new old ent_def))
(entmod ent_def) (redraw ent)
)
)
)
(setq blk (nentsel "\nSelect block: "))
);end while
(prin1))