Tag Info

Hot answers tagged

11

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 ...


8

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 ...


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 ...


6

Parallel processing is easier 'shown than done.' In the case of stuffing this all into a button, I'm guessing two issues: Multiple threads block the ArcMap UI thread, or ArcMap puts its own schema lock on the data source and doesn't permit the python process access to the data. Hmm looking further issue has been documented here in an ArcGIS Resources ...


5

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 ...


5

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 = ...


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

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

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


4

Doh! 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> ...


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

This may be a better way then trying to read the registry key. This page can be used as a lookup from version number to service pack. Process.GetCurrentProcess().MainModule.FileVersionInfo.FileVersion


4

@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 ...


4

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.


4

According to the official documentation: ArcGIS for Desktop, ArcGIS Engine, or ArcGIS for Server is required to develop with ArcObjects SDK. Microsoft .NET Framework 3.5 Service Pack 1


4

.Net 4 is supported by ArcGIS 10.1, but there is a little extra work you will need to do. http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#//000100000nzv000000 If you require any of the .NET 4.0 Framework functionality, you can extend Esri products with components written in the .NET 4.0 Framework. However, it's your ...


3

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 ...


3

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 ...


3

I believe you have to refresh via IMapSurround. See code below. Dim pMxDoc As IMxDocument Dim pPageLayout As IPageLayout Dim pGC As IGraphicsContainer Dim pElem As IElement Dim pMSF As IMapSurroundFrame Dim pMS As IMapSurround Set pMxDoc = ThisDocument Set ...


3

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>> ...


3

Unfortunately it appears that the ILayerExtensionDraw.BeforeLayerDraw and AfterLayerDraw events are only fired by feature and network layers (see wguidry's post here) and I need to support raster layers, map/image services, mosaic datsets, etc. So in a nutshell here is what I ended up doing. Thanks @Kirk again for the ideas! Created the following classes: ...


3

To maintain partial alpha channel transparency, an IPictureDisp object must be created using some unmanaged code, described in this post on Ryan Gregg's blog. Copy the C# (mirror) or VB.NET (mirror) code to a new code file and add it to your project. Then, instead of the technique in the previously-mentioned answer, set ICommandItem.FaceID to the return ...


3

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:


3

I don't think this is possible (intercepting another tool's private data/events), but the good news is that reinventing the wheel is pretty easy when the inventor shows you how to do it. See the Custom selection extension Add-In Sample, particularly the SelectByLineTool class. You could tweak it to use a NewPolygonFeedback instead of a line feedback, and ...


3

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(); ...


3

No, all add-in framework types are singletons (source), meaning they are only intended to exist one at a time. I am not sure but I think the same is also true for traditional COM dockable windows.


3

Using ArcObjects, this is more or less straight forward. You use mostly the same interfaces, like IFeatureWorkspace, IFeatureClass, IFeatureDataset etc. The main difference is the IWorkSpaceFactory being used; replace SdeWorkspaceFactory with FileGDBWorkspaceFactory. I have created several tools that targets both types using the same code. There are a few ...


3

You could cast the IFeatureClass to an IDataset. IDataset has several properties that might work to get the name of the workspace (or database). You could try IDataset.workspace, which would give you the IWorkspace interface. You could also try IDataset.FullName, which will give you an IName interface object, which could be cast to IWorkspaceName. Hope ...


2

The standard .NET configuration file is per application, not per library. This means that when your addin runs within ArcMap process, your configuration settings need to be specified in ArcMap.exe.config which needs to be placed besides ArcMap.exe. This is of course not always possible in production environment and also violates the isolation of addins, ...



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