图面上的等高线和高程点的高程值之间的矛盾问题,通过程序检查是可以的,我的具体的思路是以每个高程点从0度至360度,按每隔30度循环,长度为10倍等高距做(SSGET "F" (LIST POINT1 POINT2))的集合,如果选择集有两根等高线,就判断两根等高线高程是递减还是递增,递减则判断高程值减等高距的值是否为两根等高线之间的高程值,递增则判断高程点的值加等高距是否为两根等高线之间的高程值,如存在不符合条件则判断等高线与高程点点线不符。当然,遇到陡坎等其它情况时会有意外,但对于等高线密集的地形图此方法很有效,比人工判断的效率还是高很多的,具体的源码如下:
(defun check_GCD_DGX (point_pt denggaoju) ;;;检查高程点与周围等高线的一致性 ;;;(check_GCD_DGX point_pt denggaoju) ;;;(setq point_pt (getpoint) denggaoju 0.5) (setq ang_setp 0.0 dgx_fxlist nil gcddgx_err T gcd_H (nth 2 point_pt)) (setq ang_i 0) (repeat 12 (setq point_pt1 (list (nth 0 point_pt) (nth 1 point_pt)) point_pt2 (polar (list (nth 0 point_pt) (nth 1 point_pt)) ang_setp (* 10.0 denggaoju))) (setq point_list (list point_pt1 point_pt2)) (setq dgx_s (ssget "F" point_list (list (cons -4 "<AND") (cons 0 "*POLYLINE") (cons -4 "<OR") (cons 8 "DGX") (cons 8 "OLD_DGX") (cons -4 "OR>") (cons -4 "AND>")))) (if dgx_s (progn (setq dgx_i 0 dgx0_list nil) (repeat (sslength dgx_s) (setq dgx_ename (ssname dgx_s dgx_i)) (setq dgx_handent (cdr (assoc 5 (entget dgx_ename)))) (setq dgx_object (vlax-ename->vla-object dgx_ename)) (setq dgx_gcz (vla-get-Elevation dgx_object)) (setq dgx0_list (append dgx0_list (list dgx_gcz))) (setq dgx_i (1+ dgx_i))) (if (/= dgx0_list nil) (progn (setq dgx_fxlist (append dgx_fxlist (list (list ang_i dgx0_list)))))))) (setq ang_setp (+ ang_setp (/ pi 3.0))) (setq ang_i (1+ ang_i))) (setq check_i 0) (while (< check_i (length dgx_fxlist)) (setq dgx0_list (nth check_i dgx_fxlist)) (if (> (length (cadr dgx0_list)) 1) (progn (setq dgx_1 (nth 0 (cadr dgx0_list)) dgx_2 (nth 1 (cadr dgx0_list))) (cond ((< dgx_1 dgx_2) (progn (if (or (< (+ gcd_H denggaoju) dgx_1) (> (+ gcd_H denggaoju) dgx_2)) (setq gcddgx_err nil check_i (length dgx_fxlist))))) ((> dgx_1 dgx_2) (progn (if (or (> (- gcd_H denggaoju) dgx_1) (< (- gcd_H denggaoju) dgx_2)) (setq gcddgx_err nil check_i (length dgx_fxlist))))) (t nil)))) (setq check_i (1+ check_i))) gcddgx_err) |