将参数传递给.NET定义的命令 [英] Passing arguments to .NET-defined commands

查看:53
本文介绍了将参数传递给.NET定义的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Autocad 2000i的命令行上编写命令,并且希望autocad提示输入参数.然后,我的vb.net程序将根据收到的参数进行操作.

I need to write a command on the command line on Autocad 2000i and I want autocad to prompt for a parameter. Then my vb.net program will act based on the recieved parameter.

基本上我想我的解决方案就在这里: http://through-the-interface.typepad.com/through_the_interface/2006/09/passing_argumen.html

Basically I guess my solution is all here: http://through-the-interface.typepad.com/through_the_interface/2006/09/passing_argumen.html

问题是,我找不到在其中使用的Autodesk.AutoCAD.EditorInput命名空间的引用.

Problem is, I cant find the reference to the Autodesk.AutoCAD.EditorInput namespace being used in there.

我在这里想念什么?在Autocad 2000i中还不存在EditorInput吗?

What am I missing here? Did EditorInput not exist in Autocad 2000i yet?

非常感谢您的回答.

我有一个vb.net项目,该项目向autocad添加了一个工具栏.我想让用户通过编写命令和参数来更改工具栏中组合的选定值.

I have a vb.net project which adds a toolbar to autocad. I want to let the user change the selected value of a combo in my toolbar, by writing a commnad and a parameter.

如何在我的项目中使用您的方法?是否将dvb文件放入我的项目中?可以将vba文件集成到我的vb.net项目中吗?

How can I use your method in my project? Do I put the dvb file in my project? Can the vba file be integrated in my vb.net project?

非常感谢.

推荐答案

.Net API早在2000年就不存在于AutoCAD.这些事情是通过LISP或VBA或两者结合来完成的.这是要做的事情的简要说明.

.Net API did not exist for AutoCAD back in 2000. Things were done through LISP or VBA or a combination of both. Here is a brief explanation of things to do.

仅VBA方式:

打开工具>宏> Visual Basic编辑器(alt + F11)

Open Tools > Macro > Visual Basic Editor (alt + F11)

输入您的代码:

Sub Test()

Dim str As String
str = InputBox("Enter radius:")

MsgBox str

End Sub

在命令提示符下键入-vbarun" (不带引号)

Type "-vbarun" in command prompt(without quotes)

键入"Thisdrawing.Test" (模块名.功能名)

Type "Thisdrawing.Test" (modulename.functionname)

VBA + Lisp方式-(我的首选方法)

如上所述,在编辑器中键入您的代码.保存您的vba文件(.dvb格式)..假设它位于名为 MyDvb.dvb.

Type your code in the editor as mentioned above. Save your vba file (.dvb format)..suppose it is in D:\Macros folder with the name MyDvb.dvb.

创建一个新的Lisp文件(打开记事本并在下面键入代码,并另存为.lsp扩展名)此Lisp文件将用于调用所有VBA宏.

Create a new Lisp File(open a notepad and type the code below and save as .lsp extension) This lisp file will be used to call all the VBA macros.

(defun c:testcommand()
  (command "vbarun" "D:/Macros/MyDvb.DVB!ThisDrawing.Test")
)

现在通过在命令提示符下键入"ap" 来加载该Lisp一次.这有助于我们使该命令可用于该会话.

now load this lisp for one time by typing "ap" at the command prompt. This helps us to keep the commands available for the session.

输入"testcommand" ,您将看到代码已执行

Type "testcommand" and you will see your code executed

这篇关于将参数传递给.NET定义的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆