这是我在AutoCAD中的第一个VBA。我试着把一张桌子的中心和直径放进去,但我可以#039;t处理点。有人能纠正我的代码吗
- Option Explicit
- Private Sub cercuri_Click()
- Dim SS As AcadSelectionSet
- Dim coords As AcadTable
- Dim i As Integer
- Dim st As String
- Dim p0 As AcadPoint
- Dim Code(0) As Integer
- Dim Val(0) As Variant
- Dim insp(0 To 2) As Double
- insp(0) = 0#
- insp(1) = 0#
- insp(2) = 0#
- Code(0) = 0
- Val(0) = "CIRCLE"
- Set SS = ThisDrawing.SelectionSets.Add("ss")
- UserForm1.hide
- SS.SelectOnScreen Code, Val
- Set coords = ThisDrawing.ModelSpace.AddTable(insp, SS.Count + 2, 5, 10, 30)
- For i = 0 To SS.Count - 1
- st = CStr(SS.Item(i).Diameter)
- coords.SetText i + 2, 3, st
- p0 = SS.Item(i).Center ' WHAT'S WRONG HERE?
- Next i
- SS.Delete
- UserForm1.Show
- End Sub
|