<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic HRESULT E_FAIL Error while calling custom model tool in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/hresult-e-fail-error-while-calling-custom-model/m-p/837951#M2655</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I&amp;nbsp;have created a custom model tool. If we run this tool on ArcMap, we noticed that the tool is &amp;nbsp;working fine. where as if we&amp;nbsp;call the same in Arc Objects under Geo-processing tool, it is throwing an error as shown below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/339413_pastedImage_1.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass();&lt;BR /&gt; IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspaceFactory.OpenFromFile(@"C:\temp\IDW\New\ShapeFiles", 0);&lt;BR /&gt; IFeatureClass pSourceFC = featureWorkspace.OpenFeatureClass("BA31_3429_2016");&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; Geoprocessor GP = new Geoprocessor();&lt;BR /&gt; GP.SetEnvironmentValue("Extent", "1745440.000 5922240.000 1745920.000 5921520.000");&lt;BR /&gt; GP.AddToolbox(@"D:\temp\My_Tools.tbx");&lt;BR /&gt; IVariantArray parameters = new VarArrayClass();&lt;BR /&gt; parameters.Add(pSourceFC);&lt;BR /&gt; parameters.Add("Shape.Z");&lt;BR /&gt; parameters.Add(txtoutput.Text + "\\" + pSourceFC.AliasName + ".asc");&lt;BR /&gt; parameters.Add(1);&lt;BR /&gt; GP.Execute("IDWtoASCII", parameters, null);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Mar 2017 08:34:52 GMT</pubDate>
    <dc:creator>chandrasekhar_reddyguda</dc:creator>
    <dc:date>2017-03-13T08:34:52Z</dc:date>
    <item>
      <title>HRESULT E_FAIL Error while calling custom model tool</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/hresult-e-fail-error-while-calling-custom-model/m-p/837951#M2655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I&amp;nbsp;have created a custom model tool. If we run this tool on ArcMap, we noticed that the tool is &amp;nbsp;working fine. where as if we&amp;nbsp;call the same in Arc Objects under Geo-processing tool, it is throwing an error as shown below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/339413_pastedImage_1.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass();&lt;BR /&gt; IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspaceFactory.OpenFromFile(@"C:\temp\IDW\New\ShapeFiles", 0);&lt;BR /&gt; IFeatureClass pSourceFC = featureWorkspace.OpenFeatureClass("BA31_3429_2016");&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; Geoprocessor GP = new Geoprocessor();&lt;BR /&gt; GP.SetEnvironmentValue("Extent", "1745440.000 5922240.000 1745920.000 5921520.000");&lt;BR /&gt; GP.AddToolbox(@"D:\temp\My_Tools.tbx");&lt;BR /&gt; IVariantArray parameters = new VarArrayClass();&lt;BR /&gt; parameters.Add(pSourceFC);&lt;BR /&gt; parameters.Add("Shape.Z");&lt;BR /&gt; parameters.Add(txtoutput.Text + "\\" + pSourceFC.AliasName + ".asc");&lt;BR /&gt; parameters.Add(1);&lt;BR /&gt; GP.Execute("IDWtoASCII", parameters, null);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2017 08:34:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/hresult-e-fail-error-while-calling-custom-model/m-p/837951#M2655</guid>
      <dc:creator>chandrasekhar_reddyguda</dc:creator>
      <dc:date>2017-03-13T08:34:52Z</dc:date>
    </item>
  </channel>
</rss>

