明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1394|回复: 3

请教,如何画带线形的多段线?

[复制链接]
发表于 2005-5-18 11:30:00 | 显示全部楼层 |阅读模式
请参考文件:
我的文本文件格式如下:
1,X坐标1,Y坐标1,高程1,线形1
2,X坐标2,Y坐标2,高程2,线形1
3,X坐标3,Y坐标3,高程3,线形1
4,X坐标4,Y坐标4,高程4,线形2
5,X坐标5,Y坐标5,高程5,线形2
6,X坐标6,Y坐标6,高程6,线形2 …… 已有程序把线画出来,可是没有线形的,我想画线时一起设线形,线形是文本文件每行的最后一个字段。
发表于 2005-5-18 11:42:00 | 显示全部楼层
多义线画一条只能一种线形,你只能用line画了,而且线形只能指定到线,你的文件是指定到点....晕哦.3点和4点不同线形,到底3~4画出的线条是按线形1还是2呢....
 楼主| 发表于 2005-5-18 11:50:00 | 显示全部楼层
这里有多条线,1到3点为1条,4到6点为一条,等等。3、4点之间是没有关联的。
 楼主| 发表于 2005-5-18 11:52:00 | 显示全部楼层
已有程序把线画出来,可是没有线形的,请看下列程序 ;定义函数名
(defun c:zhan()

;选择要打开的件
(setq tn (getfiled "原始数据文件(txt;dat;*)" "" "txt;dat;*" 2))
(setq fle (findfile tn))
(if (not fle)
(setq fle (getfiled "请选择数据文件" "txt1" "txt;dat;*" 8))
)
(if fle
(progn
(setq F_ID (open fle "r"))
(setvar "osmode" 0)
))

;展点连线程序
(while
(setq text0 (READ-LINE F_ID))
;是否到最后一行
(if (/= text0 "")
(progn
(setq n (vl-string-position (ascii ",") text0))
(setq n0 (vl-string-position (ascii ",") text0 (1+ n)))
(setq n1 (vl-string-position (ascii ",") text0 (1+ n0)))
(setq n2 (vl-string-position (ascii ",") text0 (1+ n1))) (setq dianhao (substr text0 1 n)
y (atof (substr text0 (+ n 2) (- n0 (1+ n))))
x (atof (substr text0 (+ n0 2) (- n1 (1+ n0))))
gaoc (substr text0 (+ n1 2) (- n2 (1+ n1)))
xianxing (substr text0 (+ n2 2))
p0 (list x y)
)


(if (/= xianxing xx) ;_if_1
(progn ;_progn_1
(if (/= xx nil);_if_2
(command "")
);_endif_2
(command "pline" p0)
) ;_end_progn_1
(command p0)
) ;_end_if_1 (setq xx xianxing)
)
))

(command "")
(command "zoom")
(command "e") (CLOSE F_ID)
) ;_主程序结束
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-29 08:18 , Processed in 0.181556 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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