Sub 获取用户输入的坐标点()
Dim startPnt As Variant
Dim endPnt As Variant
Dim prompt1 As String
Dim prompt2 As String
prompt1 = vbCrLf & "Enter the start point of the line: "
prompt2 = vbCrLf & "Enter the end point of the line: "
' 在不输入基点的情况下获取第一点
startPnt = ThisDrawing.Utility.GetPoint(, prompt1)
' 使用上面输入的点作为基点
endPnt = ThisDrawing.Utility.GetPoint(startPnt, prompt2)
' 使用输入的两个点创建一条直线
ThisDrawing.ModelSpace.AddLine startPnt, endPnt
ThisDrawing.Application.ZoomAll
End Sub
|
|