Jump to content

Unlocking layers


MiGo

Recommended Posts

I am working on a script and hit a little bump. At a point I want to unlock all layers where the objects are selectable (layers unfrozen and turned on).

 

If I have the script initiate the layer command then there is the select options list and "u" is for unlock. It then wants a layer name or return to select items. Here is where the problem is when i'm in control I can just hit return to select the items and just select all, but when the script is running it skips my space for a return and goes to the next all statement and errors saying not a valid option. Is there a way to force that return to select the objects?

Link to comment
Share on other sites

Thanks, but that unlocks all layers, but I have come to the realization that if a layer is locked and turned off then the objects will still not be selectable, so unlocking all layers will work. Thanks helping me come to that realization.

Link to comment
Share on other sites

just add a little to lpseifert's code:

 

-layer
unlock
*
on
*
thaw
*

 

hell, if you aren't changing any of the layer properties from "-layer", when you reach the end of your script, you can just issue:

layerp

Link to comment
Share on other sites

  • 3 years later...
; Andreas Behnk Juni 2012
; Klafs GmbH & CO KG
; abrufen und entsperren aller Layer einer DWG in Klassik Lisp 

(defun Layer:entsperren  (/ erster zugriff layerliste i)

 (setq erster T
       i 0) ; für den ersten Layer

 (setq zugriff (tblnext "layer" erster))
 (setq layerliste (cons (cdr (assoc 2 zugriff)) layerliste))
 (setq erster NIL) ; damit werden alle anderen Layer gelesen 
   (while (setq zugriff (tblnext "layer" erster))
       (setq layerliste (cons (cdr (assoc 2 zugriff)) layerliste)) ; füllt die Layer Liste 
   )

   (repeat (length layerliste)
         (command "-layer" "EN" (nth i layerliste) "")      ; entsperrt einen Layer i
     (setq  i (+ 1 i))
   )


 
) ; defun

Edited by rkmcswain
added [CODE] tags
Link to comment
Share on other sites

  • 2 years later...

If you are too lazy to type "-layer" command and unlock every time, then this will work.

Create a lisp file and paste this.

(defun C:LAYULKALL ()
 (command "_layer" "u" "*" "")
 (princ "\nLAYULKALL\nAll layers have been unlocked.")
 (princ)
)
(princ "\nUse LAYULKALL to unlock all layers")
(princ)

Load the lisp in CAD and issue "LAYULKALL" at command line.

Link to comment
Share on other sites

  • 2 months later...
If you are too lazy to type "-layer" command and unlock every time, then this will work.

Create a lisp file and paste this.

(defun C:LAYULKALL ()
 (command "_layer" "u" "*" "")
 (princ "\nLAYULKALL\nAll layers have been unlocked.")
 (princ)
)
(princ "\nUse LAYULKALL to unlock all layers")
(princ)

Load the lisp in CAD and issue "LAYULKALL" at command line.

 

Worked Perfectly

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...