明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1692|回复: 0

[讨论] 读坐标画线问题

[复制链接]
发表于 2013-9-14 17:29:52 | 显示全部楼层 |阅读模式
(defun C:ii ()
(vl-load-com)
(setq file (getfiled "请选择输入线文件" "" "TXT" 8))
(setq ff (open file "r"))

  (while (setq kzsj (read-line ff))
        (setq kz kzsj)
        (while (vl-string-search ",," kz)
               (setq kz (vl-string-subst ",nil," ",," kz))
        );while  
        (while (vl-string-search "," kz)
               (setq kz (vl-string-subst " " "," kz))
        );while  
   
       (setq kz (read (strcat "(" kz ")")))
       (setq dm (vl-princ-to-string (nth 0 kz)))

   (if (= dm "M")
     (progn
      (command "LAYER" "m" "M" "" "")
      (setq sj (read-line ff))
      (setq x sj);这句不知道为什么要赋值给变量,不然会出错
      (while (vl-string-search "," x)
            (setq x (vl-string-subst " " "," x))
      );while
     (setq x (read (strcat "(" x ")")))
     (setq rr (+ rr 1))
    (setq sj (read-line ff))
    (setq y sj)
        (while (vl-string-search "," y)
            (setq y (vl-string-subst " " "," y))
        );while
    (setq y (read (strcat "(" y ")")))
    (command "line" x y "")
);progn
);if

(if (= dm "MH")
(progn  
     (setq dmm t)
     (command "pline")
   (while dmm
   
      (setq sjj (read-line ff))
      (setq y sjj)
      (while (vl-string-search "," y)
            (setq y (vl-string-subst " " "," y))
      );while
     (setq y (read (strcat "(" y ")")))
     (setq dmm (vl-princ-to-string (nth 0 y)))
       (IF (/= dmm "MH")
        (command y)
        (progn
        (command "c")
        (command "")
        (setq dmm nil)
        )
       )
    );while
  
);progn
);if MH

  );while
(close ff)
(princ)
)


数据格式
M,直线,,,
5805.196,-1872.981,3
6411.157,-1872.981,3
M,直线,,
5112.6716,-2093.4380,5
5476.3540,-1581.4786,5
MH,多义线,,,
9058.768,-1482.657,9
9664.730,-1482.657,9
9664.730,-2007.338,9
9058.768,-2007.338,9
MH,多义线,,,
1598.148,-4901.198,0.000
4712.885,-6227.046,0.000
4115.934,-8857.714,0.000
1515.806,-10102.388,0.000
-569.714,-8181.260,0.000
-380.121,-5800.145,0.000
画不完整,数据判断,字母M,建M层画直线,字母MH建MH层画多义线闭合
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-23 09:22 , Processed in 0.146998 second(s), 29 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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