测量CAD展点号坐标
格式
1,568418.1050,2404939.5620,5.4680
2,568379.7020,2404931.4580,5.3700
3,568335.0760,2404929.9880,5.6990
4,568314.5200,2404930.4590,5.3500
5,568295.0160,2404942.7280,5.3550
6,568270.9730,2404942.9750,5.6150
程序内容:
(defun C:txt ()
(setvar "cmdecho" 0)
(setq ff(getfiled "选取一个TXT文本(梁旭武设计QQ75278336)..." "" "" 2))
(setq f(open ff "r"))
(while (setq aa (read-line f))
(setq i 0 j 0lxw "")
(repeat (strlen aa);计算逗号所在的位置
(setq j (+ j 1))
(setq lsd (substr aa j 1))
(if (= "," lsd)
(progn
(setq i(+ i 1))
(if (= i 1)
(setq k j)
)
(if (= i 2)
(setq k2 j)
)
(if (= i 3)
(setq k3 j)
)
)
)
);计算逗号所在的位置
(setq k-1 (- k 1)) (setq k+1(+ k 1));截取字符串
(setq k2-1 (- k2 1)) (setq k2+1(+ k2 1))
(setq k3-1 (- k3 1)) (setq k3+1(+ k3 1))
(setq c(- k2-1 k)) (setq c1(- k3-1 k2))
(setq dh (substr aa 1 k-1))
(setq x (substr aa k+1 c))
(setq y (substr aa k2+1 c1));截取字符串
(setq xy(list (atof y) (atof x)))
(command "_text" xy 1.5 0 dh)
(command "_point" xy)
)
)
程序有一点粗糙,但是可能用的
为什么我的z都是0
页:
[1]