GetPoint 方法提示用户在 AutoCAD 命令提示下给出点的定义。该方法接收两个参数:可选的起始点和提示字符串。如果提供了起始点,AutoCAD 将从该点绘制一条拖引线。它的返回值是一个三维的Double型数组,要使用Variant型的变量来存放。
下面的样例提示用户输入两个点,然后以这两个点为起点和端点绘制一条直线。
Sub Ch3_GetPointsFromUser()
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: "