(setq e (ssget"X" (list (cons 0 "LWPOLYLINE"))))
(setq sh (sslength e))
(if e
(while (< n sh)
(setq e1 (ssname e n))
(command "pedit" e1 "d" "")
(setq x (entget e1))
(setq ngc (atof (setq la (fld 8 x))))
(command "explode" e1)
(setq n (+ n 1))
) ) )
(defun fld (num lst)
(cdr (assoc num lst))
)
(defun c:spltol ()
;SPLINE转化为LINE
(setq n 0)
(setq e (ssget "X" (list (cons 0 "SPLINE"))))
(setq sh (sslength e))
(if e
(while (< n sh)
(setq x (entget (setq e1 (ssname e n))))
(setq nla (itoa (fix (caddr (fld 10 x)))))
(if (= (fld 0 x) "SPLINE")
(progn
(command "layer" "n" nla "c"
"6" nla "s" nla "")
(command"line")
(setq nm (length x)
dzs (fld 73 x) dzs1 (fld 74 x))
(while (> nm 5)
(if (= (car (nth nm x)) 10)
(progn
(setq b1 (nth nm x))
(setq x1 (cadr b1))
(setq y1 (caddr b1))
(setq z1 (cadddr b1))
(setq glb (list x1 y1))
(command glb)
) )
(setq nm (- nm 1))
)))
(command "")
(setq n (+ n 1))
)))
(2)切剖面
输入剖面编号,在平面地形图上指定两点确定剖面剖切线位置,指定剖面图起点,利用AutoCAD的inters函数搜索剖切线与地形图的全部交点,自动计算交点坐标,计算交点与剖面位置起点的距离,按各交点高程和与起点的距离形成剖面图各点坐标,即可用本文实例1坐标画线生成地形图的剖面。
(defun dxtent1 ()
(setq n 0 xdzb nil)
(setq xds 0)
(setq sh (sslength e1))





