Xref's Reference Names save a list. XRN3, XRN3
(defun c:xxx ( / )
(setvar "CMDECHO" 0)
(if (tblsearch "block" "SHEET_Ph-3")
(command "-rename" "b" "SHEET_Ph-3" "SHEET_Ph-3_AS BUILT"))
(if (tblsearch "block" "SHEET_Ph-4")
(command "-rename" "b" "SHEET_Ph-4" "SHEET_Ph-4_AS BUILT"))
;
(setq PH3 "..\\..\\..\\01. 건축\\XREF\\")
(setq PH4 "..\\..\\..\\01. 건축\\XREF\\PH-4\\")
(setq XRN3
(list "1F" "1F+4000" "2F" "2F_차선계획" "3F" "4F" "5F" "6F" "7F" "8F" "8F+7050" "9F"
"GANTRY#1-ref" "GANTRY#2-ref" "GANTRY#3-ref" "GANTRY#4-ref" "ROOF"
"Section-01" "Section-02" "Section-03" "Section-04" "배치도" "입면도"
"SHEET_Ph-3_AS BUILT" ))
(setq XRN4
(list "1F(PH-4_SOLID)" "1F+4000(PH-4_SOLID)" "2F(PH-4_SOLID)" "3F(PH-4_SOLID)"
"4F(PH-4_SOLID)" "5F(PH-4_SOLID)" "6F(PH-4_SOLID)" "7F(PH-4_SOLID)" "8F(PH-4_SOLID)"
"8F+7050(PH-4_SOLID)" "9F(PH-4_SOLID)" "PH-4_KEY-PLAN(001)" "ROOF(PH-4_SOLID)"
"SHEET_Ph-4_AS BUILT" ))
;
(setq cnt (length XRN3) n 0)
(repeat cnt
(setq xrn (nth n XRN3))
(KM:XREFUP xrn PH3)
(setq n (+ 1 n))
)
;
(setq cnt (length XRN4) n 0)
(repeat cnt
(setq xrn (nth n XRN4))
(KM:XREFUP xrn PH4)
(setq n (+ 1 n))
)
;
(setvar "CMDECHO" 1)
(command "zoom" "e")
(princ)
)
;;;
(defun KM:XREFUP ( _XRNAME _XRPATH / xrname xrpath)
(setq xrname _XRNAME xrpath (strcat _XRPATH xrname ".dwg"))
(command "-xref" "p" xrname xrpath)
(princ)
)
XRN3, XRN4는 xref 파일들의 이름임. (각각 Ph-3, Ph-4)
(tblsearch "block" ...) 부분은 도각파일의 외부참조 이름을 찾아서, "~~~_AS BUILT"로 변경
xrname은 XRN3,4 리스트에서 nth 함수로 추출한 외부참조이름.
PH3,4는 xref 파일 경로를 저장하고,
xrpath는 (strcat)으로 PH, xrname, ".dwg"를 연결한다.
XRN3,4 리스트의 원소 갯수만큼 반복해서 (command "-xref" ..) 실행.
반응형
'autocad' 카테고리의 다른 글
| Studying DCL (0) | 2025.10.01 |
|---|---|
| Listing Filenames in a Folder (0) | 2025.10.01 |
| Erase Layers of REV. and Entities in Title blocks (0) | 2025.10.01 |
| Count Layers (0) | 2025.10.01 |
| 대화상자 끄기. DialogBox_OFF (0) | 2025.09.12 |