티스토리 뷰
(DEFUN C:L0 () (command "clayer" "0"))
(DEFUN C:LNCT () (command "clayer" "NCT"))
(DEFUN C:Lmagenta () (command "clayer" "MCO"))
(DEFUN C:LHIDDEN2 () (command "clayer" "HIDDEN2"))
(defun C:L1 (/ lo cla)
(setvar "cmdecho" 0)
(princ " = LAYER OFF")
(setq lo (entsel))
;(setq lo (car lo))
;(setq lo (cdr (assoc 8 (entget lo))))
(if lo
(setq lo (cdr (assoc 8 (entget (car lo)))))
(setq lo (strcase (getstring
"\n>> If not, Type Layer Name :")))
);;if
(setq cla (getvar "clayer"))
(if (= cla lo)
(command ".LAYER" "s" "0" "")
);;if
(command ".LAYER" "off" (setq lo lo) "")
(setvar "cmdecho" 1)
(prin1)
)
(defun C:L2 (/ L2)
(setvar "cmdecho" 1)
(princ " = LAYER ALL OFF")
(setq af (entsel))
(princ af)
(princ)
(setq af (car af))
(princ af)
(princ)
(setq af (cdr (assoc 8 (entget af))))
(princ af)
(princ)
(command ".LAYER" "s" af "")
(command ".LAYER" "off" "*" "" "")
(setvar "cmdecho" 1)
(prin1)
)
(defun C:L3 (/ L3)
(setvar "cmdecho" 0)
;;; (princ " = LAYER ALL OFF")
;;; (setq af (entsel))
;;; (princ af)
;;; (princ)
;;; (setq af (car af))
;;; (princ af)
;;; (princ)
;;; (setq af (cdr (assoc 8 (entget af))))
;;; (princ af)
;;; (princ)
(command ".LAYER" "s" "NCT" "")
(command ".LAYER" "off" "*" "" "")
(setvar "cmdecho" 1)
(prin1)
)
(defun c:L4 (/ an)
(setvar "cmdecho" 0)
(princ "= LAYER ALL ON")
(command ".LAYER" "on" "*" "")
(setvar "cmdecho" 1)
(prin1)
)
(defun C:L5 (/ e eo el nla no )
(setvar "cmdecho" 1)
(prompt "\n>> Select Entities to Change :")
(setq eo (ssget))
;;; (prompt "\n>> To what Entity?(or ENTER for Type) :")
;;; (setq el (entsel))
(if (= nil el)
(setq nla (strcase (getstring
"\n>> If not, Type Layer Name (or ENTER for Current Layer) :")))
(setq nla (cdr (assoc 8 (entget (car el))))))
(if (= nla "")
(setq nla (getvar "clayer"))
);;if
(setq no 0)
; (command ".CHANGE" eo "" "p" "la" nla "")
(command ".CHANGE" eo "" "p" "la" "0" "") ; nla -> 바꿀레이어이름
(while
(setq e (ssname eo no))
(setq no (1+ no)))
(setvar "cmdecho" 1)
(prin1)
(L3) ; NCT 레이어만 보기
;;;(setq doc (vla-get-activedocument (vlax-get-acad-object)))
;;;(vla-sendcommand doc (strcat l3 " "))
)
(defun C:L6 (/ L6)
(setvar "cmdecho" 0)
;;; (princ " = LAYER ALL OFF")
;;; (setq af (entsel))
;;; (princ af)
;;; (princ)
;;; (setq af (car af))
;;; (princ af)
;;; (princ)
;;; (setq af (cdr (assoc 8 (entget af))))
;;; (princ af)
;;; (princ)
(command ".LAYER" "s" "레이져" "")
(command ".LAYER" "off" "*" "" "")
(setvar "cmdecho" 1)
(prin1)
)
(defun c:q3 () (command "laylck")) ; 레이어 잠금
(defun c:q33 () (command "layulk")) ; 레이어 잠금해제
;
(defun c:q2 () (command "layiso")) ; 선택레이어외 모두 잠금
(defun c:q22 () (command "layuniso")) ; layiso 해제
;
(defun c:q4 () (command "layoff")) ; 레이어 끔
(defun c:q44 () (command "layon")) ; 레이어 켬
;
위의 리습명령을 이용해서
L7 명령어를 만들려고 하는데,
L7명령은 "레이져" layer와 "visibleLine"을 화면에 보이게 하는 코드이다.
리스프 명령어를 정의할 때, 다른 기존 명령어들을 참조하거나 결합하여 사용할 수 있습니다.
여기서 `C:L7` 명령어를 정의하여 "레이져" 레이어와 "visibleLine" 레이어를 화면에 보이게 하려면 다음과 같은 절차를 따르면 됩니다:
1. 모든 레이어를 꺼놓습니다. 2. "레이져" 레이어와 "visibleLine" 레이어만 켭니다.
위의 절차를 반영하여 `C:L7` 함수를 다음과 같이 정의할 수 있습니다: ```
lisp (defun C:L7 () (setvar "cmdecho" 0) ; 명령어 출력을 숨김 (command ".LAYER" "OFF" "*" "") ; 모든 레이어를 꺼놓음 (command ".LAYER" "ON" "레이져" "") ; "레이져" 레이어를 켬 (command ".LAYER" "ON" "visibleLine" "") ; "visibleLine" 레이어를 켬 (setvar "cmdecho" 1) ; 명령어 출력을 복원 (princ) ) ```
이제 AutoCAD에서 `L7` 명령어를 입력하면 "레이져" 레이어와 "visibleLine" 레이어만 화면에 보이게 됩니다.
(defun C:L7 ()
(setvar "cmdecho" 0) ; 명령어 출력을 숨김
(command ".LAYER" "OFF" "*" "") ; 모든 레이어를 꺼놓음
(command ".LAYER" "ON" "레이져" "") ; "레이져" 레이어를 켬
(command ".LAYER" "ON" "visibleLine" "") ; "visibleLine" 레이어를 켬
(setvar "cmdecho" 1) ; 명령어 출력을 복원
(princ)
)
두개의 레이어를 켤 경우 위의 사항을 따르면 됩니다.
'IT tech Coding > AutoLisp' 카테고리의 다른 글
[lisp] 도면 블럭을 한번에 출력하는 명령어 'PI'에 대한 코드 설명 (1) | 2024.05.31 |
---|---|
[lisp] 특정레이어만 빼고 Layer 끄기 등 레이어 관련 리습 공유 (0) | 2022.03.14 |
오토리습(autolisp) WB 명령으로 블록 쉽게 저장해 보자 (0) | 2022.02.15 |
[autolisp] 절곡라인을 점으로부터 그려볼까? 내맘대로 리습 (1) | 2022.01.11 |
lisp 명령어 탐구생활, lisp으로 캐드의 지겨운 반복 벗어나 보자! (1) | 2022.01.11 |
- Total
- Today
- Yesterday
- sql문장 날짜계산
- General error: 2031
- 1. #웹개발 2. #로트번호 3. #성적서보기 4. #ajax 5. #jquery 6. #php 7. #프론트엔드 8. #백엔드 9. #부트스트랩 10. #웹기능구현
- 코딩효율성
- chatGPT3.5파이썬버전
- 효율적코딩방법
- 티스토리챌린지
- 도면자동생성
- isset을 적용해야 하는 이유
- 구글드라이브API
- 스크립트작성기초
- 엑셀입력보호
- 프로그래머생활
- coalesce는 한국어로 "코얼레스크" 또는 "코얼리스"
- ajax오류메시지
- 파이썬코드줄바꿈방법
- 엑셀셀보호
- 뫄프로그래밍
- 코딩튜토리얼
- 테크에능한여성
- 오토핫키가이드
- #프로그램설치
- #InstallForge
- 오블완
- Bootstrap 5
- json파일형태보기
- 캐드자동작도
- json파일편하게보는법
- 엑셀보호
- #파이썬패키징
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |