CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

GetCorner Method (ActiveX)

2023-1-4 08:47| 发布者: admin| 查看: 579| 评论: 0|来自: AutoCAD

摘要: 获取矩形的一角。

获取矩形的一角。

支持的平台:仅窗口

签名

工 务 局:

RetVal = GetCorner(Point [, Prompt])
对象

类型:实用工具

此方法适用的对象。

访问:仅输入

类型:变体(双精度的三元素数组)

指定矩形基点的三维 WCS 坐标。

提示

访问:仅输入;自选

类型:变体(字符串)

用于提示用户输入的文本。

返回值(RetVal)

类型:变体(双精度的三元素数组)

表示矩形拐角的 3D WCS 坐标。

言论

AutoCAD 暂停用户输入矩形角,并将返回值设置为所选点的值。Point参数指定 3D WCS 坐标中矩形的基点;此参数是必需的。提示参数指定 AutoCAD 在暂停之前显示的字符串。提示是可选的。

AutoCAD 用户可以通过输入 WCS 坐标格式中的点来指定拐角;将“点”视为三维。用户还可以通过在图形屏幕上指定位置来指定角。AutoCAD 绘制一个从“点”到当前十字准线位置的动态大小矩形,以帮助用户可视化第二个角的位置。矩形在 WCS 的XY平面中绘制。使用定点设备时,忽略点的 Z 字段,将结果的Z字段设置为当前高程。GetCornerGetCorner

例子

工 务 局:

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

Visual 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)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-11 19:06

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部