Click here to Skip to main content
15,747,908 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?

1 solution

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.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900