Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

How do I call IGPTool.Execute from C#?

$
0
0
I don't want to AddToolbox to get to this tool. It works fine if i use the AddToolbox (using .sde file) from the Geoprocessor but that defeats the purpose.

Code:

IToolboxWorkspace toolboxWs = this.Workspace as IToolboxWorkspace;
                 
                 
                    // CREATE LAYER ARG FOR LAUNCHPAD
                    IVariantArray makeFeatureLayerParams = new VarArrayClass();
                    makeFeatureLayerParams.Add(_valveFc);
                    makeFeatureLayerParams.Add("VALVE");
                    g.Execute("MakeFeatureLayer_Management", makeFeatureLayerParams, null);

                    // POPULATE PARAM LIST FOR LAUNCHPAD
                    IVariantArray irthParameters = new VarArrayClass();
                    irthParameters.Add(this.OutputDir);
                    irthParameters.Add(this.BufferSize);
                    irthParameters.Add("VALVE");

                    IArray irthParameters2 = new ArrayClass();
                    irthParameters2.Add(this.OutputDir);
                    irthParameters2.Add(this.BufferSize);
                    irthParameters2.Add("VALVE");


                    // FIND THE LAUNCHPAD TOOL
                    IEnumGPTool tools = toolboxWs.OpenToolbox("EDGEADM.Irth").Tools;
                    IGPTool tool;
                    IGPFunction2 irthGPFunction = null;

                    while ((tool = tools.Next()) != null)
                    {
                        if (tool.Name == "LaunchPad")
                        {
                            g.AddToolbox(@"c:\Users\kknoche\AppData\Roaming\ESRI\Desktop10.0\ArcCatalog\edgeadm.sde\EDGEADM.Irth");
                            break;
                        }
                    }


                   
                    IGPComHelper gpCom = new GpDispatch();
                    ITrackCancel tc = new GPServerTrackCancel();
                    tool.Execute(irthParameters2, tc, gpCom.EnvironmentManager, NewGPMessages());

Thanks for anyhelp

Viewing all articles
Browse latest Browse all 1374

Trending Articles