- ;;;本程序命令为hdmout,仅针对图纸比例为1:1的情况而言,若比例不是1:1,请自行调整图纸比例
- ;;;本程序需选择断面桩号、坐标系基准中心、选择基准中心处的断面高程数据
- ;;;本程序所获得的数据为追加形式,一次采取一条断面,可以累加
- (defun c:hdmout (/ s filename e n fn jd pt pts number str_1)
- (vl-load-com)
- (setq str_1 (cdr (assoc 1(entget (car (entsel "请选择一个断面桩号:"))))))
- (setq point_1 (getpoint "\n 请选择坐标系基准中心位置"))
- (setq px_1 (car point_1)
- py_1 (cadr point_1))
- (setq e55 (cdr (assoc 1 (entget (car (entsel "\n 请选取该断面的中心高程数据:"))))))
- (setq bb (vl-string->list e55))
- (setq cc (vl-remove-if '(lambda (x) (> x 57)) bb))
- (setq de (vl-remove-if '(lambda (x) (< x 43)) cc))
- (setq height_1 (atof (vl-list->string de)))
- (if (setq s (ssget ":S" '((0 . "*POLYLINE")))) ;_点选带过滤形式
- (progn
- (setq e (ssname s 0)
- number (fix (vlax-curve-getendparam e))
- n (+ 1 number)
- )
- (if (not (setq filename
- (getfiled "选择文件存储目录" "d:/断面线数据.txt" "txt" 33)
- )
- )
- (setq filename "c:\\断面线数据.txt")
- )
- (setq fn (open filename "a")
- jd n
- )
- (WRITE-LINE str_1 fn)
- (setvar "dimdec" 3)
- (repeat n
- (setq pt (vlax-curve-getpointatparam e (setq jd (1- jd))))
- (if (null pts)
- (setq pts (list pt))
- (if (not (equal pt (car pts) 1e-3))
- (setq pts (cons pt pts))
- )
- )
- )
- (setq n 1)
- (mapcar '(lambda (x)
- (write-line
- (strcat (itoa n)
- ","
- (rtos (- (car x) px_1))
- ","
- (rtos (+ height_1 (- (cadr x) py_1))) ;_与前面的 dimzin 配合采用用户 UNITS 精度设置
- )
- fn
- )
- (setq n (1+ n))
- )
- pts
- )
- (close fn)
- )
- )
- (princ"\n")
- )
|