那位大牛会写关于AUTOCAD CAD2002 里面提取坐标的程序呢

goosen 2008-06-26 08:51:04
我想在打的的CAD 图里提取多个坐标点


不知VB能否实现..

高手们帮忙写一下
...全文
69 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
靳永富 2008-06-28
  • 打赏
  • 举报
回复
把autocad保存成R12的DXF格式。程序如下(这是我在使用的程序,绝对没问题)
Private Sub Command1_Click()
Dim a(0 To 100000)
Dim I%, j%, X As String, Y As String, D As String
I = 0
j = 0
'先卸载控件
Do
If Text1.Count > 1 Then
Unload Text1(Text1.Count - 1)
Unload Text2(Text2.Count - 1)
Unload Label3(Label3.Count - 1)
End If
Loop Until Text1.Count = 1


'取出数据
If Dir("d:\" & Text3 & ".dxf") = "" Then
Text1(0) = ""
Text2(0) = ""
Command1.Top = Text1(0).Top + Text1(0).Height + 100 '调整控件位置
Form1.Height = Command1.Top + Command1.Height + 800 '调整窗体大小
Label5.Top = Text1(0).Top + Text1(0).Height + 150
Text3.Top = Text1(0).Top + Text1(0).Height + 150
Exit Sub
End If





Open "d:\" & Text3 & ".dxf" For Input As #1
Do Until EOF(1)
Line Input #1, a(I)
If I > 8 Then
X = Format(a(I - 2), "0.0000")
D = Format(a(I - 8), "0.0000")
Y = Format(a(I), "0.0000")
End If
If D = "POINT" Then '找到定位点
If j > 0 Then '加载控件
Load Text1(j)
Load Text2(j)
Load Label3(j)
Text1(j).Top = Text1(j - 1).Top + Text1(j - 1).Height + 150
Text2(j).Top = Text1(j).Top
Label3(j).Top = Text1(j).Top
Label3(j).Caption = "第" & (j + 1) & "点"
Label3(j).Visible = True
Text1(j).Visible = True
Text2(j).Visible = True
End If
Text1(j) = Mid(X, 1)
Text2(j) = Mid(Y, 1)
j = j + 1
End If
I = I + 1
Loop
Close #1
If j = 0 Then
Text1(0) = ""
Text2(0) = ""
Command1.Top = Text1(0).Top + Text1(0).Height + 100 '调整控件位置
Form1.Height = Command1.Top + Command1.Height + 800 '调整窗体大小

Label5.Top = Text1(0).Top + Text1(0).Height + 150
Text3.Top = Text1(0).Top + Text1(0).Height + 150
Exit Sub
End If
Command1.Top = Text1(j - 1).Top + Text1(j - 1).Height + 100 '调整控件位置
Form1.Height = Command1.Top + Command1.Height + 800 '调整窗体大小

Label5.Top = Text1(j - 1).Top + Text1(j - 1).Height + 220
Text3.Top = Text1(j - 1).Top + Text1(j - 1).Height + 220
End Sub

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧