- 积分
- 2441
- 明经币
- 个
- 注册时间
- 2012-2-22
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2024-5-30 14:33:29
|
显示全部楼层
用于绘制地形图时,用GPS测一个井位坐标,给一个代码,绘制时自动绘制 .例:1,DJ, Y , X , Z
;;; 功能:坐标数据展点,并展绘独立地物符号。
;;; 日期:20211230 ZHAOLIBING 20230523修改
(vl-load-com)
(defun C:ZH( / FILE i zn MN moden IN XN YN F1 STR str1 LST zdm)
(UseLimit)
(setvar "cmdecho" 0)
(setq mode (getstring "\n 默认标准CASS展点格式:非标准[排序(切换大写,例:IYXZM)编号(I),X值(X),Y值(Y),Z值(Z),DM(M)]:" ))
(setq zdm (getstring "\n 帅哥是否需要展绘符号:[不展绘输入:1 ,展绘 直接回车]" ))
(if (OR (= zdm NIL) (= zdm ""))
(setq zdm "")
)
;(princ "\n读取全站仪文件数据,绘制点位。")
(setq FILE (getfiled "选择.dat.txt文件" "" "dat;txt" 4))
(if (OR (= mode NIL) (= mode ""))
(setq mode "IMYXZ")
)
(setq i 1)
(setq zn "")
(setq MN "")
(setq moden (strlen mode))
(while ( <= i moden)
(cond ((= (substr mode i 1) "I") (setq IN (- i 1)))
((= (substr mode i 1) "X") (setq XN (- i 1)))
((= (substr mode i 1) "Y") (setq YN (- i 1)))
((= (substr mode i 1) "Z") (setq ZN (- i 1)))
((= (substr mode i 1) "M") (setq MN (- i 1)))
)
(setq i( + i 1))
);while
;;读模式打开lsp文件
(setq F1 (open FILE "r"))
;;逐行读入
(while (setq STR (read-line F1))
(setq str1 (str-th str '(("," " "))))
(setq LST (read (strcat "(" STR1 ")")))
(if (>= (length lst) moden)
(progn
(setq id (nth IN lst))
(setq x (nth XN lst))
(setq y (nth YN lst))
(if (/= ZN "")(setq z (nth ZN lst)) (setq z 0))
(if (/= MN "")(setq dm (nth MN lst)))
(setq pt (list y x z))
;;输出操作
(command "layer" "make" "中土点号" "c" "5" "中土点号" "")
(command "_.point" "non" PT)
(command "_.text" "non" PT 0.5 0 (vl-princ-to-string (nth IN lst)))
(command "layer" "make" "中土代码" "c" "4" "中土代码" "")
(command "_.point" "non" PT)
(if (/= MN "")
(command "_.text" "non" PT 0.5 0 (vl-princ-to-string (nth MN lst)))
)
;以下为规律 每行一个类别 可以编辑
; 关键字 块名 颜色、图层 cass编码
(cond
( ( and (/= zdm "1") (or (= (vl-princ-to-string (nth MN lst)) "YJ") (= (vl-princ-to-string (nth MN lst)) "6"))) (entmake-dzw "gc053" pt 2 "GXYZ" '((-3 ("SOUTH" (1000 . "175101"))))));雨水#
( ( and (/= zdm "1") (or (= (vl-princ-to-string (nth MN lst)) "WJ") (= (vl-princ-to-string (nth MN lst)) "5"))) (entmake-dzw "gc043" pt 2 "GXYZ" '((-3 ("SOUTH" (1000 . "174200"))))));污水#
( ( and (/= zdm "1") (or (= (vl-princ-to-string (nth MN lst)) "XJ") (= (vl-princ-to-string (nth MN lst)) "8"))) (entmake-dzw "gc048" pt 2 "GXYZ" '((-3 ("SOUTH" (1000 . "174601"))))));电信#
( ( and (/= zdm "1") (or (= (vl-princ-to-string (nth MN lst)) "SJ") (= (vl-princ-to-string (nth MN lst)) "4"))) (entmake-dzw "gc042" pt 2 "GXYZ" '((-3 ("SOUTH" (1000 . "174100"))))));给水#
( ( and (/= zdm "1") (or (= (vl-princ-to-string (nth MN lst)) "ZSJ") (= (vl-princ-to-string (nth MN lst)) "4"))) (entmake-dzw "gc042" pt 2 "GXYZ" '((-3 ("SOUTH" (1000 . "174100"))))));中水井#
( ( and (/= zdm "1") (or (= (vl-princ-to-string (nth MN lst)) "XF") (= (vl-princ-to-string (nth MN lst)) "3"))) (entmake-dzw "gc133" pt 2 "GXYZ" '((-3 ("SOUTH" (1000 . "175200"))))));消防栓
( ( and (/= zdm "1") (or (= (vl-princ-to-string (nth MN lst)) "DJ") (= (vl-princ-to-string (nth MN lst)) "1"))) (entmake-dzw "gc050" pt 2 "GXYZ" '((-3 ("SOUTH" (1000 . "174700"))))));电力#
( ( and (/= zdm "1") (or (= (vl-princ-to-string (nth MN lst)) "RQ") (= (vl-princ-to-string (nth MN lst)) "7"))) (entmake-dzw "gc046" pt 2 "GXYZ" '((-3 ("SOUTH" (1000 . "174400"))))));燃气#
( ( and (/= zdm "1") (or (= (vl-princ-to-string (nth MN lst)) "RJ") (= (vl-princ-to-string (nth MN lst)) "2"))) (entmake-dzw "gc047" pt 2 "GXYZ" '((-3 ("SOUTH" (1000 . "174500"))))));热力#
( ( and (/= zdm "1") (or (= (vl-princ-to-string (nth MN lst)) "DX") (= (vl-princ-to-string (nth MN lst)) "9"))) (entmake-dzw "gc129" pt 2 "GXYZ" '((-3 ("SOUTH" (1000 . "171802"))))));小电箱
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "BZ")) (entmake-dzw "gc041" pt 2 "GXYZ" '((-3 ("SOUTH" (1000 . "175102"))))));雨篦子
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "WM")) (entmake-dzw "gc188" pt 2 "GXYZ" '((-3 ("SOUTH" (1000 . "174900"))))));不明#
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "SLT")) (entmake-dzw "gc135" pt 2 "GXYZ" '((-3 ("SOUTH" (1000 . "175400"))))));水龙头
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "DLZ")) (entmake-dzw "gc234" pt 2 "GXYZ" '((-3 ("SOUTH" (1000 . "171103"))))));电缆桩
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "DF")) (entmake-dzw "gc110" pt 11 "DLDW" '((-3 ("SOUTH" (1000 . "158701"))))));独立坟头
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "ZSD")) (entmake-dzw "gc019" pt 11 "DLDW" '((-3 ("SOUTH" (1000 . "155221"))))));射灯
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "SD")) (entmake-dzw "gc097" pt 11 "DLDW" '((-3 ("SOUTH" (1000 . "158701"))))));双灯
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "HD")) (entmake-dzw "gc037" pt 4 "DLSS" '((-3 ("SOUTH" (1000 . "165102"))))));涵洞
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "DD")) (entmake-dzw "gc203" pt 4 "DLSS" '((-3 ("SOUTH" (1000 . "162500"))))));单路灯
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "LB")) (entmake-dzw "gc052" pt 4 "DLSS" '((-3 ("SOUTH" (1000 . "165603"))))));路标
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "TT")) (entmake-dzw "gc063" pt 4 "DLSS" '((-3 ("SOUTH" (1000 . "168600"))))));监控
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "HLD")) (entmake-dzw "gc076" pt 4 "DLSS" '((-3 ("SOUTH" (1000 . "165604"))))));红绿灯
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "GLZ")) (entmake-dzw "gc038" pt 4 "DLSS" '((-3 ("SOUTH" (1000 . "165601"))))));公路桩
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "DS")) (entmake-dzw "gc143" pt 3 "ZBTZ" '((-3 ("SOUTH" (1000 . "213801"))))));单树
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "GS")) (entmake-dzw "gc145" pt 3 "ZBTZ" '((-3 ("SOUTH" (1000 . "213803"))))));单果
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "SS")) (entmake-dzw "gc144" pt 3 "ZBTZ" '((-3 ("SOUTH" (1000 . "213802"))))));单松
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "X")) (entmake-dzw "gc107" pt 11 "DLDW" '((-3 ("SOUTH" (1000 . "156302"))))));雕像
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "QG")) (entmake-dzw "gc098" pt 11 "DLDW" '((-3 ("SOUTH" (1000 . "156400"))))));旗杆
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "KG")) (entmake-dzw "gcbj0117" pt 4 "COMPONENT" '((-3 ("SOUTH" (1000 . "340117"))))));空杆
( ( and (/= zdm "1")(= (vl-princ-to-string (nth MN lst)) "JJ")) (entmake-dzw "gc146" pt 5 "SXSS" '((-3 ("SOUTH" (1000 . "185102"))))));机井
);cond
)
(princ (strcat "\n数据不完整:" str1))
)
) ;_结束 while
;;关闭文件
(close F1)
(princ)
) ;_ 结束defun
;;;=============================================================
|
|