明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2986|回复: 8

[已解答] ssget提取多段线坐标问题,请大神解答!

[复制链接]
发表于 2014-2-17 18:50 | 显示全部楼层 |阅读模式

如上图所示,用(ssget "_CP")创建选择集提取坐标时,不知道是为什么,有时候能够正确提取,但是有时候却只提取出了最外围多段线的坐标,要不就是里面的多段线少提取了一段。。。。。不知道是为什么,难道是多段线过多?还请大神解答

下面是我的代码:
  1. (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)
  2.   (setq i 0)
  3.   (setq geshu 0)
  4.   (setq waiwei 0)
  5.   (setq huidian 0)
  6.   (setq feidihao 1)
  7.   (command "CONVERT" "" "")
  8.   (setq ss (ssget '((0 . "LWPOLYLINE"))))
  9.   (setq path (getfiled "保存" "" "TXT" 1))
  10.   (setq file (open path "W"))
  11.   (write-line "[属性描述]" file)
  12.   (write-line "坐标系=80国家大地坐标系" file)
  13.   (write-line "几度分带=3" file)
  14.   (write-line "投影类型=高斯克吕格" file)
  15.   (write-line "计量单位=米" file)
  16.   (write-line "带号=36" file)
  17.   (write-line "精度=0.01" file)
  18.   (write-line "转换参数=,,,,,," file)
  19.   (write-line "[地块坐标]" file)
  20.   (repeat (sslength ss)
  21.     (setq name (ssname ss i))
  22.     (setq en (entget name))
  23.     (setq j 0)
  24.     (setq waiwei (1+ waiwei))
  25.     (setq huidian (1+ geshu))
  26.     (setq dingdianbiao nil)
  27.     (write-line (strcat ",," "1" "," "外围" (itoa waiwei) "," "面" "," "H48G041086" "," "综合用地,,@") file)
  28.     (repeat (length en)
  29.       (setq biao (nth j en))
  30.       (if (= 10 (car biao))
  31.        (progn  
  32.         (setq xx (caddr biao))
  33.   (setq yy (cadr biao))
  34.   (setq geshu (1+ geshu))
  35.   (write-line (strcat "J" (itoa geshu) "," "1" "," (rtos xx 2 3) "," (rtos yy 2 3)) file)
  36.   (setq dingdianbiao (append dingdianbiao (list (cdr biao))))
  37.   (princ)
  38.        )  
  39.       )
  40.       (setq j (1+ j))
  41.     )
  42.       (setq huidianxx (caddr (assoc 10 en)))
  43.       (setq huidianyy (cadr (assoc 10 en)))
  44.       (write-line (strcat "J" (itoa huidian) "," "1" "," (rtos huidianxx 2 3) "," (rtos huidianyy 2 3)) file)

  45.       (entdel name)
  46.       (setq cunzai (ssget "_CP" dingdianbiao '((0 . "LWPOLYLINE"))))
  47.       (setq ii 0)
  48.       (if cunzai
  49.        (progn  
  50.         (repeat (sslength cunzai)
  51.           (setq mingzi (ssname cunzai ii))
  52.     (setq ent (entget mingzi))
  53.     (setq jj 0)
  54.     (setq feidihao (1+ feidihao))
  55.     (setq neihuidian (1+ geshu))
  56.     (repeat (length ent)
  57.             (setq neibiao (nth jj ent))
  58.       (if (= 10 (car neibiao))
  59.        (progn
  60.               (setq xxx (caddr neibiao))
  61.         (setq yyy (cadr neibiao))
  62.         (setq geshu (+ geshu 1))
  63.         (write-line (strcat "J" (itoa geshu) "," (itoa feidihao) "," (rtos xxx 2 3) "," (rtos yyy 2 3)) file)
  64.         (princ)
  65.        )
  66.       )
  67.       (setq jj (1+ jj))
  68.     )
  69.     (setq huidianxxx (caddr (assoc 10 ent)))
  70.     (setq huidianyyy (cadr (assoc 10 ent)))
  71.     (write-line (strcat "J" (itoa neihuidian) "," (itoa feidihao) "," (rtos huidianxxx 2 3) "," (rtos huidianyyy 2 3)) file)
  72.     (princ)
  73.     (setq ii (1+ ii))
  74.   )
  75.        )  
  76.       )
  77.       (entmake en)
  78.       (setq i (1+ i))
  79.   )
  80.   (close file)
  81. )


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
 楼主| 发表于 2014-2-17 19:17 | 显示全部楼层
自己顶一下,等大神
用(ssget "_WP")也出现过类似的问题,内部的多段线没提取完,但有时候又能提取完全。。。。。。。
发表于 2014-2-18 12:06 来自手机 | 显示全部楼层
因为没在可视范围内,这样的对象就选不到

评分

参与人数 1明经币 +1 收起 理由
重慶崽兒 + 1 谢谢黄大大,看来这种选取方式不太好。。。。.

查看全部评分

 楼主| 发表于 2014-2-18 18:41 | 显示全部楼层
自贡黄明儒 发表于 2014-2-18 12:06
因为没在可视范围内,这样的对象就选不到

不知道黄大大能不能推荐几种好点的方式。。。
发表于 2014-2-18 19:10 来自手机 | 显示全部楼层
我同你的行业差别大,不知道你要干什么,我编程时,习惯一次框选(如果可能的话)就搞定。你在ssget之后,加一句COmmand. zOOm. ss应该就可以了,我想
 楼主| 发表于 2014-2-18 19:16 | 显示全部楼层
自贡黄明儒 发表于 2014-2-18 19:10
我同你的行业差别大,不知道你要干什么,我编程时,习惯一次框选(如果可能的话)就搞定。你在ssget之后,加 ...

是的,其实小弟也是想用一次框选来解决,但小弟能力有限,做不到先提取外围线的坐标,然后再提取内部多段线的坐标,所以只好退而求其次了。。。。。谢谢黄大大了!
 楼主| 发表于 2014-2-18 19:24 | 显示全部楼层
自贡黄明儒 发表于 2014-2-18 19:10
我同你的行业差别大,不知道你要干什么,我编程时,习惯一次框选(如果可能的话)就搞定。你在ssget之后,加 ...

....谢谢黄大
   居然连(command "zoom" "e")这方法都没想到,真想扇我自己俩耳光。。。
  再次拜谢!
发表于 2022-12-22 18:04 | 显示全部楼层
这个能在CAD里再标注点号么?
发表于 2022-12-22 20:05 | 显示全部楼层
同行啊哈哈,一看就是国家2000txt制作程序,我也做过这程序
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-8 12:20 , Processed in 0.195461 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表