POST
|
What about that: embed your Python script into a Python script tool inside a custom toolbox. Extent your add-in with a button. If the user clicks the button, the add-in runs the script tool (synchron) and after it finished, it does the other stuff with ArcObjects. For deployment (to the assembly cache) you can add the custom toolbox as a resource to the add-in. The code for using an embedded toolbox is something like that: // Initialize the geoprocessor. IGeoProcessor2 gp = new GeoProcessorClass(); // Add the toolbox. string strPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string strToolbox = strPath + "\\PythonTools.tbx"; gp.AddToolbox(strToolbox); // Generate the array of parameters. IVariantArray parameters = new VarArrayClass(); parameters.Add(inString); // Execute the model tool by name. IGeoProcessorResult result = gp.Execute("Reply", parameters, null); // Ergebnis zurückliefern string reply = result.GetOutput(0).GetAsText();
... View more
08-24-2012
04:10 AM
|
0
|
0
|
909
|
POST
|
I think the code is fine. I tested it, and for me it worked: import arcpy value = arcpy.GetParameterAsText(0) if value == "#" or value == "": value = None if value: arcpy.SelectLayerByAttribute_management("dachflaechen","NEW_SELECTION", "\"OBJECTID\" = "+value) else: arcpy.AddError("no value")
... View more
08-21-2012
03:49 AM
|
0
|
0
|
367
|
POST
|
Hi Laura the spatial statistics tool "Directional Distribution (Standard Deviational Ellipse)" may help Jochen
... View more
08-17-2012
06:28 AM
|
0
|
0
|
1006
|
POST
|
Hi Andreas123 There is no possibility to use two iterators within one model. But if there is a logic to match the file_name to the mask_name, you can use the model-only tool "Calculate Value" to map the right mask to the current file. Jochen
... View more
08-16-2012
06:51 AM
|
0
|
1
|
4459
|
POST
|
How do I locate my AddIn Extension to use functionality within the code of an AddIn Button correctly. The "ArcMap.Application.FindExtensionByName(...)" is working, but I receive an IExtension Interface and its not possible to cast to other interfaces implemented into the AddIn Extension. If I try this: IExtension ext = ArcMap.Application.FindExtensionByName("myDemoExt"); IDemoExt demoExt = (IDemoExt)ext; I receive the error: "Unable to cast COM object of type 'System.__ComObject' to interface type 'Demo.IDemoExt'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{C1DA7464-AAA7-3B1E-8B02-BB571D92E278}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))." My AddIn Extension looks like this: public class DemoExt : ESRI.ArcGIS.Desktop.AddIns.Extension, IDemoExt
... View more
01-04-2010
06:02 AM
|
0
|
3
|
2505
|
POST
|
start Visual Studio 2008 with the command "run as administrator" - then it works fine
... View more
11-19-2009
12:58 AM
|
0
|
0
|
1089
|
POST
|
I have a installation of ArcGIS Desktop 9.4 and the ArcObjects SDK on a Windows Server 2008 R2 (64 bit). I generated in Visual Studio 2008 a Desktop Class Library from the ESRI Templates and generated a Command based on BaseCommand. If I compile the solution (for the x86 platform), an error occures: "The command "esriRegasm.exe "C:\Data\jm\JMLib1\JMLib1\bin\x86\Debug\JMLib1.dll" /v 9.4 /p Desktop /s" exited with code -1." If I run the esriRegasm from the CommandLine - or using the context menu in the explorer - esriRegasm fails with: "Registration failed. Could not write to disk". My account is in the Administrator Group.
... View more
11-17-2009
06:52 AM
|
0
|
14
|
5491
|
Online Status |
Offline
|
Date Last Visited |
01-12-2021
03:05 AM
|