- 积分
- 3864
- 明经币
- 个
- 注册时间
- 2014-1-24
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
如上图所示,用(ssget "_CP")创建选择集提取坐标时,不知道是为什么,有时候能够正确提取,但是有时候却只提取出了最外围多段线的坐标,要不就是里面的多段线少提取了一段。。。。。不知道是为什么,难道是多段线过多?还请大神解答
下面是我的代码:
- (defun c:tt( / biao cunzai dingdianbiao en ent feidihao file geshu huidian huidianxx huidianxxx huidianyy huidianyyy i ii j jj mingzi name neibiao neihuidian path ss waiwei xx xxx yy yyy)
- (setq i 0)
- (setq geshu 0)
- (setq waiwei 0)
- (setq huidian 0)
- (setq feidihao 1)
- (command "CONVERT" "" "")
- (setq ss (ssget '((0 . "LWPOLYLINE"))))
- (setq path (getfiled "保存" "" "TXT" 1))
- (setq file (open path "W"))
- (write-line "[属性描述]" file)
- (write-line "坐标系=80国家大地坐标系" file)
- (write-line "几度分带=3" file)
- (write-line "投影类型=高斯克吕格" file)
- (write-line "计量单位=米" file)
- (write-line "带号=36" file)
- (write-line "精度=0.01" file)
- (write-line "转换参数=,,,,,," file)
- (write-line "[地块坐标]" file)
- (repeat (sslength ss)
- (setq name (ssname ss i))
- (setq en (entget name))
- (setq j 0)
- (setq waiwei (1+ waiwei))
- (setq huidian (1+ geshu))
- (setq dingdianbiao nil)
- (write-line (strcat ",," "1" "," "外围" (itoa waiwei) "," "面" "," "H48G041086" "," "综合用地,,@") file)
- (repeat (length en)
- (setq biao (nth j en))
- (if (= 10 (car biao))
- (progn
- (setq xx (caddr biao))
- (setq yy (cadr biao))
- (setq geshu (1+ geshu))
- (write-line (strcat "J" (itoa geshu) "," "1" "," (rtos xx 2 3) "," (rtos yy 2 3)) file)
- (setq dingdianbiao (append dingdianbiao (list (cdr biao))))
- (princ)
- )
- )
- (setq j (1+ j))
- )
- (setq huidianxx (caddr (assoc 10 en)))
- (setq huidianyy (cadr (assoc 10 en)))
- (write-line (strcat "J" (itoa huidian) "," "1" "," (rtos huidianxx 2 3) "," (rtos huidianyy 2 3)) file)
- (entdel name)
- (setq cunzai (ssget "_CP" dingdianbiao '((0 . "LWPOLYLINE"))))
- (setq ii 0)
- (if cunzai
- (progn
- (repeat (sslength cunzai)
- (setq mingzi (ssname cunzai ii))
- (setq ent (entget mingzi))
- (setq jj 0)
- (setq feidihao (1+ feidihao))
- (setq neihuidian (1+ geshu))
- (repeat (length ent)
- (setq neibiao (nth jj ent))
- (if (= 10 (car neibiao))
- (progn
- (setq xxx (caddr neibiao))
- (setq yyy (cadr neibiao))
- (setq geshu (+ geshu 1))
- (write-line (strcat "J" (itoa geshu) "," (itoa feidihao) "," (rtos xxx 2 3) "," (rtos yyy 2 3)) file)
- (princ)
- )
- )
- (setq jj (1+ jj))
- )
- (setq huidianxxx (caddr (assoc 10 ent)))
- (setq huidianyyy (cadr (assoc 10 ent)))
- (write-line (strcat "J" (itoa neihuidian) "," (itoa feidihao) "," (rtos huidianxxx 2 3) "," (rtos huidianyyy 2 3)) file)
- (princ)
- (setq ii (1+ ii))
- )
- )
- )
- (entmake en)
- (setq i (1+ i))
- )
- (close file)
- )
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|