Select to view content in your preferred language

Utilizing Python Models through add-in button (C#)

810
2
Jump to solution
02-11-2013 03:58 AM
KevinYanuk
Deactivated User
Hello,

I am trying to run a few GIS models (quite a few) through a button click and simple add-in form.  I'd like to receive the messages sent back from the model into, say, a listbox or label.

this is my code thus far:
            IGeoProcessor2 gp = new GeoProcessorClass();             gp.OverwriteOutput = true;              gp.AddToolbox(@"C:\data\ADAmapping\ADA_Tools.tbx");              IVariantArray parameters = new VarArrayClass();              parameters.Add(date);             parameters.Add(username);             parameters.Add(quarterly);             parameters.Add(monthly);             parameters.Add(yearly);              try             {                 gp.Execute("SnapshotADAData", parameters, null);                 gp.GetMessages( ??? );   // WHAT IS THE PROPER USE HERE             }               [...]


Is this the proper way to retrieve the messages? (after the Execute function?)
What is the pSeverity object supposed to be?

Thank you,

Kevin
0 Kudos
1 Solution

Accepted Solutions
AlexanderGray
Honored Contributor
Hi there, I have always used getMessage (no 's') with the index of the message to retrieve.  Base on some examples, the value passed in is an integer that reflects the message severity you want.  Based on the second example, I assume that passing in a null objects will return all messages.

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//000100000424000000
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//000100000102000000

View solution in original post

0 Kudos
2 Replies
AlexanderGray
Honored Contributor
Hi there, I have always used getMessage (no 's') with the index of the message to retrieve.  Base on some examples, the value passed in is an integer that reflects the message severity you want.  Based on the second example, I assume that passing in a null objects will return all messages.

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//000100000424000000
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//000100000102000000
0 Kudos
KevinYanuk
Deactivated User
Hi there, I have always used getMessage (no 's') with the index of the message to retrieve.  Base on some examples, the value passed in is an integer that reflects the message severity you want.  Based on the second example, I assume that passing in a null objects will return all messages.

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//000100000424000000
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//000100000102000000


Excellent!  Thank you, Alexander.
0 Kudos