본문 바로가기
autocad

시트 블럭 이름 찾기 (와일드카드 사용)

by kmlab 2026. 7. 15.
(defun KM:SEEK_SHT ( _WC_LIST / WC_SHN_LIST shn_len n WC_SHN sht)
(setq WC_SHN_LIST _WC_LIST)
(setq shn_len (length WC_SHN_LIST) n 0)
(repeat shn_len
	(setq WC_SHN (nth n WC_SHN_LIST))
	(if (setq sht (ssget "X" (list (cons 0 "INSERT") (cons 2 WC_SHN))))
		(progn 
			(if (= 1 (sslength sht))
				(setq shtName (cdr (assoc 2 (entget (ssname sht 0)))))
				(progn	; Many WC_SHN proccess
					(princ "\nSelect a Sheet for Titleblock: \n")
					(setq sht (entsel))
					(setq shtName (cdr (assoc 2 (entget sht))))
				);progn
			);if
		);progn
	);if
	(setq n (1+ n))
);repeat
(princ shtName)
(princ)
);defun
;;
;;
(setq _WC_LIST (list "*Sheet_YI*" "*FORM*"))
(setq shn (KM:SEEK_SHT _WC_LIST))
(setq ss (ssget "X" (list (cons 0 "insert") (cons 2 shn))))
(setq scl (cdr (assoc 41 (entget (ssname ss 0)))))

시트이름 찾아서 그 블럭의 스케일 구하기

반응형