明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 5436|回复: 9

[源码] [求助]求助横断面格式转换lsp程序

[复制链接]
发表于 2010-11-26 11:26:00 | 显示全部楼层 |阅读模式

;;;多行格式
0+100 
-10,1110.474
-8,1109.589
-5,1108.375
0,1107.932
4.1,1107.981
8.1,1109.686
12.1,1110.859
15,1110.725

0+200

........

........

2+400

;;;三行格式
0+100,1107.932
-5.000,1108.375,-8.000,1109.589,-10.000,1110.474,
4.100,1107.981,8.100,1109.686,12.100,1110.859,15,1110.725

0+200

........

........

2+400
;;;单行格式
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

 

0+200

........

........

2+400

 

求助横断面格式转换lsp程序,因为各个软件要求格式不一样,怎么可以使上面三种格式互相转换呢,数据为文本格式,里面有多个横断面,每个横断面的点数可能不一样多,困扰多时求各位兄弟帮忙解决

"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2013-1-8 18:46:04 | 显示全部楼层
本帖最后由 004 于 2013-1-8 18:51 编辑

以前写了纬地和cass断面的互转.
  1. ;;0042hd-cass-123.lsp  wkq004 2011-05-05

  2. (defun c:zh (/ F F2 F3 H PJGC WZ X YGC YPJ ZGC ZLIST ZPJ ZZ ZZN)
  3. ;;;  (command "osmode" "0")
  4.   (setq f2 (open "e:\\002.hdm" "w"))
  5.   (setq f3 (open "e:\\003.txt" "w"))
  6.   (setq        f
  7.          (open (strcat
  8.                  (getfiled "选择文件==>"
  9.                            "e:\\"
  10.                            "dmx"
  11.                            8
  12.                  )
  13.                )
  14.                "r"
  15.                
  16.          )
  17.   )
  18.   
  19.   (setq h (read-line f))
  20.   (setq h (read-line f))
  21.   (setq h (read-line f))

  22.   (setq zzn 1)
  23.   (setq zz (read-line f))
  24.   (while zz
  25.     (write-line (strcat "BEGIN," zz ":" (itoa zzn)) f2)
  26.     (setq gaocheng (getreal (strcat "输入" zz "高程:")))
  27.     (setq zlist (list))
  28.     (setq h (read-line f)) ;_hang
  29.     (while h
  30.       (setq wz (vl-string-search "        " h)) ;_wei zhi
  31.       (setq zpj (substr h 1 wz)) ;_ping ju
  32.       (setq h (substr h (+ 2 wz)))
  33.       (if (setq wz (vl-string-search "," h))
  34.         (progn
  35.           (setq zgc (substr h 1 wz)) ;_gao cha
  36.           (setq h (substr h (+ 3 wz)))
  37.         )
  38.         (progn
  39.           (setq zgc h)
  40.           (setq h nil)
  41.         )
  42.       )
  43.       (setq pjgc (strcat "-" zpj "," (rtos  (- gaocheng (atof zgc)) 2 3)));ping ju gao cha
  44.       (setq zlist (cons pjgc zlist))
  45.     )
  46.     (mapcar '(lambda (x)
  47.                (write-line x f2)
  48.              )
  49.             zlist
  50.     )
  51.     (write-line (strcat"0.000," (rtos gaocheng 2 3)) f2)
  52.     (setq h (read-line f)) ;_hang
  53.     (while h
  54.       (setq wz (vl-string-search "        " h)) ;_wei zhi
  55.       (setq ypj (substr h 1 wz)) ;_ping ju
  56.       (setq h (substr h (+ 2 wz)))
  57.       (if (setq wz (vl-string-search "," h))
  58.         (progn
  59.           (setq ygc (substr h 1 wz)) ;_gao cha
  60.           (setq h (substr h (+ 3 wz)))
  61.         )
  62.         (progn
  63.           (setq ygc h)
  64.           (setq h nil)
  65.         )
  66.       )
  67.       (write-line (strcat "" ypj "," (rtos (- gaocheng (atof ygc)) 2 3)) f2)
  68.     )
  69.     (setq zz (read-line f))
  70.     (setq zzn (+ 1 zzn))
  71.   )
  72.   (close f)
  73.   (close f2)
  74.   (close f3)
  75.   (princ)
  76. )


  1. ;;0045cass-hd-123.lsp   wkq004 2011-05-05
  2. (defun c:tt (/ D1 D2 F F2 YB ZB ZH D1 D2 F H WZ)
  3.   (command "osmode" "0")
  4.   (setq f2 (open "e:\\002.dmx" "w"))
  5.   (setq        f
  6.          (open (strcat
  7.                  (getfiled "选择文件==>"
  8.                            "e:\\"
  9.                            "hdm"
  10.                            8
  11.                  )
  12.                )
  13.                "r"
  14.          )
  15.   )
  16.   (write-line "//平距和高差都相对中桩坐标" f2)
  17.   (write-line "//数据顺序为:  先平距后高差" f2)
  18.   (write-line
  19.     "//////////////////////////////////////////////////////////////////////////"
  20.     f2
  21.   )
  22.   (setq yb "")
  23.   (setq zb "")
  24.   (while (dh)
  25.     (cond ((= d1 "BEGIN")
  26.            (progn (setq zh (substr d2 1 (vl-string-search ":" d2)))
  27.                   (if (/= "" yb)
  28.                     (write-line (substr yb 1 (- (strlen yb) 2)) f2)
  29.                   )
  30.                   (setq yb "")
  31.                   (write-line zh f2)
  32.            )
  33.           )
  34.           ((= d1 "0.000")
  35.            (progn (if (/= "" zb)
  36.                     (write-line (substr zb 1 (- (strlen zb) 2)) f2)
  37.                   )
  38.                   (setq zb "")
  39.            )
  40.           )
  41.           ((= "-" (substr d1 1 1))
  42.            (setq zb (strcat (substr d1 2) "        " d2 "," "        " zb))
  43.           )
  44.           (t (setq yb (strcat yb d1 "        " d2 "," "        ")))
  45.     )
  46.   )
  47.   (if yb
  48.     (write-line (substr yb 1 (- (strlen yb) 2)) f2)
  49.   )
  50.   (close f)
  51.   (close f2)
  52.   (princ)
  53. )
  54. (defun dh ()
  55.   (if (setq h (read-line f))
  56.     (progn (setq wz (vl-string-search "," h)) ;_wei zhi
  57.            (setq d1 (substr h 1 wz)) ;_ping ju
  58.            (setq d2 (substr h (+ 2 wz)))
  59.     )
  60.   )
  61. )

回复 支持 1 反对 0

使用道具 举报

发表于 2010-11-26 12:39:00 | 显示全部楼层

你这是把CASS的断面转成纬地数据格式的断面嘛?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
回复 支持 1 反对 0

使用道具 举报

发表于 2010-11-26 12:35:00 | 显示全部楼层

你这是把CASS的断面转成纬地数据格式的断面嘛?

 楼主| 发表于 2010-11-26 14:00:00 | 显示全部楼层

楼上的兄弟用的什么软件啊,可否告知啊

发表于 2011-3-25 23:41:44 | 显示全部楼层
用的是什么软件呀
发表于 2012-8-6 10:38:53 | 显示全部楼层
用的是什么软件啊?
发表于 2013-1-8 19:11:49 | 显示全部楼层
没用过纬地,给楼上鼓掌
发表于 2013-7-25 11:21:15 | 显示全部楼层
纬地不知道好不好用?
发表于 2016-7-7 12:56:58 | 显示全部楼层
236004 发表于 2010-11-26 12:39
你这是把CASS的断面转成纬地数据格式的断面嘛?

用的什么软件?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-20 08:39 , Processed in 0.243096 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表