- 积分
- 17084
- 明经币
- 个
- 注册时间
- 2003-2-26
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
Sub createfile()
Dim outtxt As String
Dim pnt As AcadPoint
Dim dnr As String
Dim entity As AcadEntity
Dim ft(0) As Integer
Dim fd(0) As Variant
'Dim pnt_cord(0 To 1) As Double
Dim sset As AcadSelectionSet
Dim i As Integer
For i = 0 To ThisDrawing.SelectionSets.Count - 1
ThisDrawing.SelectionSets.Item(i).Clear
ThisDrawing.SelectionSets.Item(i).Delete
Next
ft(0) = 0
fd(0) = "oint"
Set sset = ThisDrawing.SelectionSets.Add("Sset_P")
sset.Select acSelectionSetAll, , , ft, fd
ReDim pnt_cord(sset.Count - 1) As Variant
dnr = ""
For i = 0 To sset.Count - 1
pnt_cord(i) = sset.Item(i).Coordinates
dnr = dnr & vbCrLf & (i + 1) & vbCrLf & "" & vbCrLf & pnt_cord(i)(0) & vbCrLf & pnt_cord(i)(1) & vbCrLf & "0"
Next
outtxt = sset.Count & dnr
Open "c:\output.dat" For Output As #1
Print #1, outtxt
Close #1
End Sub
但我写的这个程序并非取直线端点坐标,而是取点坐标,并排成展点格式,并生成文件可供CAD展点,不过应该会给你一点参考,有什么问题再告诉我! |
|