Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

lisp to move blocks to their own layers based on block name

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
zasanil
1785 Views, 5 Replies

lisp to move blocks to their own layers based on block name

Hello,

I was looking for a lisp that would take a selection set of blocks and move each block to their own individual layers while naming the new layer it creates by the block name. I tried searching for a lisp already but couldn't find one that did this.

Thanks

Dan Nicholson C.I.D.
PCB Design Engineer
Tags (3)
5 REPLIES 5
Message 2 of 6
hmsilva
in reply to: zasanil


@zasanil wrote:

I was looking for a lisp that would take a selection set of blocks and move each block to their own individual layers while naming the new layer it creates by the block name.


Something like this perhaps.

Quick and dirty...

(defun c:demo (/ blk ent hnd i name ss)
  (if (setq ss (ssget ":L" '((0 . "INSERT"))))
    (repeat (setq i (sslength ss))
      (setq hnd  (ssname ss (setq i (1- i)))
            ent  (entget hnd)
            blk  (vlax-ename->vla-object hnd)
            name (vlax-get-property
                   blk
                   (if (vlax-property-available-p blk 'EffectiveName)
                     'EffectiveName
                     'Name
                   )
                 )
      )
      (entmod (subst (cons 8 name) (assoc 8 ent) ent))
    )
  )
  (princ)
)

Hope that helps

Henrique

EESignature

Message 3 of 6
zasanil
in reply to: hmsilva

Thats great. It worked really well.

Thanks!

Dan Nicholson C.I.D.
PCB Design Engineer
Message 4 of 6
marko_ribar
in reply to: zasanil

You didn't searched well...

 

http://www.theswamp.org/index.php?topic=47952.0

 

M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
Message 5 of 6
hmsilva
in reply to: zasanil

You're welcome, Dan
Glad I could help

Henrique

EESignature

Message 6 of 6
Anonymous
in reply to: hmsilva

Hi,

       Can i get that lisp to try or please send me any link to download.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost