[求助]求助横断面格式转换lsp程序
<p><font face="Verdana">;;;多行格式<br/>0+100 <br/>-10,1110.474<br/>-8,1109.589<br/>-5,1108.375<br/>0,1107.932<br/>4.1,1107.981<br/>8.1,1109.686<br/>12.1,1110.859<br/>15,1110.725</font></p><p>0+200</p>
<p>........</p>
<p>........</p>
<p>2+400</p>
<p><font face="Verdana">;;;三行格式</font><font face="Verdana"><br/>0+100,1107.932<br/>-5.000,1108.375,-8.000,1109.589,-10.000,1110.474,<br/>4.100,1107.981,8.100,1109.686,12.100,1110.859,15,1110.725</font></p>
<p><font face="Verdana">0+200</font></p><font face="Verdana">
<p>........</p>
<p>........</p>
<p>2+400<br/>;;;单行格式<br/>0+100,0,1107.932,-5,1108.375,-8,1109.589,-10,1110.474,4.1,1107.981,8.1,1109.686,12.1,1110.859,15,1110.725</p>
<p></font> </p>
<p><font face="Verdana">0+200</font></p>
<p>........</p>
<p>........</p>
<p>2+400</p>
<p> </p>
<p>求助横断面格式转换lsp程序,因为各个软件要求格式不一样,怎么可以使上面三种格式互相转换呢,数据为文本格式,里面有多个横断面,每个横断面的点数可能不一样多,困扰多时求各位兄弟帮忙解决</p> 本帖最后由 004 于 2013-1-8 18:51 编辑
以前写了纬地和cass断面的互转.
;;0042hd-cass-123.lspwkq004 2011-05-05
(defun c:zh (/ F F2 F3 H PJGC WZ X YGC YPJ ZGC ZLIST ZPJ ZZ ZZN)
;;;(command "osmode" "0")
(setq f2 (open "e:\\002.hdm" "w"))
(setq f3 (open "e:\\003.txt" "w"))
(setq f
(open (strcat
(getfiled "选择文件==>"
"e:\\"
"dmx"
8
)
)
"r"
)
)
(setq h (read-line f))
(setq h (read-line f))
(setq h (read-line f))
(setq zzn 1)
(setq zz (read-line f))
(while zz
(write-line (strcat "BEGIN," zz ":" (itoa zzn)) f2)
(setq gaocheng (getreal (strcat "输入" zz "高程:")))
(setq zlist (list))
(setq h (read-line f)) ;_hang
(while h
(setq wz (vl-string-search " " h)) ;_wei zhi
(setq zpj (substr h 1 wz)) ;_ping ju
(setq h (substr h (+ 2 wz)))
(if (setq wz (vl-string-search "," h))
(progn
(setq zgc (substr h 1 wz)) ;_gao cha
(setq h (substr h (+ 3 wz)))
)
(progn
(setq zgc h)
(setq h nil)
)
)
(setq pjgc (strcat "-" zpj "," (rtos(- gaocheng (atof zgc)) 2 3)));ping ju gao cha
(setq zlist (cons pjgc zlist))
)
(mapcar '(lambda (x)
(write-line x f2)
)
zlist
)
(write-line (strcat"0.000," (rtos gaocheng 2 3)) f2)
(setq h (read-line f)) ;_hang
(while h
(setq wz (vl-string-search " " h)) ;_wei zhi
(setq ypj (substr h 1 wz)) ;_ping ju
(setq h (substr h (+ 2 wz)))
(if (setq wz (vl-string-search "," h))
(progn
(setq ygc (substr h 1 wz)) ;_gao cha
(setq h (substr h (+ 3 wz)))
)
(progn
(setq ygc h)
(setq h nil)
)
)
(write-line (strcat "" ypj "," (rtos (- gaocheng (atof ygc)) 2 3)) f2)
)
(setq zz (read-line f))
(setq zzn (+ 1 zzn))
)
(close f)
(close f2)
(close f3)
(princ)
)
;;0045cass-hd-123.lsp wkq004 2011-05-05
(defun c:tt (/ D1 D2 F F2 YB ZB ZH D1 D2 F H WZ)
(command "osmode" "0")
(setq f2 (open "e:\\002.dmx" "w"))
(setq f
(open (strcat
(getfiled "选择文件==>"
"e:\\"
"hdm"
8
)
)
"r"
)
)
(write-line "//平距和高差都相对中桩坐标" f2)
(write-line "//数据顺序为:先平距后高差" f2)
(write-line
"//////////////////////////////////////////////////////////////////////////"
f2
)
(setq yb "")
(setq zb "")
(while (dh)
(cond ((= d1 "BEGIN")
(progn (setq zh (substr d2 1 (vl-string-search ":" d2)))
(if (/= "" yb)
(write-line (substr yb 1 (- (strlen yb) 2)) f2)
)
(setq yb "")
(write-line zh f2)
)
)
((= d1 "0.000")
(progn (if (/= "" zb)
(write-line (substr zb 1 (- (strlen zb) 2)) f2)
)
(setq zb "")
)
)
((= "-" (substr d1 1 1))
(setq zb (strcat (substr d1 2) " " d2 "," " " zb))
)
(t (setq yb (strcat yb d1 " " d2 "," " ")))
)
)
(if yb
(write-line (substr yb 1 (- (strlen yb) 2)) f2)
)
(close f)
(close f2)
(princ)
)
(defun dh ()
(if (setq h (read-line f))
(progn (setq wz (vl-string-search "," h)) ;_wei zhi
(setq d1 (substr h 1 wz)) ;_ping ju
(setq d2 (substr h (+ 2 wz)))
)
)
)
<p>你这是把CASS的断面转成纬地数据格式的断面嘛?</p> <p>你这是把CASS的断面转成纬地数据格式的断面嘛?</p> <p>楼上的兄弟用的什么软件啊,可否告知啊</p> 用的是什么软件呀 用的是什么软件啊? 没用过纬地,给楼上鼓掌 纬地不知道好不好用? 236004 发表于 2010-11-26 12:39 static/image/common/back.gif
你这是把CASS的断面转成纬地数据格式的断面嘛?
用的什么软件?
页:
[1]