string command = "python " + @"c:\test.py"; try { // Create the ProcessStartInfo using "cmd" as the program to be run, and "/c " as the parameters. "/c" tells cmd that you want it to //execute the command that follows, then exit. ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", "/c " + command); // The following commands are needed to redirect the standard output. This means that it will be redirected to the Process. //StandardOutput StreamReader. procStartInfo.RedirectStandardOutput = true; procStartInfo.UseShellExecute = false; // Do not create the black window. procStartInfo.CreateNoWindow = true; // Now you create a process, assign its ProcessStartInfo, and start it. Process proc = new Process(); proc.StartInfo = procStartInfo; proc.Start(); // Get the output into a string. string result = proc.StandardOutput.ReadToEnd(); // Display the command output. Debug.WriteLine(result); //MessageBox.Show(result); } catch (Exception objException) { Debug.WriteLine(objException.Message); //MessageBox.Show(objException.Message); // Log the exception and errors. } |
import arcpy mxd = arcpy.mapping.MapDocument(r"C:\workspace\dl\density.mxd") msd = r"C:\workspace\dl\msd\density5.msd" df = arcpy.mapping.ListDataFrames(mxd,"Map2")[0] arcpy.mapping.ConvertToMSD(mxd,msd,df,"NORMAL","NORMAL") del mxd,msd |
درباره این سایت