CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

GetReal Method (ActiveX)

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

摘要: 从用户获取实数(双精度)值。

从用户获取实数(双精度)值。

支持的平台:仅窗口

签名

工 务 局:

RetVal = object.GetReal([Prompt])
对象

类型:实用工具

此方法适用的对象。

提示

访问:仅输入;自选

类型:变体(字符串)

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

返回值(RetVal)

类型:

从用户返回的值。

言论

AutoCAD 会暂停用户输入实际值,并将返回值设置为用户输入的值。提示参数指定 AutoCAD 在暂停之前显示的字符串。提示是可选的。

如果返回关键字而不是双精度,AutoCAD 将生成错误消息“用户输入关键字”。使用该方法从返回值中获取关键字。GetInput

例子

工 务 局:

Sub Example_GetReal()
    ' This example returns the Real entered by the user.
    
    AppActivate ThisDrawing.Application.Caption
    
    Dim returnReal As Double
    
    ' Return the value entered by user. A prompt is provided.
    returnReal = ThisDrawing.Utility.GetReal("Enter an Real: ")
    MsgBox "The real entered was " & returnReal & vbCrLf & _
            "(Enter the next value without prompting.)", , "GetReal Example"
    
    ' Return the value entered by user. No prompt is provided.
    returnReal = ThisDrawing.Utility.GetReal()
    MsgBox "The real entered was " & returnReal, , "GetReal Example"
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetReal()
    ;; This example returns the Real entered by the user.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))    
    
    ;; Return the value entered by user. A prompt is provided.
    (setq returnReal (vla-GetReal (vla-get-Utility doc) "Enter an Real: "))
    (alert (strcat "The real entered was " (rtos returnReal 2) "\n"
                   "(Enter the next value without prompting.)"))
    
    ;; Return the value entered by user. No prompt is provided.
    (setq returnReal (vla-GetReal (vla-get-Utility doc)))
    (alert (strcat "The real entered was " (rtos returnReal 2)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 07:19

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部