C# Process and CATIA

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
Jens
Posts: 5
Joined: Wed Feb 29, 2012 3:00 am

C# Process and CATIA

Post by Jens »

Hello all,

I have the following Propblem.
If I Start CATIA via a Process from a C# User Form, the Space Pilot did not
work. Any suggestions

Kind regards.

Jens
ngomes
Moderator
Moderator
Posts: 3340
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Post by ngomes »

Hi Jens,

Not sure we follow you.

Are you spawning a CNEXT.exe from an WinForms C# program? And when you do, the 3D mouse will not work in CATIA?

How are you configuring the environement that CNEXT.exe runs in? A common pitfall is to use the ADT_ODT_IN environment variable to speed up application start. That will cause the 3D mouse (and other input devices)support to be disabled. For more information, refer to this FAQ article.
Nuno Gomes
Jens
Posts: 5
Joined: Wed Feb 29, 2012 3:00 am

Hi NGomes

Post by Jens »

Ok, I will try to explain the Problem.
I have a C# Windows Application with a Form.
On the Form there is a Button. In the Button Click Event I do the Following

Code: Select all

            string CATDLLPath = @"C:\Program Files\Dassault Systemes\B19_SP09\win_b64\code\bin";
            string EnvironmentName = @"Catia_B19_SP09_HF0";
            string ApplicationPath = @"C:\Users\Jens.Schimmelpfennig\AppData\Roaming\Test";
            bool AdminMode = false;
            ProcessStartInfo psi = new ProcessStartInfo("\"" + CATDLLPath + "\\CATStart.exe" + "\"");


            if (!AdminMode)
            {
                psi.Arguments = " -run \"CNEXT.exe\" -env " + "\"" + EnvironmentName + "\"" + " -direnv " + "\"" + ApplicationPath + "\"" + " -nowindow";
            }
            else
            {
                psi.Arguments = " -run \"CNEXT.exe -admin\" -env " + "\"" + EnvironmentName + "\"" + " -direnv " + "\"" + ApplicationPath + "\"" + " -nowindow";
            }

            Debug.WriteLine(psi.FileName + " " + psi.Arguments);

            IntPtr oCatiaHwnd= IntPtr.Zero;
            bool bFound = false;

            psi.UseShellExecute = false;
            psi.RedirectStandardOutput = false;
            psi.RedirectStandardError = true;

            //Prozess starten und auf dessen Ende warten
            //using (Process process = new Process())
            Process process = new Process();
            {
                process.EnableRaisingEvents = true;

                process.StartInfo = psi;
                process.Start();
                Application.DoEvents();
                Process[] Ps = Process.GetProcesses();
                int L = Ps.Length;
                int timeout = 5000;
                process.WaitForExit(timeout);
            }
In the Environment File there is no Entry ADT_ODT_IN.
Hope this explains my problem better.

Kind regards

Jens
ngomes
Moderator
Moderator
Posts: 3340
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Post by ngomes »

Do you see an empty CATProduct after launching CNEXT?

Try enabling your application process in the firewall. CNEXT needs to access to the loopback network device to funciton properly. By launching CNEXT from your application, you may be restricting the spawn process.
Jens
Posts: 5
Joined: Wed Feb 29, 2012 3:00 am

Post by Jens »

Hi,

Yes I See an Empty CATProduct when I Start CATIA from my Application.
I have Enabled my Application in thw Windows Firewall, but the problem is still the same.

Kind regards

Jens
ngomes
Moderator
Moderator
Posts: 3340
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Post by ngomes »

I'm running short of ideas... Have you checked if CATIA works as expect if you start it normally?
Jens
Posts: 5
Joined: Wed Feb 29, 2012 3:00 am

Post by Jens »

After some investigations, I found the Problem.
My Application needs for some Task Admin rights.
So I add a Manifest to my Application

Code: Select all

requestedExecutionLevel  level="requireAdministrator" uiAccess="false" 
this is the Problem. When I Change the Line above to the following
all works fine !

Code: Select all

requestedExecutionLevel  level="asInvoker" uiAccess="false" 
btw. CATIA works fine if I start CATIA with a Desktop Short cut.
Any Solutions ?

Kind regards.

Jens[/code]
Post Reply