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 am executing the copy features tool via the geoprocessor inside my .net custom geoprocessing function tool. When the copy features tool executes it is writing it's messages to my tool's results. I want to stop these messages from being written and handle them myself. Is there a way to stop a geoprocessor from writing messages? I am writing .net on 10.1.

This is the code I am running the tool with.

            IGeoProcessor2 gp = new GeoProcessorClass();
            IGeoProcessorResult results = new GeoProcessorResultClass();
            IVariantArray parameters = new VarArrayClass();
            parameters.Add(tempFC);
            parameters.Add(outFC);
            results = gp.Execute("CopyFeatures_Management", parameters, null);
share|improve this question
    
Did you try implementing IGeoProcessorEvents3 such that it calls Clear() on the IGpMessages passed to the OnProcessMessages? You'll need to register your class with RegisterGeoprocessorEvents3. –  Kirk Kuykendall Jun 4 '13 at 20:59

3 Answers 3

Gus,

I've not tested this but there is an interface called IGeoProcessorSettings2 which has a LogHistory property which you can set to false.

Failing that you could call the IGeoProcessor2 method ClearMessages to blitz everything?

share|improve this answer
    
Thanks, that looked really promising. I tried setting IGeoProcessorSettings2 LogHistory to false but the message still posted to my tools dialog. I then tried ClearMessages. It cleared the messages from the IGPMessages but not before the message posted to my tools dialog. –  TurboGus May 29 '13 at 15:49

You can always get an instance of the particular IGPFunction and execute it yourself. It is less convenient than using the IGeoProcessor since it requires you to handle the input and output parameters all yourself (which you probably know how to do if you develop your own tool), but it also allows you to have full control over the messages the tool produces.

share|improve this answer
up vote 0 down vote accepted

The solution was to set IGeoProcessor2.AddToResults to false.

Something like

 IGeoProcessor2 gp = new GeoProcessorClass();

 gp.AddToResults = false;

 IGeoProcessorResult results = new GeoProcessorResultClass();
 IVariantArray parameters = new VarArrayClass();
 parameters.Add(tempFC);
 parameters.Add(outFC);
 results = gp.Execute("CopyFeatures_Management", parameters, null);
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.