[原创]提取等高线生成cass下的DAt
<p><br/>(defun c:dfd()<br/> ;本程序分为两个部分, By 老四<br/> ;1---将线按一定距离进行等分<br/> (setvar "cmdecho" 0) ;取消命令显示<br/> (setq juli (GETINT "\n 输入等分距离:"))<br/> (command "layer" "m" "DGXD" "color" "red" "" "")<br/> (SETQ ss1 (SSGET '((0 . "LWPOLYLINE"))))<br/> (setq gs (sslength ss1)) ;获取选择集中对象的数目<br/> (setq n 0) ;设置图元初始个数,并逐个读取<br/> (repeat gs<br/> (setq name (ssname ss1 n))<br/> (command "MEASURE" name juli ) ;逐等分距离分点<br/> (setq n (1+ n))<br/> ))</p><p>;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</p><p><br/> ;提取线上顶点的坐标(带高程)生成南方格式<br/> ;可以提取多段线、二维多段线、三维多段线的坐标和高程<br/> ;根据线的特征修改程序------有标高的和顶点带高程的<br/> ;仔细阅读以下程序根据需要修改相应参数<br/>(vl-load-com)<br/>(defun c:tqzb ()<br/> (SETQ plx (SSGET)) <br/> (setq gs (sslength plx))<br/> (setq nn 0)<br/> (setq file (open "d:\\坐标.dat" "w")) ;根据需要选择存放目录<br/> (while (> gs nn)<br/> (setq ent (ssname plx nn))<br/> <br/> ;提取线上坐标主程序 <br/> (setq obj (vlax-ename->vla-object ent))<br/> ;(setq zgc (itoa (fix (vla-get-Elevation obj)))) ;有标高的情况 <br/> (setq plist (vlax-safearray->list (vlax-variant-value (vla-get-coordinates obj))))<br/> (setq n 0)<br/> (repeat (/ (length plist) 3) ;设定步长 多段线(用3) 二维线(用2) <br/> ;(setq pp (append pp (list (list (nth n plist)(nth (1+ n) plist))))) ;输出的是列表形式<br/> (setq xzb (rtos (nth (1+ n) plist)))<br/> (setq yzb (rtos (nth n plist)))<br/> (setq zgc (rtos (nth (+ 2 n) plist))) ;顶点带高程的情况 <br/> (princ (strcat "3,," yzb "," xzb "," zgc) file)<br/> (princ "\n" file)<br/> (setq n (+ n 3)) ;设定步长 多段线(用3) 二维线(用2) <br/> )<br/> ;提取线上坐标主程序结束<br/> (setq nn (+ nn 1))<br/> )<br/> (close file)<br/>)<br/></p> <p>顶,收下!</p> 谢谢!!! 谢谢楼主的分享收藏试试,学习学习 谢谢!学习一下。 谢谢!学习一下。 谢谢!学习一下。
学习交流~~~ 试了一下,发现有时坐标提取是错误的
同时对由cass做出的等高线倒是不认识。 谢谢楼主,学习了继续努力
页:
[1]
2