Search code examples
c#.netautocad

running commands of autocad from c#


I'm working on an integration project that utilizes commands of AutoCAD. My goal is to execute the command in AutoCAD using c#. In my work this is what I use to open the app but when i perform the SendCommand() function to execute the command i want to execute, It just forwards the text in the command line of autocad waiting to be entered not automatically run after the sendcommand(). I was hoping that you can help me with this one. I'm still new in this kind of stuff. Help is very well appreciated.

Here is my code snippet:

acApp1 = new AcadApplication();
acApp1.Visible =true;
acApp1.WindowState = AcWindowState.acMin;
acApp1.ActiveDocument.SendCommand("_CYLINDER")

*cylinder is only an example command for the code. Thank you very much for the kind response.


Solution

  • I suppose Your problem may be because You need [space] at the end of command

    acApp1.ActiveDocument.SendCommand("_CYLINDER ") ;