[C#] Run AutoCAD

[C#] Run AutoCAD

m-d
Contributor Contributor
2,520 Views
5 Replies
Message 1 of 6

[C#] Run AutoCAD

m-d
Contributor
Contributor

I tryed to run AutoCAD with codes like:

 

Process myProc8;
myProc8 = Process.Start(@"C:\Program Files\AutoCAD 2010\acad.exe");

or:

System.Diagnostics.Process.Start(@"C:\Program Files\AutoCAD 2010\acad.exe");

or:

Process p = new Process();
p.StartInfo.FileName = @"C:\Program Files\AutoCAD 2010\acad.exe";
p.Start();

 

But when AutoCAD starts, show the error, see the attachment "p1", and in command line, see the attachment "p2".

 

How to start AutoCAD with no error and/or with a profile,...

 

 

0 Likes
Accepted solutions (1)
2,521 Views
5 Replies
Replies (5)
Message 2 of 6

m-d
Contributor
Contributor

Change the debug to release, tryed to run from bin file,... result is the same. Anyone?

0 Likes
Message 3 of 6

OysteinW
Advocate
Advocate

I don't know about the second error, but I got the first error recently because I was debugging inside Civil3d while the "Working Directory"-folder in debug-settings was set to AutoCAD install folder. 

 

Try setting "working directory" to "C:\Program Files\AutoCAD 2010\"

 

-Øystein

 

0 Likes
Message 4 of 6

m-d
Contributor
Contributor
0 Likes
Message 5 of 6

OysteinW
Advocate
Advocate
Accepted solution

I haven't tried starting AutoCAD from an external process like you seem to do here, but the error message is the same.

-Wich was resolved by setting working directory in debug settings for my project, or by setting working directory in the shortcut wich starts my program..

 

But I guess this is equivalent to:

 

 

            Process p = new Process();
            p.StartInfo.WorkingDirectory = @"C:\Program Files\AutoCAD 2010\";
            p.StartInfo.FileName = @"C:\Program Files\AutoCAD 2010\acad.exe";
            p.Start();

            Process p = new Process();            p.StartInfo.WorkingDirectory = @"C:\Program Files\AutoCAD 2010\";
            p.StartInfo.FileName = @"C:\Program Files\AutoCAD 2010\acad.exe";            p.Start();

 

 

(But I haven't tested it).

0 Likes
Message 6 of 6

m-d
Contributor
Contributor

I can`t beleve it! It`s working! No errors! Thanks!

0 Likes