CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

关于请求点 (VBA/ActiveX)

2023-1-5 02:05| 发布者: admin| 查看: 628| 评论: 0|来自: AutoCAD

摘要: GetPoint 方法在 AutoCAD 命令提示下提示用户输入点的规范。

该方法在 AutoCAD 命令提示符下提示用户输入点的规范。GetPoint

此方法接受两个参数:可选的起始点和提示字符串。如果提供了起始点,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

路过

雷人

握手
1

鲜花

鸡蛋

刚表态过的朋友 (1 人)

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 15:02

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部