Lệnh mở khóa tất cả các layer

     

kycuckeo 2

biết vẽ circleThành viên 235 bài bác viếtGiới tính:MaleVị trí:TPHCMSở thích:Thiết kế, âm nhạc, thể thao.
*

Có thể mình không biết hết ý các bạn nhưng các bạn hãy tìm câu vấn đáp trong lisp này:

;;=======================================================================================================;; si mê dao nguoc tinh trang cua cac lop THAWFREE(defun C:revla ()(setq La (tblnext "layer" t))(setq lname (cdr (assoc 2 la)))(setq fr (cdr (assoc 70 la)))(setq on (cdr (assoc 62 la)))(command ".layer")(cond ((= (strcase lname) (strcase (getvar "clayer"))) (progn(princ " Can"t không tính phí current layer") ;;(if (> on 0) (command "off" lname "Y") (command "on" lname) ) )) (T (progn (if (= fr 0) (command "f" lname) (command "t" lname) ) ;;(if (> on 0) (command "off" lname) (command "on" lname) ) )));;; kết thúc cond(setq la (tblnext "layer"))(while la(setq lname (cdr (assoc 2 la)))(setq fr (cdr (assoc 70 la)))(setq on (cdr (assoc 62 la)))(cond ((= (strcase lname) (strcase (getvar "clayer"))) (progn (princ " Can"t không tính phí current layer") ;;(if (> on 0) (command "off" lname "Y") (command "on" lname) ) )) (T (progn (if (= fr 0) (command "f" lname) (command "t" lname) );;(if (> on 0) (command "off" lname) (command "on" lname) ) )));;; over cond(setq La (tblnext "layer")));;; end while(command "")(princ));;=======================================================================================================;;Ham dao nguoc tinh trang cua cac lop ONOFF(defun C:revla1 ()(setq La (tblnext "layer" t))(setq lname (cdr (assoc 2 la)))(setq fr (cdr (assoc 70 la)))(setq on (cdr (assoc 62 la)))(command ".layer")(cond ((= (strcase lname) (strcase (getvar "clayer"))) (progn ;;(princ " Can"t free current layer")(if (> on 0) (command "off" lname "Y") (command "on" lname) ) )) (T (progn ;; (if (= fr 0) (command "f" lname) (command "t" lname) ) (if (> on 0) (command "off" lname) (command "on" lname) ) )));;; kết thúc cond(setq la (tblnext "layer"))(while la(setq lname (cdr (assoc 2 la)))(setq fr (cdr (assoc 70 la)))(setq on (cdr (assoc 62 la)))(cond ((= (strcase lname) (strcase (getvar "clayer"))) (progn ;;(princ " Can"t không tính tiền current layer") (if (> on 0) (command "off" lname "Y") (command "on" lname) ) )) (T (progn;;(if (= fr 0) (command "f" lname) (command "t" lname) ) (if (> on 0) (command "off" lname) (command "on" lname) ) )));;; over cond(setq La (tblnext "layer")));;; end while(command "")(princ));;=======================================================================================================; -------------------- ISOLATE LAYER FUNCTION --------------------(Defun C:LAYISO (/ SS CNT LAY LAYLST VAL VPMODE) (acet-error-init(list (list "cmdecho" 0"expert" 0 ) T;flag.

Bạn đang xem: Lệnh mở khóa tất cả các layer

True means use undo for error clean up.);list );acet-error-init (if (and (= 0 (getvar "tilemode")) ; if in a paper space (/= 1 (getvar "cvport")) ; viewport )(setq VPMODE T) ; phối flag for viewport behavior ) (if (not (setq SS (ssget "_i")))(progn (prompt " Select object(s) on the layer(s) lớn be isolated: ") (setq SS (ssget))) ) (if SS(progn (setq CNT 0) (while (and ss (> (sslength ss) 0) (setq LAY (ssname SS CNT)) );and(setq LAY (cdr (assoc 8 (entget LAY))))(if (not (member LAY LAYLST)) (setq LAYLST (cons LAY LAYLST)))(setq CNT (1+ CNT)) ) (cond(VPMODE (command "_.vplayer" "_freeze" "*" "_Current") (foreach VAL LAYLST (command "_Thaw" VAL "_Current")) (command "") (if (= (length LAYLST) 1)(prompt (acet-str-format " Layer %1 has been isolated in this viewport." (car LAYLST)))(prompt (acet-str-format " %1 layers have been isolated in this viewport." (itoa (length LAYLST)))) ))(T (if (member (getvar "CLAYER") LAYLST)(setq LAY (getvar "CLAYER"))(setvar "CLAYER" (setq LAY (last LAYLST))) ) (command "_.-LAYER" "_OFF" "*" "_Y") (foreach VAL LAYLST (command "_ON" VAL)) (command "") (if (= (length LAYLST) 1)(prompt (acet-str-format " Layer %1 has been isolated." (car LAYLST)))(prompt (acet-str-format " %1 layers have been isolated. Layer %2 is current." (itoa (length LAYLST)) LAY)) )) )) ) (acet-error-restore) (princ));;=======================================================================================================; -------------------- LAYER FREEZE FUNCTION ---------------------(defun C:LAYFRZ (); --------------------- Error initialization --------------------- (acet-error-init(list (list "cmdecho" 0"expert" 0 ) nil;flag. True means use undo for error clean up.);list );acet-error-init (layproc "frz") (acet-error-restore) (princ));;=======================================================================================================; ---------------------- LAYER OFF FUNCTION ----------------------(defun C:LAYOFF (); --------------------- Error initialization --------------------- (acet-error-init(list (list "cmdecho" 0"expert" 0 ) nil;flag. True means use undo for error clean up.);list );acet-error-init (layproc "off") (acet-error-restore) (princ));;=======================================================================================================; ------------- LAYER PROCESSOR FOR LAYOFF & LAYFRZ --------------(defun LAYPROC ( TASK / NOEXIT OPT BLKLST CNT VPMODE EN PMT ANS LAY NEST BLKLST VPSS); -------------------- Variable initialization ------------------- (setq NOEXIT T) (setq OPT (getenv (strcat "ACET_Lay" TASK))) ; get mặc định option setting (if (not (or (null OPT) (= OPT ""))) (setq OPT (atoi OPT))) (setq CNT 0) ; cycle counter (if (and (= 0 (getvar "tilemode")) ; if in a paper space (/= 1 (getvar "cvport")) ; viewport )(setq VPMODE T) ; set flag for freeze behavior ); ----------------------- Selection Prompt ----------------------- (while NOEXIT(setvar "errno" 7)(while (= (getvar "errno") 7) (setvar "errno" 0) (initget "Options Undo _Options Undo") (cond((= TASK "off") (setq EN (nentsel " Select an object on the layer to be turned off or : ")))((= TASK "frz") (setq EN (nentsel " Select an object on the layer lớn be frozen or : ")))((= TASK "vpi") (setq EN (nentsel " Select an object on the layer lớn be Isolated in viewport or : "))) ) (if (= (getvar "errno") 7)(prompt " Nothing selected.") )); ---------------------- Options Selected -----------------------(cond ((= EN "Options")(initget "No Block Entity _No Block Entity")(cond ((= OPT 1)(setq PMT " Enter an option : ") ) ((= OPT 2)(setq PMT " Enter an option : ") ) (T(setq PMT " Enter an option : ") ))(setq ANS (getkword PMT))(cond ((null ANS)(if (or (null OPT) (= OPT "")) (progn(setq OPT 3)(setenv (strcat "ACET_Lay" TASK) "3") )) ) ((= ANS "No")(setq OPT 1)(setenv (strcat "ACET_Lay" TASK) "1") ) ((= ANS "Entity")(setq OPT 2)(setenv (strcat "ACET_Lay" TASK) "2") ) (T(setq OPT 3)(setenv (strcat "ACET_Lay" TASK) "3") )) ); ---------------------- Undo selected --------------------------- ((= EN "Undo")(if (> CNT 0) (progn(command "_.u")(setq CNT (1- CNT)) ) (prompt " Everything has been undone.")) ); ------------------------- Find Layer ---------------------------(EN(setq BLKLST (last EN))(setq NEST (length BLKLST))(cond ; If the entity is not nested or if the option for entity ; level nesting is selected. ((or (= OPT 2) ( (length BLKLST) 0)(assoc 1 (tblsearch "BLOCK" (cdr (assoc 2 (entget (car BLKLST)))))) );and (setq BLKLST (cdr BLKLST)))(if ( > (length BLKLST) 0) ; if there is a block present (setq LAY (entget (car BLKLST))) ; use block layer (setq LAY (entget (car EN))) ; else use layer of nensel) )); ------------------------ Process Layer -------------------------(setq LAY (cdr (assoc 8 LAY)))(if (= LAY (getvar "CLAYER")) (cond((= TASK "off") (initget "Yes No _Yes No") (setq ANS (getkword (acet-str-format " Really want layer %1 (the CURRENT layer) off? : " LAY))) (setq ANS (if (null ANS) "No" ANS)) (if (= ANS "No")(setq LAY nil) ))((and (= TASK "frz") (not VPMODE)) (prompt (acet-str-format " Cannot freeze layer %1. It is the CURRENT layer." LAY)) (setq LAY nil)) ) (setq ANS nil))(if LAY (cond((= TASK "off") (if ANS(command "_.-LAYER" "_OFF" LAY "_Yes" "")(command "_.-LAYER" "_OFF" LAY "") ) (prompt (acet-str-format " Layer %1 has been turned off." LAY)) (setq CNT (1+ CNT)))((and (= TASK "frz") VPMODE) (command "_.VPLAYER" "_FREEZE" LAY "_current" "") (prompt (acet-str-format " Layer %1 has been frozen in this viewport." LAY)) (setq CNT (1+ CNT)))((= TASK "frz") (command "_.-LAYER" "_FREEZE" LAY "") (prompt (acet-str-format " Layer %1 has been frozen." LAY )) (setq CNT (1+ CNT)))((= TASK "vpi") (setq VPSS (ssget "_x" (list "(-4 . " "(0 . "VIEWPORT"); get all viewports "(-4 . "(cons 69 (getvar "cvport")) ; except the current "(-4 . "NOT>") "(-4 . ""(69 . 1) ; và the paperspace viewport (1) "(-4 . "NOT>") "(-4 . "AND>") ) ) ) (command "_.VPLAYER" "_FREEZE" LAY "_select" VPSS "" "") (prompt (acet-str-format " Layer %1 has been frozen in all viewports but the current one." LAY )) (setq CNT (1+ CNT))) )) ); ---------------------- Nothing Selected ----------------------- ((not EN)(setq NOEXIT nil) )) ));;=======================================================================================================; --------------------- LAYER LOCK FUNCTION ----------------------(Defun C:LAYLCK (/ LAY) (acet-error-init(list (list "cmdecho" 0"expert" 0 ) T;flag.

Xem thêm: Kiểu Tóc Cho Người Tóc Mỏng Trán Cao Nam, Khiến Chị Em Ai

True means use undo for error clean up.);list );acet-error-init (setq LAY (entsel " Select an object on the layer lớn be locked: ")) (if LAY(progn (setq LAY (cdr (assoc 8 (entget (car LAY))))) (Command "_.-LAYER" "_LOCK" LAY "") (prompt (acet-str-format " Layer %1 has been locked." LAY ))) ) (acet-error-restore) (princ));;=======================================================================================================; -------------------- LAYER UNLOCK FUNCTION ---------------------(Defun C:LAYULK (/ LAY) (acet-error-init(list (list "cmdecho" 0"expert" 0 ) T;flag. True means use undo for error clean up.);list );acet-error-init (setq LAY (entsel " Select an object on the layer khổng lồ be unlocked: ")) (if LAY(progn (setq LAY (cdr (assoc 8 (entget (car LAY))))) (Command "_.-LAYER" "_UNLOCK" LAY "") (prompt (acet-str-format " Layer %1 has been unlocked." LAY ))) ) (acet-error-restore) (princ));;=======================================================================================================; ---------------------- LAYER ON FUNCTION -----------------------(Defun C:LAYON () (acet-error-init(list (list "cmdecho" 0) nil;flag. True means use undo for error clean up.);list );acet-error-init (Command "_.-LAYER" "_ON" "*" "") (prompt " All layers have been turned on.") (acet-error-restore) (princ));;=======================================================================================================; --------------------- LAYER THAW FUNCTION ----------------------(Defun C:LAYTHW () (acet-error-init(list (list "cmdecho" 0) nil;flag. True means use undo for error clean up.);list );acet-error-init (Command "_.-LAYER" "_THAW" "*" "") (prompt " All layers have been thawed.") (acet-error-restore) (princ));;=======================================================================================================; --------------------- LAYER MATCH FUNCTION ---------------------(Defun C:LAYMCH (/ SS CNT LOOP LAY ANS) (acet-error-init(list (list "cmdecho" 0) T;flag. True means use undo for error clean up.);list );acet-error-init (if (not (setq SS (ssget "_i")))(progn (prompt " Select objects to be changed: ") (setq SS (ssget))) ) (if SS(progn (setq CNT (sslength SS)) (princ (acet-str-format " %1 found." (itoa CNT))) ; Report number of items found (command "_.move" SS ""); filter out objects on locked layers (if (> (getvar "cmdactive") 0) ; if there are still objects left(progn (command "0,0" "0,0") (setq SS (ssget "_p")CNT (- CNT (sslength SS)) ; count them ))(setq SS nil) ; else abort operation ) (if (> CNT 0) ; if items where filtered out(if (= CNT 1) (princ (acet-str-format " %1 was on a locked layer." (itoa CNT) )) ; report it. (princ (acet-str-format " %1 were on a locked layer." (itoa CNT) ))) )) ) (if SS(progn (initget "Type-it _Type-it") (setq LAY (entsel " Select object on destination layer or : ")LOOP T ) (while LOOP(cond ((not LAY)(prompt " Nothing selected.")(initget "Yes No _Yes No")(setq ANS (getkword " Use current layer? "))(setq ANS (if (null ANS) "Yes" ANS))(if (= ANS "Yes") (setq LAY (getvar "clayer")LOOP nil )) ) ((listp LAY)(setq LOOP nil) ) ((= LAY "Type-it")(setq LAY (getstring " Enter layer name: "))(cond ((tblobjname "LAYER" LAY)(setq LOOP nil) ) ((/= LAY "")(initget "Yes No _Yes No")(setq ANS (getkword " Layer does not exist. Would you like to create it? : "))(setq ANS (if (null ANS) "Yes" ANS));setq(if (= ANS "Yes") (if(entmake (list "(0 . "LAYER") "(100 . "AcDbSymbolTableRecord") "(100 . "AcDbLayerTableRecord") "(6 . "CONTINUOUS") "(62 . 7) "(70 . 0) (cons 2 LAY) ))(setq LOOP nil)(prompt " Invalid Layer name.") )) )) ))(if LOOP (progn(initget "Type-it _Type-it")(setq LAY (entsel " Select entity on destination layer or : ")) )) ); while LOOP (if (listp LAY)(setq LAY (cdr (assoc 8 (entget (car LAY))))) ) (command "_.chprop" SS "" "_la" LAY "") (if (= (sslength SS) 1)(prompt (acet-str-format " One object changed to lớn layer %1" LAY ))(prompt (acet-str-format " %1 objects changed lớn layer %2" (itoa (sslength SS)) LAY )) ) (if (= LAY (getvar "clayer"))(prompt " (the current layer).")(prompt ".") )) ) (acet-error-restore) (princ));;=======================================================================================================; --------------- CHANGE to lớn CURRENT LAYER FUNCTION ---------------(Defun C:LAYCUR (/ SS CNT LAY) (acet-error-init(list (list "cmdecho" 0) T;flag. True means use undo for error clean up.);list );acet-error-init (if (not (setq SS (ssget "_i")))(progn (prompt " Select objects lớn be changed to lớn the current layer: ") (setq SS (ssget))) ) (if SS(progn (setq CNT (sslength SS)) (princ (acet-str-format " %1 found." (itoa CNT) )) ; Report number of items found (command "_.move" SS ""); filter out objects on locked layers (if (> (getvar "cmdactive") 0) ; if there are still objects left(progn (command "0,0" "0,0") (setq SS (ssget "_p")CNT (- CNT (sslength SS)) ; count them ))(setq SS nil) ; else abort operation ) (if (> CNT 0) ; if items where filtered out(if (= CNT 1) (princ (acet-str-format " %1 was on a locked layer." (itoa CNT) )) ; report it. (princ (acet-str-format " %1 were on a locked layer." (itoa CNT) ))) )) ) (if SS(progn (setq LAY (getvar "CLAYER")) (command "_.chprop" SS "" "_la" LAY "") (if (= (sslength SS) 1)(prompt (acet-str-format " One object changed lớn layer %1 (the current layer)." LAY ))(prompt (acet-str-format " %1 objects changed lớn layer %2 (the current layer)." (itoa (sslength SS)) LAY)) )) ) (acet-error-restore) (princ))(princ);;=======================================================================================================