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

All in one layer

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
tdkhtr
587 Views, 6 Replies

All in one layer

 

Dear members..

 

Can anybody help me to make a lisp

which is help me to make some objects in one layer

 

Requiements are 

 

* All dimensions to be change in to onle layer (layer name ---  Dim, layer colour number 1)

*All leaders  to be change in to onle layer (layer name ---  Leader,layer colour number 1 )

*All text to be change in to onle layer (layer name ---  Text ,layer colour number 3)

 

Thanks In advance for ur any reply....

6 REPLIES 6
Message 2 of 7
hmsilva
in reply to: tdkhtr

 Perhaps something like this

 

(vl-load-com)
(defun c:demo (/ adoc lay layers laylst locklst x)
  (setq adoc (vla-get-activedocument (vlax-get-acad-object)))
  (setq layers (vla-Get-Layers adoc))
  (vlax-for lay layers
    (if (= (vla-get-lock lay) :vlax-true)
      (progn
        (setq locklst (cons (vla-get-name lay) locklst))
        (vla-put-lock lay :vlax-false)
      )
    )
  )
  (setq laylst '(("Dim" 1) ("Leader" 1) ("Text" 3)))
  (mapcar '(lambda (x)
             (setq lay (vla-add layers (car x)))
             (vla-put-color lay (cadr x))
           )
          laylst
  )
  (vlax-for layt (vla-get-layouts adoc)
    (vlax-for blk (vla-get-block layt)
      (cond ((wcmatch (vla-get-objectname blk) "*Dimension*")
             (vla-put-layer blk "Dim")
            )
            ((wcmatch (vla-get-objectname blk) "*Leader")
             (vla-put-layer blk "Leader")
            )
            ((wcmatch (vla-get-objectname blk) "*Text")
             (vla-put-layer blk "Text")
            )
      )
    )
  )
  (if locklst
    (vlax-for lay layers
      (if (vl-position (vla-get-name lay) locklst)
        (vla-put-lock lay :vlax-true)
      )
    )
  )
  (princ)
)

 

Hope that helps

Henrique

 

 

EESignature

Message 3 of 7
tdkhtr
in reply to: hmsilva

Hi,,Hmsilva

 

Thanks for your code..

It is working perfectly..Smiley Very Happy

 

Thanks

Tdkhtr

 

 

 

Message 4 of 7
hmsilva
in reply to: tdkhtr

You're welcome, Tdkhtr
Glad you got a solution!

Henrique

EESignature

Message 5 of 7
damian.wrobel
in reply to: tdkhtr

I recommend the Layer Director" lisp by Lee Mac

http://www.lee-mac.com/layerdirector.html

 

It is georgious.

Message 6 of 7
Lee_Mac
in reply to: damian.wrobel

damian.wrobel wrote:

I recommend the Layer Director" lisp by Lee Mac

http://www.lee-mac.com/layerdirector.html

 

It is georgious.

 

Thank you damian! Smiley Happy

Message 7 of 7
tdkhtr
in reply to: Lee_Mac

Damian....

Thanks for your reply...I tried Lee-mac's lisp ...GREAT!!
(Tkanks Lee-mac)

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

Post to forums  

Autodesk Design & Make Report

”Boost