วันอาทิตย์ที่ 20 ธันวาคม พ.ศ. 2563

Layer ON-OFF

;----Save to name layer_of.lsp

;-------------------Layer OFF---------------------

(defun c:lof ( / )

(if (null lnlyr)

 

       (progn

              (setq lnlyr (cdr (assoc 8(entget (car (entsel

                     "\nSelect Object on Layer to turn OFF.")))))

              )

              (command "-layer" "off" lnlyr "")

              (prompt (strcat "\nLayer " lnlyr " has been Temporarily turned OFF, use LON to turn ON."))

       )

       (princ (strcat "\nLayer " lnlyr " is already Temporarily turned OFF."))

)

(princ)

);end layer off

;-------------------Layer ON----------------------

(defun c:lon ( / )

(if (null lnlyr)

    (princ "\nNo Layer is Temporarily turned OFF.")

    (progn

        (princ (strcat "\nTurning ON Temporarily turned OFF layer " lnlyr "."))

        (command "-layer" "on" lnlyr "")

        (setq lnlyr nil)

    )

)

(princ)

);end layer on

;----------------------

ส่วนนี้นำไปเพิ่มในไฟล์เมนู ดูเรื่องการ Creating Menu

สร้างไอคอนชื่อ LOF.bmp และ LON.bmp ด้วย

***TOOLBARS

 

**Layer ON-OFF

[_Toolbar("Layer ON-OFF", _Floating, _Show, 202, 163, 1)]

[_Button("Layer OFF", "LOF.bmp", "ICON_24_BLANK")]^C^C^P+

(cond ((not LOF) (prompt "Please Wait...")(load "layer_of"))) LOF (princ)

[_Button("Layer ON", "LON.bmp", "ICON_24_BLANK")]^C^C^P+

(cond ((not LON) (prompt "Please Wait...")(load "layer_of"))) LON (princ)


ไม่มีความคิดเห็น:

แสดงความคิดเห็น