Bibix Posted November 10, 2017 Posted November 10, 2017 hello, well i'm working on several floor, we got a block made by apartment, in each apartment, we gad lot of blocks, like exemple "bed", i'd like to select all the bed in one time to change the layer of this block, i don't want to enter the edit_block to change the layer of the lines, but to have the block "bed" set into the layer "mobilier" as an exemple, the filter selection by name do not recognize the block into a block, and neither the qselection. i hope someone can helpme, thanks it's my first post, and i don't speak english very often, so i'm sorry for my errors... Quote
Lee Mac Posted November 10, 2017 Posted November 10, 2017 Assuming I've understood the requirement, here's a quick Vanilla AutoLISP solution for you to try: (defun c:nestblocklayer ( / blk def ent enx lay ) (setq blk "bed" ;; Nested block name lay "mobilier" ;; New layer for nested blocks blk (strcase blk) ) (while (setq def (tblnext "block" (not def))) (setq ent (tblobjname "block" (cdr (assoc 2 def)))) (while (setq ent (entnext ent)) (if (and (setq enx (entget ent)) (= "INSERT" (cdr (assoc 0 enx))) (= blk (strcase (cdr (assoc 2 enx)))) ) (entmod (subst (cons 8 lay) (assoc 8 enx) enx)) ) ) ) (command "_.regenall") (princ) ) Quote
Bibix Posted November 10, 2017 Author Posted November 10, 2017 thanks lee for your answer, but it doesen't seems to work, to be sure i let the lisp file, and the situation i'm needing, if it was only one block and one layer, i wouldn't use a lisp, but there are several blocks and several files that i need to orgonize well, and there's a lot of appartement :geek: what i got.dwg what i need.dwg lisp lee mac mobilier.lsp Quote
Bibix Posted November 14, 2017 Author Posted November 14, 2017 sorry i tried it friday night i was over, it works perfectly, thk you very much lee, you're the best! i'm looking in your web the effective name lisp, so i can select all my dynamic blocs too! i hope, i can select blocs into blocks as well with it! thanks you very much! Assuming I've understood the requirement, here's a quick Vanilla AutoLISP solution for you to try:(defun c:nestblocklayer ( / blk def ent enx lay ) (setq blk "bed" ;; Nested block name lay "mobilier" ;; New layer for nested blocks blk (strcase blk) ) (while (setq def (tblnext "block" (not def))) (setq ent (tblobjname "block" (cdr (assoc 2 def)))) (while (setq ent (entnext ent)) (if (and (setq enx (entget ent)) (= "INSERT" (cdr (assoc 0 enx))) (= blk (strcase (cdr (assoc 2 enx)))) ) (entmod (subst (cons 8 lay) (assoc 8 enx) enx)) ) ) ) (command "_.regenall") (princ) ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.