0

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

2
  • How exactly do you execute your tool? The InApplication always returns true for me inside ArcMap or ArcCatalog
    – Petr Krebs
    Commented Nov 22, 2011 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
    Commented Nov 22, 2011 at 16:55

2 Answers 2

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

0

An alternative option for your first question would be to use IProgressDialogFactory Interface for the processing dialog. The link above has a sample code for your reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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