Hot answers tagged

24

Keep in mind that Arcpy is essentially a wrapper around ArcObjects. But if you're just trying to call some Python scripts that you don't want to have to rewrite you can spawn a process that calls the python executable with your args. var startInfo = new ProcessStartInfo() { CreateNoWindow = false, UseShellExecute = false, FileName = ...


19

The answer to this question is yes and no. It is possible with some effort to do everything in Python that you could do in .Net, but easy and possible are two very different things. Following that, the simplest interpretation is no, Python Add-Ins cannot do as much as .Net Add-Ins. However, the tasks Python Add-Ins can accomplish are much easier and faster ...


15

Here is an unofficial and still untested solution from ESRI staff. (They did stress that this is not an official solution) Try removing from arcmap.exe.config, in the bin directory. This is the \ArcGIS\Desktop10.0\bin\arcmap.exe.config xml file.


8

I should have searched SO first, I would have found this answer. This seems to work: <Extensions> <Extension id="AmberGIS_ExtensionMgrAddin_ExtMgrExtension" class="ExtMgrExtension" productName="Extension State Manager" showInExtensionDialog="true" autoLoad="true"> <Description>Lets you specify extensions that will be &#13;&#...


8

2 years and 2 version later and this is still a problem. Just finished updating/improving all my addins for 10.2 and came across this problem again. Implemented ALL sugestions in this post and nothing worked but I have discovered 1 additional possible problem. Unfortunately, I am not sure if this was the culprit or not because I've also implemented most ...


8

The Esri ArcGIS Add-In Installation Utility is the installer for the AddIn. A user would typically double-click the *.esriAddIn file which would call ESRIRegAddIn.exe. Alternatively, you could specify AddIn folders. Check out this blog: http://blogs.esri.com/esri/arcgis/2010/05/05/add-ins-for-arcgis-desktop-10/ I think you could still do your dependency ...


8

I have been struggling with this for a long while too. For example the standard blue dot icon for a button does show, but all my custom icons did not. By default Visual Studio sets the build action for an image you add to the solution to 'Content'. Apparently this has to be set to 'AddInContent'. After I changed this, all my button images where visible.


8

The add-in model is a new feature in version 10.0. This means you will not be able to use an add-in at lower versions, which require you to implement your commands, extensions, toolbars etc. in the older COM-only model.


7

As far as I can tell you are implementing the error handling that ESRI is currently putting out there as best practice. If you were to grab a hold of the application's (ArcMap) unhandled exceptions you could potentially be then displaying messages about errors that were not part of your AddIn. Most of the AddIns you write are probably going to be buttons ...


7

The Python option works for me: c:\Python26\ArcGIS10.0\python.exe C:\sandbox\py\misc\UpdateAddInVersionNumber.py "$(ProjectDir)Config.esriaddinx" (Python gurus, feel free to jump in and make it better) UpdateAddInVersionNumber.py: import os, sys import xml.dom.minidom import datetime filename = sys.argv[1] print filename b = 0 doc = xml.dom.minidom....


7

I did not per se figure it out becuase i don't really understand what is going on here but I was trying different things until it worked. I am not sure whether it is suppose to work or whether this crudity can even be called a workaround but here it goes: Keep both "ESRI.ArcGIS.AddIns.targets" and "ESRI.ArcGIS.AddIns.11.targets" in the "C:\Program Files (...


6

Right so I figured out how to configure the addin. Thanks to the suggestions from other people - I've commented where relevant - I'm not simply adding my own answer for point-whoring purposes, but none contained the full approach. The addin file in ...Documents\ArcGIS\AddIns\Desktop10.0... gets expanded every time ArcMap loads, so the only place that ANY ...


6

The key to proper parenting of WPF windows within a non-WPF application is to use the WindowInteropHelper class. Suppose you have a WpfWindow class which is a WPF window (derives from Window): private void ShowWpfWindowModal() { var parentHandle = new IntPtr(_app.hWnd); // the ArcMap window handle var wpfWindow = new WpfWindow(); //...


5

The only time I have gotten this is when I had another ArcMap instance open and forgot to close it before building/debugging. If you don't close all instances using the assembly then the old one will continue to be used. Or something like that.


5

Try using the SetWindowPos winapi call with the hWnd of the dockable window control (or maybe it's parent or grandparent container control) with the HWND_TOP flag.


5

Borrowing from a similar answer, you might use this in your addin: string configPath = System.IO.Path.Combine(this.GetType().Assembly.Location,"Config.xml");


5

As my project's .NET Framework is 4.0, I changed to supportedRuntime version="v4.0.30319" in ArcMap.exe.config and I noticed that the problem was delayed by this change. I also remembered that ArcMap also loads ArcCatalog so I changed also ArcCatalog.exe.config to supportedRuntime version="v4.0.30319" and YES!!! It's working again. I spent all day trying to ...


5

You can use dictionaries for this type of thing. There are more memory efficient ways of doing this (by just storing field names once), but this might get you started. public void TestGetSelection() { var dict = GetSelection(ArcMap.Document.FocusMap.get_Layer(0) as IFeatureLayer); foreach (KeyValuePair<int, Dictionary<string, object>> ...


5

@ChadCooper, perhaps I'm overlooking something, but with regard to your 3rd case: A Python script that launches a PyQT/wxPython/Tk GUI.. Is there a reason why you couldn't use the .Net Process API (see System.Diagnostics) to execute your custom Python script over Standard In/Out? Of course, this sort of architecture will assume a proper version of ...


5

I'm not sure how accurate this is, but I've done this in the past: Create a LayerExtension class that implements ILayerExtensionDraw. Within the class keep a list of timings. A Timing is a class with a start tick and an end tick property. When BeforeLayerDraw is called for esriDPGeography, instantiate a new timing intance and set the StartTick property ...


5

If you have ArcEditor or ArcInfo license level you can your Cartograpic Representations to show vertices. You can use maker (= point symbol) on top of a line to show all vertices. See option on vertices in ArcGIS Help:


5

Yes, since you are presumably using VB.NET (not VB, which is 20+ years old and no longer supported), you need to use the Imports statement to import namespaces. Specifically you want to put Imports ESRI.ArcGIS.Geometry at the top of your code files. Alternatively you could fully qualify the IPoint type every time you use it (ESRI.ArcGIS.Geometry.IPoint) ...


5

For deploying without any setup tool, double-click the *.esriAddIn file. This file could be found in the debug folder, after build the project in Visual Studia 2010. Add-ins for ArcGIS Desktop 10 For deploying a custom component using a setup tool: How to deploy a custom component using a setup project


5

Yes there are several ways to do this. I would recommend building a script tool and packaging it with your add-in. I have a sample project that does this listed in this answer: How can I programmatically get the path of "Python.exe" used by ArcMap See also: Running Arcpy script from ArcObjects Leveraging ArcPy in a .NET application


5

This is just conjecture, but there is probably some variable-width text measurement logic going on behind the scenes, and the character W was probably chosen because it is one of the widest characters available in variable-width fonts. I agree that it is a bit nonsensical to do it this way.


5

ArcGIS Pro currently does not support Python add-ins. There were no plans for a Python Add-in support in ArcGIS Pro. ArcGIS Pro has arcpy site package shipped though (you can author Python script tools). Your only option is ArcGIS Pro .NET SDK which is going to be released soon (it is in beta now). UPDATE: from Esri Forum ArcGIS Pro will feature a new ....


5

ArcGIS Runtime SDK and ArcGIS Addins are two different things. If you want to develop standalone application then choose ArcGIS Runtime Sdk. If you want to extend ArcGIS Desktop , then you should start developing with ArcObjects (e.g. using addins). So first install ArcGIS Desktop and then install ArcObject SDK for .NET which is accompanied with ArcGIS ...


4

Yes it is possible to reference a built-in command (button) on a custom menu/toolbar (What I really need to do). It is not possible to redefine a built-in command (What I was trying to do). One can reference a built-in command on a custom menu/toolbar like this. <Menu id="my_id" caption="Cool_tools"> <Items> <Button ...


4

In your code that you gave as an example. In my testing this worked for me. new Thread(() => { MessageBox.Show(String.Format("The value '{0}' is not an integer!", currentValue)); }).Start(); Edit To incorporate the great comments, and as Petr pointed out that this way may be dangerous here is the other way of doing this as well: ...


4

Addins are based on managed code (or Java), so you can develop them in managed C++/CLI, not in pure C++.



Only top voted, non community-wiki answers of a minimum length are eligible