아래 리습은 도면안에 정해진 자리에 있는 text를 일렬로 나열해서
bmbmbm.txt 파일로 만들어 줍니다.. 그럼 excel에서 읽을수 있죠…
예) FILE-001 ELBOW 2″ 10 SUS304
FILE-002 TEE 3″ 5 SUS304
그런데 DOS에서 사용하던거라 WIN버젼에서 사용을 못함니다…
고수님들 한번보시고 R14에서 쓸수 있게 바꿔줄수 없을까요?
**********************************************************************
(defun *ERROR* (msg)
(princ “error ========> : “)
(princ dwg)
(setq wrf1 ( open “check.TXT” “a”))
(setq nna (strcat “err ==>” dwg ))
(write-line nna wrf1)
(close wrf1)
)
(defun cxx()
(setq a (ssget “w” XX1 XX2) vtx nil)
(if (/= a nil)
(progn
(setq vtt nil vtx nil index 0)
(repeat (sslength a)
(setq a1 (entget (ssname a index))
vtt (cdr (assoc 0 a1))
)
(if (= vtt “TEXT”)
(setq vtx (cdr (assoc 1 a1)))
)
(setq index (+ 1 index))
)
)
)
(if (= vtx nil)(setq vtx “xxxxx”))
(setq ddda (type vtx))
(if (= ddda “REAL”)
(progn
(setq ddd1 (itoa (fix (* vtx 10)))
ddd2 (strlen ddd1)
)
(if (= ddd2 1)
(setq vtx (strcat “0.” ddd1)))
(setq ddd3 (substr ddd1 ddd2 1)
ddd4 (substr ddd1 1 (- ddd2 1))
vtx (strcat ddd4 “.” ddd3)
)
)
)
(if (= ddda “INT”)
(setq vtx (itoa vtx))
)
)
(defun c:LLL()
(setq ccc1 1 vvttx “” SAVV 0 dwg (getvar “dwgname”) dwglen (strlen dwg) cnt dwglen dname “” flag 1)
(while (and (= flag 1)(> cnt 0))
(setq ch (substr dwg cnt 1))
(if (or (= ch “/”)(= ch “\”)(= flag 0))
(setq flag 0 dname (substr dwg (+ cnt 1) (- dwglen cnt)))
)
(setq cnt (1- cnt))
(if (= flag 0)(setq dwg dname))
)
(SETQ xx1 (LIST 282.5 257) xx2 (LIST 297.5 262) xxx1 xx1 xxx2 xx2)
(repeat 41
(cxx)
(setq vtx1 vtx)
(if (= vtx1 “xxxxx”)(setq vtx1 vvtx1))
(setq vvtx1 vtx1)
(setq xx1 (polar xx1 0 15) xx2 (polar xx2 0 11))
(cxx) (setq vtx2 vtx)
(setq xx1 (polar xx1 0 11) xx2 (polar xx2 0 9))
(cxx) (setq vtx3 vtx)
(setq xx1 (polar xx1 0 9) xx2 (polar xx2 0 68))
(cxx) (setq vtx4 vtx)
(setq sss1 (substr vtx4 1 1))
(if (and (= vtx2 “xxxxx”)(= vtx3 “xxxxx”)(= sss1 “<")
)
(SETQ vvttx vtx4)
)
(if (and (= vtx2 “xxxxx”)(= vtx3 “xxxxx”))
(princ ccc1)
(progn
(setq stnx (strlen dwg)
stn1 (strlen vtx1) stn2 (strlen vtx2)
stn3 (strlen vtx3) stn4 (strlen vtx4)
stn6 (strlen vvttx)
stnnn ” “
ntxx (strcat ” ” dwg (substr stnnn 1 (- 9 stnx)))
ntx1 (strcat vtx1 (substr stnnn 1 (- 30 stn1)))
ntx2 (strcat vtx2 (substr stnnn 1 (- 20 stn2)))
ntx3 (strcat vtx3 (substr stnnn 1 (- 15 stn3)))
ntx4 (strcat vtx4 (substr stnnn 1 (- 60 stn4)))
ntx6 (strcat vvttx (substr stnnn 1 (- 15 stn6)))
vttx (strcat ntxx ntx6 ntx1 ntx2 ntx3 ntx4)
)
(setq wrfx ( open “bmbmbm.TXT” “a”))
(write-line vttx wrfx)
(close wrfx)
)
)
(princ “n”)
(setq xx1 (polar xxx1 (* pi 1.5) 5)
xx2 (polar xxx2 (* pi 1.5) 5)
xxx1 xx1 xxx2 xx2
ccc1 (+ ccc1 1)
)
)
)
공유