从C#对话框中绘制AutoCAD图形? [英] Autocad drawing from c# dialogue?

查看:95
本文介绍了从C#对话框中绘制AutoCAD图形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好..这就是我想要做的.
1)在Autocad中添加自定义工具栏,并带有自定义按钮. (完成)
2)假设用户单击其中一个自定义按钮,我的C#应用​​程序运行,它显示了一个对话框,用户可以在其中输入一些值-例如,一条线的两个点的X和Y坐标.
3)当用户在我的C#应用​​程序中单击确定"时,将在Autocad中运行由我的应用程序生成的Lisp脚本(Voilla,该行出现)

我知道如何在Autocad中创建按钮,然后运行命令以打开外部应用程序(因此,我知道如何使我的C#应用​​程序从autocad中运行.
但是如何在c#应用程序中给定命令的情况下使autocad加载脚本?

Hey guys..Here is what i want to do.
1) Add custom toolbar in Autocad,with custom buttons. (Done)
2) When let''s say the user clicks one of the custom buttons, my C# app runs, it shows a dialogue where the user can enter some values -for example the X and Y coordinates for the 2 points of a line.
3) When the user clicks OK in my C# app, in Autocad a Lisp script generated by my app is to be run (Voilla, the line appears)

I know how to make a button in Autocad run a command to open an outside application (so i know how to make my c# app run from autocad.
But how can I make autocad load a script given a command in my c# app?

推荐答案

要在AutoCAD中运行脚本,请使用SCRIPT命令,后跟文件名您的脚本文件.为了避免出现对话框,您必须在调用SCRIPT命令之前将变量FileDia设置为0(零).
1.使AutoCAD成为活动应用程序.

2.使用键盘挂钩(在CodeProject上找到解决方案)将SCRIPT命令和文件名发送到AutoCAD.

我没有尝试过,但这是一种可能的解决方案.
To run a script in AutoCAD you use the SCRIPT command followed by the filename of your script file. To avoid dialog boxes you have to set the variable FileDia to 0 (zero) before calling the SCRIPT command.

1. Make AutoCAD the active application.

2. Use a keyboard hook (a solution for this is found on CodeProject) to send the SCRIPT command and filename to AutoCAD.

I haven''t tried this but it''s one possible solution.


这篇关于从C#对话框中绘制AutoCAD图形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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