不知道行不行 - ;;; 命令tuh dxt rdx dx5k rdx5k tuh5k
- ;;; 引入地形图,先引用1:500,没有再引用1:1000
- (defun c:dxt (/ po x y mpname1000)
- (setvar "cmdecho" 0)
- (while (setq po (getpoint "\n拾取一点插入地形,右键退出:"))
- (setq x (car po) y (cadr po))
- (calth1000 y x)
- (setq mpname1000 (strcat "E:/2014/2/" strmapname ".dwg"))
- (if (findfile mpname1000)
- (command "xref" "" mpname1000 "0,0,0" "" "" "")
- (princ "\nSorry,无此处1000比例的地形图\n")
- )
- )
- (princ)
- )
- ;;; 退出引用的地形图
- (defun c:rdx (/ po1 x y mpname1000 strmapname1000 )
- (setvar "cmdecho" 0)
- (while (setq po1 (getpoint "\n拾取一点卸载地形,右键退出:"))
- (setq x (car po1) y (cadr po1))
- (calth1000 y x)
- (setq mpname1000 strmapname)
- (setq strmapname1000 (strcat "E:/2014/2/" strmapname ".dwg" ))
- (if (findfile strmapname1000)
- (command "xref" "d" mpname1000)
- )
- )
- (princ)
- )
- ;;; ===========
- ;;; make sure this point within the map,so as to calculate the tkname correctly
- ;;; 图名
- (defun sheetid (); calculate the first letter of the sheetID
- (setq istate1 (fix (/ fy 1000)))
- (setq strmapname (itoa istate1))
- (setq istate2 (fix (/ fx 100)))
- (setq istate00 (/ (- istate2 672) 8))
- (if (/= istate00 (fix istate00))
- (setq strmapname (strcat strmapname "-" (itoa (fix (+ (* (fix istate00) 0.8) 67.2)))))
- (setq strmapname (strcat strmapname "-" (itoa istate2)))
- )
- )
- ;;; 计算1000的图号
- (defun calth1000 (fx fy / istate5 istate3 istate4)
- (sheetid)
- (setq istate5 (- (fix (/ fx 80)) (* (fix (/ fx 800)) 10)))
- (setq istate3 (- (fix (/ fy 100)) (* (fix (/ fy 1000)) 10)))
- (if (and (= istate5 7) (= istate3 0)) (setq istate4 "1"))
- (if (and (= istate5 7) (= istate3 2)) (setq istate4 "2"))
- (if (and (= istate5 7) (= istate3 5)) (setq istate4 "3"))
- (if (and (= istate5 7) (= istate3 7)) (setq istate4 "4"))
- (if (and (= istate5 5) (= istate3 0)) (setq istate4 "5"))
- (if (and (= istate5 5) (= istate3 2)) (setq istate4 "6"))
- (if (and (= istate5 5) (= istate3 5)) (setq istate4 "7"))
- (if (and (= istate5 5) (= istate3 7)) (setq istate4 "8"))
- (if (and (= istate5 2) (= istate3 0)) (setq istate4 "9"))
- (if (and (= istate5 2) (= istate3 2)) (setq istate4 "10"))
- (if (and (= istate5 2) (= istate3 5)) (setq istate4 "11"))
- (if (and (= istate5 2) (= istate3 7)) (setq istate4 "12"))
- (if (and (= istate5 0) (= istate3 0)) (setq istate4 "13"))
- (if (and (= istate5 0) (= istate3 2)) (setq istate4 "14"))
- (if (and (= istate5 0) (= istate3 5)) (setq istate4 "15"))
- (if (and (= istate5 0) (= istate3 7)) (setq istate4 "16"))
- (setq strmapname (strcat strmapname "-" istate4))
- ;(princ (strcat "图号" strmapname "ok\n"))
- )
- (princ)
|