GetPoint Method
 
 
 

The GetPoint method prompts the user for the specification of a point at the AutoCAD Command prompt. This method accepts two parameters, an optional from point and the prompt string. If the from point is provided, AutoCAD draws a rubber-band line from that point. To control the user input, this method can be preceded by a call to the InitializeUserInput method.

Get a point selected by the user

The following example prompts the user for two points, then draws a line using those points as the start point and endpoint.

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: "


	' Get the first point without entering a base point
	startPnt = ThisDrawing.Utility.GetPoint(, prompt1)


	' Use the point entered above as the base point
	endPnt = ThisDrawing.Utility.GetPoint(startPnt, prompt2)


	' Create a line using the two points entered
	ThisDrawing.ModelSpace.AddLine startPnt, endPnt
	ThisDrawing.Application.ZoomAll
End Sub