该方法在 AutoCAD 命令提示符下提示用户指定点。GetPoint 此方法接受两个参数,可选的 from point 和提示字符串。如果提供了起始点,AutoCAD 将从该点绘制一条橡皮筋线。若要控制用户输入,可以在此方法之前调用该方法。InitializeUserInput 获取用户选择的点下面的示例提示用户输入两个点,然后使用这些点作为起点和终结点绘制一条线。 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 |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:34
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.