I have a layer file. I make a button in ArcGIS 10 with .NET. I want to change layer symbology with the layer file. For this purpose I Write python code and execute it from C#. If the following code is written in python window of ArcGIS, then works fantastic. But from my code, it does not work. Can anyone help me ??
try { const string prg = @"import sysimport arcpyfrom arcpy import envmxd = arcpy.mapping.MapDocument('CURRENT')layer = arcpy.mapping.ListLayers(mxd)[0] arcpy.ApplySymbologyFromLayer_management(layer,'C:\Users\DELL\AppData\Local\Temp\Junctions_Temp.lyr')" ; var sw = new StreamWriter("D:\\test2.py"); sw.Write(prg); // write this program to a file sw.Close(); var p = new Process { StartInfo = { FileName = @"C:\Python26\ArcGIS10.0\python.exe", RedirectStandardOutput = true, UseShellExecute = false, Arguments = "D:\\test2.py " } }; // create process (i.e., the python program p.Start();
Thanks ...
أكثر...
try { const string prg = @"import sysimport arcpyfrom arcpy import envmxd = arcpy.mapping.MapDocument('CURRENT')layer = arcpy.mapping.ListLayers(mxd)[0] arcpy.ApplySymbologyFromLayer_management(layer,'C:\Users\DELL\AppData\Local\Temp\Junctions_Temp.lyr')" ; var sw = new StreamWriter("D:\\test2.py"); sw.Write(prg); // write this program to a file sw.Close(); var p = new Process { StartInfo = { FileName = @"C:\Python26\ArcGIS10.0\python.exe", RedirectStandardOutput = true, UseShellExecute = false, Arguments = "D:\\test2.py " } }; // create process (i.e., the python program p.Start();
Thanks ...
أكثر...