Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm creating a custom ArcToolbox tool in C# .NET in ArcGIS 10 SP2. Though I seem to be having two issues which maybe related:

Firstly, my tool is run as a background task i.e. the GP dialog does not show, instead the progress bar displays on ArcMap's status bar. Can I get the GP progress pop up dialog to display instead when my GP tool is executed?

Secondly, I want to use IGPUtilities3:AddToMap or IGPUtilities3:GetMap() in the execute method of the GPFunction class but neither work. Either my dataset doesn't get added or GetMap() return null. If I check the InApplication or CanAddToMap properties they return false. I'm just doing a IGPUtilities3 utils = new GPUtilitiesClass.

I guess it hasn't tied into the ArcMap application but how do I fix this in a GPFunction class?

Thanks Rob

share|improve this question
    
How exactly do you execute your tool? The InApplication always returns true for me inside ArcMap or ArcCatalog –  Petr Krebs Nov 22 '11 at 16:53
    
This is what I found weird! I run it inside ArcMap. So double click on the tool from the ArcToolbox window. Have you run any custom GP tools since the upgrade to ArcGIS 10? –  Rob Nov 22 '11 at 16:55

1 Answer 1

It looks to me like both issues here are related:

1) Your tool probably runs in the background because the ArcMap is set to do so. In order to disable this, go to Geoprocessing->Geoprocessing Options, and uncheck "Background processing".

2) In some cases you won't get a pointer from GetMap(), e.g when running in the background, or when executing from the ArcCatalog application. Since your tool runs in the background, you might have gotten into trouble if several threads are messing around with the same map pointer..

  • Oyvind
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.