C# Process and CATIA

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

Moderator: Moderators

C# Process and CATIA

Postby Jens » Wed Feb 29, 2012 3:06 am

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
Jens
 
Posts: 5
Joined: Wed Feb 29, 2012 3:00 am

Postby ngomes » Wed Feb 29, 2012 8:14 am

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
ngomes
Moderator
Moderator
 
Posts: 1654
Joined: Mon Nov 27, 2006 7:22 am
Location: EU

Hi NGomes

Postby Jens » Thu Mar 01, 2012 3:40 am

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
Jens
 
Posts: 5
Joined: Wed Feb 29, 2012 3:00 am

Postby ngomes » Thu Mar 01, 2012 5:25 am

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.
ngomes
Moderator
Moderator
 
Posts: 1654
Joined: Mon Nov 27, 2006 7:22 am
Location: EU

Postby Jens » Thu Mar 01, 2012 11:36 pm

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
Jens
 
Posts: 5
Joined: Wed Feb 29, 2012 3:00 am

Postby ngomes » Fri Mar 02, 2012 5:05 am

I'm running short of ideas... Have you checked if CATIA works as expect if you start it normally?
ngomes
Moderator
Moderator
 
Posts: 1654
Joined: Mon Nov 27, 2006 7:22 am
Location: EU

Postby Jens » Fri Mar 02, 2012 5:53 am

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]
Jens
 
Posts: 5
Joined: Wed Feb 29, 2012 3:00 am


Return to Developer's Forum for Windows

Who is online

Users browsing this forum: No registered users and 0 guests