几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » ObjectARX(VB.NET/C#)
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-04-19, 09:50 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】arx调用autocad内部命令方法大集合。

arx调用autocad内部命令方法大集合。
www.dimcax.com
arx调用autocad内部命令方法大集合。
objectarx调用autocad内部命令方法大集合 objectarx
ads_queueexpr()
this old favourite is intended to be used from acrxentrypoint() to execute a sequence of commands after (s::startup) has been called from lisp (as you are not able to use acedcommand() from this context)
you need to declare it yourself (extern "c" void ads_queueexpr( achar *) before use
it has been unsupported as long as i can remember, but is widely-used and mentioned in the tips & techniques section of the objectarx developer's guide
acapdocmanager::sendstringtoexecute()
this function has the advantage of a few more options being available as arguments, mainly around where to execute the string (which document, and whether it be activated), and whether to echo the string to the command-line
::sendmessage()
this is a standard win32 platform api and so can, in effect, be used to drive autocad from an external client. it uses a structure to pass the string that is often a bit tricky to set up (it became a migration issue when we switched to unicode, for example)
iacaddocument::sendcommand()
this com method is the only way (other than acedcommand() or acedcmd()) to execute a command synchronously from autocad (and even then it may not be completely synchronous if requiring user input)
acedcommand()
this is the objectarx equivalent to (command), and is genuinely synchronous. unfortunately (as mentioned earlier) there are issues with using it directly from a natively-registered command, so i'd recommend only using it from aceddefun()-registered commands (see the objectarx documentation and the below sample for more details)
vba (some of which also applies to vb)
thisdrawing.sendcommand
this is the same as iacaddocument::sendcommand() from c++
sendkeys
this is just a simple technique to send key-strokes to the command-line
sendmessage
this is just the win32 api mentioned above, but declared and called from vb(a)
尽管有着相同的方法或者函数,但是不同的开发语言方法或者函数使用方式却不径相同,例如sendstringtoexecute() ,在vb.net中的用法是: public void sendstringtoexecute( string command, boolean activate, boolean wrapupinactivedoc, boolean echocommand ); parameterscommand string to use as input. activate boolean indicating whether to activate the target document. wrapupinactivedoc boolean indicating whether to queue current active document to complete in the next onidle() when switching active documents. echocommand boolean indicating whether the sent string is echoed on the command line. 在c#中的用法又是这样的: virtual acad::errorstatus sendstringtoexecute( acapdocument* pactargetdocument, const char * pszexecute, bool bactivate = true, bool bwrapupinactivedoc = false, bool bechostring = true) = 0;pactargetdocumentdocument to send input to
pszexecutestring to use as input
bactivateboolean indicating whether to activate the target document
bwrapupinactivedocboolean indicating whether to queue current active document to complete in next onidle() when switching active documents.
bechostringboolean indicating whether the sent string is echoed on the command line
研究了一段时间的vb.net与objectarx,发现vb.net能用的函数或方法比vc++、c#要少一些,而且用法还不一样,有时就为一个函数就卡住了,真是叫人心急。
搞错了,vb.net和c#是差不多的,不过和vc++差别比较大忘了说明上面的方法中比较适合vb.net的是sendstringtoexecute()和调用api函数user32然后通过sendmessage()来实现cad内部命令。 但是个人使用sendstringtoexecute()测试过,怎么会报错,而且关闭错误提示后,还是可以执行 line命令来画线。
谢谢.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭



所有的时间均为北京时间。 现在的时间是 12:09 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多