자료실 Q&A
글 수 2,319
2009.09.04 17:23:08 (*.63.24.14)
(defun c:tit (/ bname temp ent os bp scale tp sp ep spdist epdist ss index tsp tep ss2 savepath savename fname svnum)
(command "undo" "g")
(setq bname nil)
(setq temp t)
(while temp
(setq temp (entsel "\n 도각을 선택하세요 : "))
(setq ent (entget (car temp)))
(if (= (cdr (assoc 0 ent)) "INSERT")
(progn
(setq bname (cdr (assoc 2 ent)))
(setq temp nil)
)
(princ "\n 도각블럭을 선택해주세요!")
)
)
(if bname
(progn
(setq os (getvar "osmode"))
(setvar "osmode" 0)
(setq bp (cdr (assoc 10 ent)))
(setq scale (cdr (assoc 41 ent)))
(setq tp (mapcar '+ bp (mapcar '* (list 841 594) (list scale scale))))
(command "zoom" bp tp)
(setq sp (getpoint "\n 저장될 파일명으로 사용될 텍스트가 있는 구역을 선택하세요 : "))
(if sp
(progn
(setq ep (getcorner sp "\n 다음점 : "))
(if ep
(progn
(setq spdist (mapcar '/ (mapcar '- sp bp) (list scale scale)))
(setq epdist (mapcar '/ (mapcar '- ep bp) (list scale scale)))
(setq ss (ssget "x" (list (cons 0 "insert") (cons 2 bname))))
(setq index 0)
(repeat (sslength ss)
(setq ent (entget (ssname ss index)))
(setq bp (cdr (assoc 10 ent)))
(setq scale (cdr (assoc 41 ent)))
(setq tp (mapcar '+ bp (mapcar '* (list 841 594) (list scale scale))))
(command "zoom" bp tp)
(setq tsp (mapcar '+ bp (mapcar '* spdist (list scale scale))))
(setq tep (mapcar '+ bp (mapcar '* epdist (list scale scale))))
(setq ss2 (ssget "w" tsp tep (list (cons 0 "text"))))
(if ss2
(progn
(setq savepath (getvar "DWGPREFIX"))
(setq fname (cdr (assoc 1 (entget (ssname ss2 0)))))
(setq savename (strcat savepath fname))
(setq svnum 0)
(while (findfile (strcat savename ".dwg"))
(setq savename (strcat savepath fname"_" (rtos (setq svnum (1+ svnum)) 2 0)))
)
(command "wblock" savename "" bp "w" bp tp "")
)
)
(setq index (1+ index))
)
)
)
)
)
(setvar "osmode" os)
)
)
(command "undo" "e")
(princ)
)
(command "undo" "g")
(setq bname nil)
(setq temp t)
(while temp
(setq temp (entsel "\n 도각을 선택하세요 : "))
(setq ent (entget (car temp)))
(if (= (cdr (assoc 0 ent)) "INSERT")
(progn
(setq bname (cdr (assoc 2 ent)))
(setq temp nil)
)
(princ "\n 도각블럭을 선택해주세요!")
)
)
(if bname
(progn
(setq os (getvar "osmode"))
(setvar "osmode" 0)
(setq bp (cdr (assoc 10 ent)))
(setq scale (cdr (assoc 41 ent)))
(setq tp (mapcar '+ bp (mapcar '* (list 841 594) (list scale scale))))
(command "zoom" bp tp)
(setq sp (getpoint "\n 저장될 파일명으로 사용될 텍스트가 있는 구역을 선택하세요 : "))
(if sp
(progn
(setq ep (getcorner sp "\n 다음점 : "))
(if ep
(progn
(setq spdist (mapcar '/ (mapcar '- sp bp) (list scale scale)))
(setq epdist (mapcar '/ (mapcar '- ep bp) (list scale scale)))
(setq ss (ssget "x" (list (cons 0 "insert") (cons 2 bname))))
(setq index 0)
(repeat (sslength ss)
(setq ent (entget (ssname ss index)))
(setq bp (cdr (assoc 10 ent)))
(setq scale (cdr (assoc 41 ent)))
(setq tp (mapcar '+ bp (mapcar '* (list 841 594) (list scale scale))))
(command "zoom" bp tp)
(setq tsp (mapcar '+ bp (mapcar '* spdist (list scale scale))))
(setq tep (mapcar '+ bp (mapcar '* epdist (list scale scale))))
(setq ss2 (ssget "w" tsp tep (list (cons 0 "text"))))
(if ss2
(progn
(setq savepath (getvar "DWGPREFIX"))
(setq fname (cdr (assoc 1 (entget (ssname ss2 0)))))
(setq savename (strcat savepath fname))
(setq svnum 0)
(while (findfile (strcat savename ".dwg"))
(setq savename (strcat savepath fname"_" (rtos (setq svnum (1+ svnum)) 2 0)))
)
(command "wblock" savename "" bp "w" bp tp "")
)
)
(setq index (1+ index))
)
)
)
)
)
(setvar "osmode" os)
)
)
(command "undo" "e")
(princ)
)