CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2023 开发者帮助

PostCommand 方法 (ActiveX)

2024-5-18 18:56| 发布者: admin| 查看: 14| 评论: 0|原作者: admin|来自: AutoCAD

PostCommand 方法 (ActiveX)

将命令字符串发布到文档,以便在文档进入空闲状态时执行。

支持的平台:仅限 Windows

签名

VBA:

object.PostCommand Command
对象

类别: 文档

此方法应用到的对象。

命令

访问:仅输入

类型:字符串

要发布的命令字符串。

返回值 (RetVal)

无返回值。

言论

在命令字符串末尾使用空格或 ASCII 回车符 () 结束命令;这相当于按键盘上的 Enter。vbCr

此方法处理任何 AutoCAD 命令行函数,包括 AutoLISP 表达式。

如果文档未处于活动状态,则文档将处于激活状态,并在文档具有焦点时执行字符串。

此方法是异步的。如果需要同步执行命令字符串,请使用该方法。SendCommand

例子

VBA:

Sub Example_PostCommand()
   ' This example sends a command for evaluation to the AutoCAD Command prompt
   ' of the current drawing
   
   ' Start creating a Circle in the active drawing
   ThisDrawing.PostCommand "._circle" & vbCr & "2,2,0" & vbCr
   
   MsgBox "CIRCLE command has been started, enter a radius to finish the command."
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_PostCommand()
    ;; This example sends a command for evaluation to the AutoCAD Command prompt
    ;; of the current drawing
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Start creating a Circle in the active drawing
    (vla-PostCommand doc "._circle 2,2,0 ")
   
    (alert "CIRCLE command has been started, enter a radius to finish the command.")
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-6-27 16:03

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部