在已知一个定位点坐标,其他点都是以这个定位点为基准的相对坐标,这些相对坐标已输入成一个TXT文件,点的数量大,请问各位高手,有没有一种方法可以将这些坐标快捷的转化成CAD断面,请高手指点!谢谢!
在已知一个定位点坐标,其他点都是以这个定位点为基准的相对坐标,
这些相对坐标已输入成一个TXT文件,点的数量大,请问各位高手,
有没有一种方法可以将这些坐标快捷的转化成CAD断面,请高手指点!谢谢!
12楼
lgh4073,非常感谢你的回帖,发自内心的谢谢。
你所说的这种方法,是否只能生成直线。也许是我笨,需要多指点,谢谢!
回复
13楼
以下是引用 lgh4073 在 2004-3-23 10:05:00 的发言:
利用excel
1.把文本文件导入excel,比如a列为x坐标、b列为y坐标,在c列中输入格式如下
a b c
1 15.8 20.9 =A1 & "," & B1
2 25.8 32.5 =A2 & "," & B2
3 31.0 10.9 =A3 & "," & B3
4 25.2 20.9 =A4 & "," & B4
5 16.8 40.9 =A5 & "," & B5
6 29.4 60.9 =A6 & "," & B6
选择c列的数据范围,复制!,在cad的命令栏中输入line回车,点击鼠标右键,选择“粘贴”
不错,不过我没试,想想应该可以
顶你一下
回复
14楼
一样的,你用pline命令就可以了。
回复
15楼
;;;---------------------------------
;;; 粘贴Excel数据画曲线
;;; 作者: zz 2003.12.24
;;;---------------------------------
;;main
(defun c:xl( / xlread mmm n nolist m_hs m_ls )
(defun xlread()
(setq xls (getstring 1 ) )
(setq xls (strcat "(" xls ")" ) )
(setq Nolist
(append Nolist (list xls) )
)
(if (= xls "()" ) 0 1 )
)
(princ "\n粘贴Execl数据画曲线")
(princ "\n在Excel中建好数据,并将数据拷贝至粘贴板,将光标放在本行后,按鼠标右键粘贴")
(setvar "CMDECHO" 0)
;;;关闭snap
(setq mysnap (getvar "osmode") ) ; osnap off
(if (< mysnap 16384) (command "osmode" (+ 16384 mysnap)))
(setvar "CMDECHO" 0)
(setvar "BLIPMODE" 0)
(setq mmm (getint"\n输入表格的总行数:"))
(setq x_scal (getreal "\n折线的X方向比例:"))
(setq y_scal (getreal "\n折线的y方向比例:"))
(princ "\n在此点鼠标右键粘贴EXCEL数据:")
(setq Nolist nil n 1) ;n--表总行数+1
(repeat mmm (progn
(xlread)
(setq n (1+ n))
)
) ;while
;;;设置行数和列数的初始值
(setq m_hs 0
m_ls 1
) ;m_hs--表列行数计数,m_ls --表列数计数
;;求出第一行作为层名称
(setq xls0 (nth 0 nolist))
(setq xls0 (read xls0))
(setq mm (- (length xls0) 1) ) ;m-总列数
;;;设置层和每一层的颜色
(setq m_lay 1)
(repeat mm (progn ;将第一行数作为层,并设置颜色
(command "layer" "M" (nth m_lay xls0) "") ;设置层
(command "layer" "C" m_lay (nth m_lay xls0) "");设置颜色
(setq m_lay (+ m_lay 1))
))
(setq n (- n 1)) ;去掉第一行,表总行数减1
(setq m_hs 1)
;画多折线,对列数进行循环
(repeat mm (progn
;对行数进行循环
(command "layer" "s" (nth m_ls xls0) "") ;每列线换一层
(command "pline")
(repeat (- n 1) (progn ;n-1,表总行数
;;; 求点座标
(setq xls (nth m_hs nolist))
(setq xls (read xls))
(setq txt_x (nth 0 xls))
(setq txt_y (nth m_ls xls))
; (setq pt (list txt_x txt_y))
(setq pt (list (* txt_x x_scal) (* txt_y y_scal)))
(command pt)
(setq m_hs (+ m_hs 1))
)) ;repeat
(command "")
(setq m_hs 1)
(setq m_ls (+ m_ls 1))
));repeat
(setvar "CMDECHO" 1)
(setvar "BLIPMODE" 1)
(setq *error* olderr)
)
;;;-------------------------------------------------
(princ "\n 粘贴Excel数据画曲线,命令:XL。作者: zz")
(princ)
;;;------------end of ttbxls---------------------
回复
16楼
以上程序Excel中的数据格式:
aa bb cc dd ee
1 1.744355971 8.721779854 17.44355971 15.69920374
5 8.711167063 43.55583532 87.11167063 78.40050357
9 15.63558123 78.17790614 156.3558123 140.720231
13 22.4838976 112.419488 224.838976 202.3550784
17 29.22278567 146.1139283 292.2278567 263.005071
21 35.81944752 179.0972376 358.1944752 322.3750277
25 42.24177744 211.2088872 422.4177744 380.175997
其中第一行为层名,第一列为x,其它列为Y1,y2,y3,一次可画多条线。
回复
17楼
以上程序Excel中的数据第一行为层名,应加双" "。
"aa" "bb" "cc" "dd" "ee"
1 1.744355971 8.721779854 17.44355971 15.69920374
5 8.711167063 43.55583532 87.11167063 78.40050357
9 15.63558123 78.17790614 156.3558123 140.720231
回复
18楼
要是只画点可以利用excel
1.把文本文件导入excel,比如a列为x坐标、b列为y坐标,在c列中输入格式如下
a b c
1 15.8 20.9 ="point "&A1 & "," & B1
2 25.8 32.5 ="point "&A2 & "," & B2
3 31.0 10.9 ="point "&A3 & "," & B3
4 25.2 20.9 ="point "&A4 & "," & B4
5 16.8 40.9 ="point "&A5 & "," & B5
6 29.4 60.9 ="point "&A6 & "," & B6
选择c列的数据范围,复制!,在cad的命令栏中点击鼠标右键,选择“粘贴”.point后一空格不能少!
回复
19楼
非常好
回复
20楼
vb编程会更快速的!
回复
21楼
能找到讲解这方面内容的书吗?
回复