Jump to content

unlock all layers


marmo

Recommended Posts

  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

  • Se7en

    7

  • alanjt

    5

  • marmo

    5

  • gile

    4

Top Posters In This Topic

taking pieces of code from the internet without understanding how they work is simplistic.

Marco

And taking them without a simple 'thank you' is disrespectful.

Link to comment
Share on other sites

Hi,:)

for a simple 'thank you' see post n°13. :ouch: I'm kidding...

Now i'm going to study lisp:sweat:. I'm serious...

:):):)

Marco

Link to comment
Share on other sites

Hello,:shock:

I read the post quickly:P, I took the code that works and I thank those who posted:D.

Greetings all,

Marco

Nice.:glare:

 

*lamo*

 

 

.............

Link to comment
Share on other sites

So you have no intention to learn? John obviously put a lot of time into his answer to benefit your learning, surely the least you could do was study his code.

 

its cool. I get that a lot because i dont give people the answer outright. I try to teach not give code away.

Link to comment
Share on other sites

  • 2 years later...

Hi,

 

Is there a variable of this I can have and put into my acad pgp to unlock all layers upon open? Have a colleague who uses locked layers as layer off and doesn't respect layer locking. :x

 

cheers

Link to comment
Share on other sites

Hi,

 

Is there a variable of this I can have and put into my acad pgp to unlock all layers upon open? Have a colleague who uses locked layers as layer off and doesn't respect layer locking. :x

 

cheers

You can't put the code in your pgp file (not what it's for), but you can put a bit of code in your startup file (acaddoc.lsp, etc.). Remark has posted a nice link to what you need.

Link to comment
Share on other sites

  • 7 months later...

to unlock all layers in one click. Not one layer at a time but ALL LAYERS AT ONCE.

1. open the layer properties table or type LAYER. then enter

2. inside the layer properties table, highlight all the layers OR click on one layer and press CTRL A to highlight all at once.

3. then click on one unlock icon AND EVERYTHING UNLOCKS

 

works for LOCK, FREEZE and LAYER ON.

Good Luck.

Link to comment
Share on other sites

  • 2 years later...
  • 1 year later...

How to run this lisp without the ()?

 

example:

 

c:unlockall instead of (gc:LayerUnLockAll T)

c:lockprevious instead of (gc:LayerUnLockAll nil)

 

Hi,

 

Here's a method using defun-q to store the unlocked layers list within the function so that they can be relocked by calling the same function.

 

Using

(gc:LayerUnLockAll T) unlock all locked layers and store them in a list within the function

(gc:LayerUnLockAll nil) relock previously unlocked layers stored in the function.

 

;;; gc:LayerUnLockAll (gile)
;;; Unlock all layers or relock prevously locked layers
;;;
;;; Argument : T or nil
;;;
;;; Using :
;;; (gc:LayerUnLockAll T) unlock all locked layers
;;; (gc:LayerUnLockAll nil) relock previously unlocked layers

(vl-load-com)
(defun-q
 gc:layerunlockall
 (flag / lst lay)
 (setq lst nil)
 (if flag
   (vlax-for l (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object)))
     (and (= (vla-get-Lock l) :vlax-true)
      (setq lst (cons l lst))
      (vla-put-Lock l :vlax-false)
     )
   )
   (progn
     (foreach n lst
   (vl-catch-all-apply 'vla-put-Lock (list n :vlax-true))
     )
     (setq lst nil)
   )
 )
 (setq    gc:layerunlockall
    (cons (car gc:layerunlockall)
          (cons (list 'setq 'lst (list 'quote lst))
            (cddr gc:layerunlockall)
          )
    )
 )
 lst
)

Link to comment
Share on other sites

Hi,

 

You can simply do:

(defun c:unlockall () (gc:layerunlockall T) (princ))
(defun c:lockprevious () (gc:layerunlockall nil) (princ))

Link to comment
Share on other sites

Thanks gile :)

 

Hi,

 

You can simply do:

(defun c:unlockall () (gc:layerunlockall T) (princ))
(defun c:lockprevious () (gc:layerunlockall nil) (princ))

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...