(or mai_cehui_gcd_blk
    (mai_load_files (mai_panel_search "谜你测绘功能设置文件.lsp"))
)

; CASS横断面数据转高程[mini_dmsjzgc].lsp

;;;;;;;;;;;;;;;
(defun c:mini_dmsjzgc ( / read_File oldcmd a obj lst ang height pt y x )

;;;;;;;;===========================================
(defun read_File ( fn / f lst ll )
	(and
		(setq f (findfile fn))
		(setq f (open f "r"))
		(progn
			(while
				(setq lst (read-line f))
				(setq ll (if (= (ascii lst) 98) (vl-list* lst "k" ll) (cons lst ll))) 
			)
		(close f)
		)
	)
	(reverse (cdr (reverse (cons "k" ll))))
)
	(mini_start nil)
	(mai_last_com "mini_dmsjzgc")
	(setq obj (car (mai_entsel nil "选择道路中心线:<回车退出>" "选择的不是多段线、线、圆或弧." '((0 . "*Polyline,line,arc,circle,spline,ellipse")) nil)))
	(or obj (exit))
	(or (setq a (getreal "\n请输入起点桩号:<0>"))
		(setq a 0)
	)
	(mai_get_scale)
	(or (setq lst (mai_GetFile "请选取南方CASS横断面数据文件：" mai_mini_path "hdm"))
		(exit)
	)
	(setq
		lst (read_File lst)
		lst (vl-remove
				nil
				(mapcar
					'(lambda (x) (reverse (cdr x)))
					(mai_list_divide_if lst '(lambda(x)(= "k" x)))
				)
			)
	)
	(or lst (exit))
	(apply 'mai_create_layer mai_cehui_gcd_blk)

	(foreach x lst
		(setq
			ang (distof (cadr (mai_str2lst (car x) ",")))
			pt (vlax-curve-getpointatdist obj (- ang a))
			ang (vlax-curve-getfirstderiv obj
					(vlax-curve-getparamatpoint obj
						(vlax-curve-getclosestpointto obj pt t)
					)
				)
			ang (angle '(0 0) (mai_3p_2p ang))
		)
		(foreach y (cdr x)
			(setq
				y (mai_str2lst y ",")
				pt (polar pt (- ang (* 0.5 pi)) (distof (car y)))
				height (distof (cadr y))
			)
			(gxl_cs:gcd (list (car pt) (cadr pt) height) height mai_scale2 2 (car mai_cehui_gcd_blk))
		)
	)
	(mai_end)
)
