www.pudn.com > dmx.rar > dmx.lsp, change:2000-11-01,size:3769b


(defun c:dmx() 
(setq fname (getfiled "请输入地面线数据文件名:" "" "dat" 4)) 
(setq file (open fname "r")) 
(setq name (read-line file)) 
(setq pt1 (getpoint "请输入定位点:")) 
(setq pd2 (getstring "是否需要标注;不需要,请输入 N :")) 
(setq pt3 (polar pt1 (/ Pi 2) -50)) 
(setq pt4 (polar pt3 (/ Pi 2) 20)) 
(setq pt5 (polar pt1 (/ Pi 2) 30)) 
(setq pt5 (polar pt5 0 30)) 
(if (and (/= pd2 "n") (/= pd2 "N"))(command "text" "j" "m" pt5 5 0 name " "))  
(setq e (getvar "osmode")) 
(setvar "osmode" 0) 
(setq zh1 0) 
(setq zh2 0) 
(setq gch1 0) 
(setq gch2 0) 
(setq l 0) 
(setq h 0) 
(setq n1 0) 
(while (= n1 0) 
(setq c (read-line file)) 
(setq n (strlen c)) 
(setq i 1) 
(while (<= i n) 
(setq c1 (substr c i 1)) 
(if (and (or (< c1 "0") (> c1 "9")) (/= c1 ".") (/= c1 "-")) 
(setq i (+ i 1)) (setq n1 i  i (+ n 1))) 
) 
) 
(setq n2 n1) 
(setq i (+ n2 1)) 
(while (<= i n) 
(setq c1 (substr c i 1)) 
(if (or (and (>= c1 "0") (<= c1 "9")) (= c1 ".") (= c1 "-")) 
(setq i (+ i 1)) (setq n2 i  i (+ n 1))) 
) 
(if (= n2 n1) (setq n2 (+ n 1))) 
(setq c1 (substr c n1 (- n2 n1))) 
(setq n3 n2) 
(setq i (+ n3 1)) 
(while (<= i n) 
(setq c2 (substr c i 1)) 
(if (and (or (< c2 "0") (> c2 "9")) (/= c2 ".") (/= c2 "-")) 
(setq i (+ i 1)) (setq n3 i i (+ n 1))) 
 
) 
(while (= n3 n2) 
(setq c (read-line file)) 
(setq n (strlen c)) 
(setq i 1) 
(while (<= i n) 
(setq c2 (substr c i 1)) 
(if (and (or (< c2 "0") (> c2 "9")) (/= c2 ".") (/= c2 "-")) 
(setq i (+ i 1)) (setq n3 i i (+ n 1))) 
) 
) 
(setq n4 n3) 
(setq i (+ n4 1)) 
(while (<= i n) 
(setq c2 (substr c i 1)) 
(if (or (and (>= c2 "0") (<= c2 "9")) (= c2 ".") (= c2 "-")) 
(setq i (+ i 1)) (setq n4 i i (+ n 1))) 
) 
(if (and (= n4 n3) (> n3 n2)) (setq n4 (+ n 1))) 
(setq c2 (substr c n3 (- n4 n3)))  
(setq zh1 (atof c1)) 
(setq gch1 (atof c2)) 
(if (and (/= pd2 "n") (/= pd2 "N")) (command "text" "j" "m" pt3 2.5 90 c1 " ")) 
(if (and (/= pd2 "n") (/= pd2 "N")) (command "text" "j" "m" pt4 2.5 90 c2 " ")) 
(setq pd 0) 
(while (= pd 0) 
(setq n1 0) 
(while (= n1 0) 
(setq c (read-line file)) 
 
(setq n (strlen c)) 
(setq i 1) 
(while (<= i n) 
(setq c1 (substr c i 1)) 
(if (and (or (< c1 "0") (> c1 "9")) (/= c1 ".") (/= c1 "-")) 
(setq i (+ i 1)) (setq n1 i  i (+ n 1))) 
) 
) 
(setq n2 n1) 
(setq i (+ n1 1)) 
(while (<= i n) 
(setq c1 (substr c i 1)) 
(if (or (and (>= c1 "0") (<= c1 "9")) (= c1 ".") (= c1 "-")) 
(setq i (+ i 1)) (setq n2 i  i (+ n 1))) 
) 
(if (= n2 n1) (setq n2 (+ n 1))) 
(setq c1 (substr c n1 (- n2 n1))) 
(setq n3 n2) 
(setq i (+ n2 1)) 
(while (<= i n) 
(setq c2 (substr c i 1)) 
(if (and (or (< c2 "0") (> c2 "9")) (/= c2 ".") (/= c2 "-")) 
(setq i (+ i 1)) (setq n3 i i (+ n 1))) 
) 
(while (= n3 n2) 
(setq c (read-line file)) 
(setq n (strlen c)) 
(setq i 1) 
(while (<= i n) 
(setq c2 (substr c i 1)) 
(if (and (or (< c2 "0") (> c2 "9")) (/= c2 ".") (/= c2 "-")) 
(setq i (+ i 1)) (setq n3 i i (+ n 1))) 
) 
) 
(setq n4 n3) 
(setq i (+ n3 1)) 
(while (<= i n) 
(setq c2 (substr c i 1)) 
(if (or (and (>= c2 "0") (<= c2 "9")) (= c2 ".") (= c2 "-")) 
(setq i (+ i 1)) (setq n4 i i (+ n 1))) 
) 
(if (and (= n4 n3) (> n3 n2)) (setq n4 (+ n 1))) 
(setq c2 (substr c n3 (- n4 n3)))  
(setq zh2 (atof c1)) 
(setq gch2 (atof c2)) 
(setq l (+ l (- zh2 zh1))) 
(setq h (+ h (- gch2 gch1))) 
(setq pt2 (polar pt1 0 (- zh2 zh1))) 
(setq pt3 (polar pt3 0 (- zh2 zh1))) 
(setq pt4 (polar pt4 0 (- zh2 zh1))) 
(setq pt2 (polar pt2 (/ Pi 2) (- gch2 gch1))) 
(if (and (/= pd2 "n") (/= pd2 "N")) (command "text" "j" "m" pt3 2.5 90 c1 " ")) 
(if (and (/= pd2 "n") (/= pd2 "N")) (command "text" "j" "m" pt4 2.5 90 c2 " ")) 
(if (/= pt1 pt2) (command "line" pt1 pt2 "")) 
(if (= pt1 pt2) (setq pd 1)) 
(setq pt1 pt2) 
(setq zh1 zh2) 
(setq gch1 gch2) 
) 
(close file) 
(setvar "osmode" e) 
)