- 积分
- 17083
- 明经币
- 个
- 注册时间
- 2003-2-26
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
Dim outtxt As String
Private Sub CommandButton1_Click()
CommonDialog1.Filter = "TXT文件|*.txt|DAT文件|*.dat"
CommonDialog1.ShowSave
Open CommonDialog1.FileName For Output As #1
Print #1, outtxt
Close #1
MsgBox " 文件" & CommonDialog1.FileName & "创建成功!"
Unload Me
End Sub
Private Sub CommandButton2_Click()
Dim pnt As AcadPoint
Dim dnr As String
Dim entity As AcadEntity
Dim ft(0) As Integer
Dim fd(0) As Variant
Dim us1 As Integer '图形比例尺
Dim us2 As Integer '左下角X坐标
Dim us3 As Integer '左下角Y坐标
us1 = ThisDrawing.GetVariable("userr1")
us2 = ThisDrawing.GetVariable("userr2")
us3 = ThisDrawing.GetVariable("userr3")
'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
ReDim x(sset.Count - 1)
ReDim y(sset.Count - 1)
dnr = ""
For i = 0 To sset.Count - 1
pnt_cord(i) = sset.Item(i).Coordinates
Select Case us1
Case 500
If us2 = 0 And us3 = 0 Then
x(i) = (pnt_cord(i)(1) - 100) / 2
y(i) = (pnt_cord(i)(0) - 100) / 2
ElseIf us2 = 100 And us3 = 100 Then
x(i) = (pnt_cord(i)(1) + 100) / 2
y(i) = (pnt_cord(i)(0) + 100) / 2
End If
Case 1000
If us2 = 0 And us3 = 0 Then
x(i) = pnt_cord(i)(1) - 100
y(i) = pnt_cord(i)(0) - 100
ElseIf us2 = 100 And us3 = 100 Then
x(i) = pnt_cord(i)(1)
y(i) = pnt_cord(i)(0)
End If
End Select
'*******按scs2000展点文件格式排列点
dnr = dnr & vbCrLf & (i + 1) & vbCrLf & "" & vbCrLf & y(i) & vbCrLf & x(i) & vbCrLf & pnt_cord(i)(2)
Next
outtxt = sset.Count & dnr
MsgBox "点导出成功,请保存文件!"
End Sub |
|