HRESULT E_FAIL Error while calling custom model tool

793
0
03-13-2017 01:34 AM
chandrasekhar_reddyguda
New Contributor III

I have created a custom model tool. If we run this tool on ArcMap, we noticed that the tool is  working fine. where as if we call the same in Arc Objects under Geo-processing tool, it is throwing an error as shown below

Note: 

My Code:

IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass();
IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspaceFactory.OpenFromFile(@"C:\temp\IDW\New\ShapeFiles", 0);
IFeatureClass pSourceFC = featureWorkspace.OpenFeatureClass("BA31_3429_2016");


Geoprocessor GP = new Geoprocessor();
GP.SetEnvironmentValue("Extent", "1745440.000 5922240.000 1745920.000 5921520.000");
GP.AddToolbox(@"D:\temp\My_Tools.tbx");
IVariantArray parameters = new VarArrayClass();
parameters.Add(pSourceFC);
parameters.Add("Shape.Z");
parameters.Add(txtoutput.Text + "\\" + pSourceFC.AliasName + ".asc");
parameters.Add(1);
GP.Execute("IDWtoASCII", parameters, null);

Tags (1)
0 Kudos
0 Replies