GetInteger 方法 (ActiveX)
从用户获取整数值。 支持的平台:仅限 Windows 签名VBA: RetVal = object.GetInteger([Prompt])
返回值 (RetVal)类型:长 用户返回的整数值。 言论AutoCAD 暂停用户输入整数,并将返回值设置为选定值。Prompt 参数指定 AutoCAD 在暂停之前显示的字符串。提示是可选的。 AutoCAD 用户可以输入 -32,768 到 +32,767 范围内的任何有效(短)整数。 如果返回的是关键字而不是整数,或者用户按 Enter 键而未输入值,则 AutoCAD 将生成错误编号 -2145320928(以及错误消息“用户输入是关键字”)。使用该方法从返回值中获取关键字。GetInput 例子VBA: Sub Example_GetInteger() ' This example returns the integer entered by the user. AppActivate ThisDrawing.Application.Caption Dim returnInt As Integer ' Return the value entered by user. A prompt is provided. returnInt = ThisDrawing.Utility.GetInteger("Enter an integer: ") MsgBox "The integer entered was " & returnInt & vbCrLf & _ "(Enter the next value without prompting.)", , "GetInteger Example" ' Return the value entered by user. No prompt is provided. returnInt = ThisDrawing.Utility.GetInteger() MsgBox "The integer entered was " & returnInt, , "GetInteger Example" End Sub 可视化 LISP: (vl-load-com) (defun c:Example_GetInteger() ;; This example returns the integer 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 returnInt (vla-GetInteger (vla-get-Utility doc) "Enter an integer: ")) (alert (strcat "The integer entered was " (itoa returnInt) "\n(Enter the next value without prompting.)")) ;; Return the value entered by user. No prompt is provided. (setq returnInt (vla-GetInteger (vla-get-Utility doc))) (alert (strcat "The integer entered was " (itoa returnInt))) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-19 07:26
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.