GetCorner 方法 (ActiveX)
获取矩形的一角。 支持的平台:仅限 Windows 签名VBA: RetVal = GetCorner(Point [, Prompt])
返回值 (RetVal)类型:变体(双打的三元素阵列) 表示矩形角的 3D WCS 坐标。 言论AutoCAD 暂停用户输入矩形的拐角,并将返回值设置为选定点的值。Point 参数指定 3D WCS 坐标中矩形的基点;此参数为必填项。Prompt 参数指定 AutoCAD 在暂停之前显示的字符串。提示是可选的。 AutoCAD 用户可以通过在 WCS 坐标格式中输入点来指定拐角; 将 Point 视为三维点。用户也可以通过在图形屏幕上指定位置来指定拐角。AutoCAD 会绘制一个动态大小的矩形,从点到当前十字准线位置,以帮助用户可视化第二个角的位置。矩形在 WCS 的 XY 平面中绘制。使用指点设备时,忽略 Point 的 Z 字段,并将结果的 Z 字段设置为当前高程。GetCornerGetCorner 例子VBA: Sub Example_GetCorner() ' This example provides a base point and prompts the user to ' input the second point to make a rectangle. AppActivate ThisDrawing.Application.Caption Dim returnPnt As Variant Dim basePnt(0 To 2) As Double basePnt(0) = 2#: basePnt(1) = 2#: basePnt(2) = 0# ' Prompt the user to pick second point and returns the point returnPnt = ThisDrawing.Utility.GetCorner(basePnt, "Enter Other corner: ") ' Display the point picked MsgBox "The point picked was " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2), , "GetCorner Example" End Sub 可视化 LISP: (vl-load-com) (defun c:Example_GetCorner() ;; This example provides a base point and prompts the user to ;; input the second point to make a rectangle. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Prompt the user to pick second point and returns the point (setq basePnt (vlax-3d-point 2 2 0)) (setq returnPnt (vla-GetCorner (vla-get-Utility doc) basePnt "Enter Other corner: ")) ;; Display the point picked (setq returnPnt (vlax-safearray->list (vlax-variant-value returnPnt))) (alert (strcat "The point picked was " (rtos (nth 0 returnPnt) 2) ", " (rtos (nth 1 returnPnt) 2) ", " (rtos (nth 2 returnPnt) 2))) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-15 11:45
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.