从用户获取整数值。 支持的平台:仅窗口 签名工 务 局: RetVal = object.GetInteger([Prompt])
返回值(RetVal)类型:长 用户返回的整数值。 言论AutoCAD 会暂停用户输入整数,并将返回值设置为所选值。提示参数指定 AutoCAD 在暂停之前显示的字符串。提示是可选的。 AutoCAD 用户可以输入 -32,768 到 +32,767 范围内的任何有效(短)整数。 如果返回的是关键字而不是整数,或者如果用户按 Enter 键而不输入值,AutoCAD 将生成错误号 -2145320928(以及错误消息“用户输入是关键字”)。使用该方法从返回值中获取关键字。GetInput 例子工 务 局: 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 Visual 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-8 19:20
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.