;|;==============================================================
功能 : 读取文本坐标文件,生成PL线。
文本坐标文件内容格式为:
Y1;X1
Y2;X2
Y3;X3
……
Yn;Xn
|;
;;;日期:zml84 于 2007-05-12
(defun c:GIS2PL (/ gisname gis str lst tmp x y point)
(if (setq gisname (getfiled "请选择GIS坐标数据文件" "" "GIS" 2))
(progn
(setvar "pdmode" 2)
(setvar "pdsize" -2)
(setq gis (open gisname "r"))
;;设置多段线宽度
(setvar "PLINEWID" 3.5)
;;开始绘制多段线
(command "_.pline")
(while (and (setq str (read-line gis))
(wcmatch str "*;*")
)
;;初始化
(setq lst '()
tmp ""
i 1
)
;;判断分割符 ; 的位置并切割
(while (/= (setq stri (substr str i 1)) "")
(if (= stri ";")
(setq lst (cons tmp lst)
tmp ""
)
(setq tmp (strcat tmp stri))
)
(setq i (1+ i))
)
(setq lst (reverse (cons tmp lst)))
;;形成点位坐标
(if (>= (length lst) 2)
(progn (setq x (atof (nth 0 lst))
y (atof (nth 1 lst))
point (list x y)
)
(command "non" point)
)
)
)
;;结束绘制
(command "c")
(close gis)
)
)
(princ)
)
;;;==============================================================
评论
想第一时间抢沙发么?