- Dim index As Integer
- index = 2
-
- Dim pt1 As Variant
- pt1 = ThisDrawing.Utility.GetPoint(, "输入第一点:")
- If Err Then
- Err.Clear
- Exit Sub
- End If
- Dim ptPrevious As Variant, ptCurrent As Variant
- ptPrevious = pt1
-
- nextpt:
- ptCurrent = ThisDrawing.Utility.GetPoint(ptPrevious, "输入下一点:")
- If Err Then
- Err.Clear
- Exit Sub
- End If
-
- Dim objPline As AcadLWPolyline
- If index = 2 Then
- Dim points(0 To 3) As Double
- points(0) = ptPrevious(0)
- points(1) = ptPrevious(1)
- points(2) = ptCurrent(0)
- points(3) = ptCurrent(1)
- Set objPline = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
- ElseIf index > 2 Then
- Dim ptVert(0 To 1) As Double
- ptVert(0) = ptCurrent(0)
- ptVert(1) = ptCurrent(1)
- objPline.AddVertex index - 1, ptVert
- End If
- index = index + 1
- ptPrevious = ptCurrent
- GoTo nextpt
是不是要这样?
|