|
本帖最后由 zhb236623 于 2012-4-15 09:03 编辑
- ;;获取多义线点坐标
- (defun c:gp1()
- (princ"函数功能:获取多义线点坐标. ")
- (setvar "cmdecho" 0)
- (setq ffn (getfiled "选取文件" "D:/temp/" "txt" 1))
- (setq ff (open ffn "w"))
- (close ff)
- (princ "\n选取PLINE多义线...")
- (setq ss (ssget))
- (setq i 0)
- (setvar "pdmode" 33)
- (repeat (sslength ss)
- (setq ssn (ssname ss i))
- (setq endata (entget ssn))
- (setq n 0)
- (repeat (length endata)
- (setq pp (nth n endata))
- (setq key (car pp))
- (if (= key 10)
- (progn
- (setq x_temp (cadr pp))
- (setq y_temp (caddr pp))
- (setq x (rtos x_temp 2 4)) ;;把x后小数点变为四位输出
- (setq y (rtos y_temp 2 4)) ;;把y后小数点变为四位输出
- ;;(command "point" (list x y))
- (setq ff (open ffn "a"))
- (princ "," ff)
- (princ x ff)
- (princ "," ff)
- (princ y ff)
- (princ "\n" ff)
- (close ff)
- )
- )
- (setq n (1+ n))
- )
- ;;(setq ff (open ffn "a"))
- ;;(princ "End\n" ff)
- ;;(close ff)
- (setq i (1+ i))
- )
- (princ (strcat "\n文件写至=> " ffn))
- (prin1)
- )
复制代码 把文本文件改为aa.txt->aa.csv 在第一列加点号就可以了。再改为aa.txt就可以导入RTK 本人用LEICA 1200可用,节省大量输点时间。。。。。。。。。。。
- (defun c:gp1()
- (princ"函数功能:获取多义线点坐标. ")
- (setvar "cmdecho" 0)
- (setq ffn (getfiled "选取文件" "D:/zhb/" "txt" 1))
- (setq ff (open ffn "w"))
- (close ff)
- (princ "\n选取PLINE多义线...")
- (setq ss (ssget))
- (setq i 0)
- (setq ii 1) ;;输出点号
- (setvar "pdmode" 33)
- (repeat (sslength ss)
- (setq ssn (ssname ss i))
- (setq endata (entget ssn))
- (setq n 0)
- (repeat (length endata)
- (setq pp (nth n endata))
- (setq key (car pp))
- (if (= key 10)
- (progn
- (setq x_temp (cadr pp))
- (setq y_temp (caddr pp))
- (setq x (rtos x_temp 2 3)) ;;把x后小数点变为四位输出
- (setq y (rtos y_temp 2 3)) ;;把y后小数点变为四位输出
- (setq iii (itoa ii))
- (setq ff (open ffn "a"))
- (princ iii ff)
- (princ "," ff)
- (princ x ff)
- (princ "," ff)
- (princ y ff)
- (princ "\n" ff)
- (close ff)
- (setq ii (1+ ii))
- )
- )
- (setq n (1+ n))
- )
- (setq ii ii)
- (setq i (1+ i))
- )
- (princ (strcat "\n文件写至=> " ffn))
- (prin1)
- )
复制代码 重新放上新程序,导出点坐标格式为
1,554892.782,2742945.704
2,553892.142,2742845.120
这个格式可以直接放到LEICA RTK 1200里面,然后放样用。
|
|