调用ArcObjects自定义模型工具时出现HRESULT E_FAIL错误

时间:2017-03-13 12:33:46

标签: arcobjects customtool

我在ArcMap 10.2.2中创建了一个自定义模型工具。如果我们在ArcMap上运行此工具,我们注意到该工具运行正常。就好像我们在Geo处理工具下的Arc Objects中调用相同的那样,它会抛出一个错误,如下所示

错误消息 Error Message

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);

模型构建器 Model Builder

0 个答案:

没有答案