<?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 &amp;amp;quot;Item not found in this collection&amp;amp;quot; error at IFeature.set_Shape(IGeometry Shape) in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-item-not-found-in-this-collection-amp/m-p/153310#M3953</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I want to set the shape property of a newly created feature, I get this error:[INDENT]&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;System.Runtime.InteropServices.COMException (0x80040907): Item not found in this collection.&lt;BR /&gt;at ESRI.ArcGIS.Geodatabase.IFeature.set_Shape(IGeometry Shape)&lt;BR /&gt;at &amp;lt;myFunction&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/INDENT]This is what I do:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have two featurelayers - the one with the originating polygons which has Z, and a destination layer with polygons which has _no_ Z.[INDENT]&lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;IFeature polygonFeature = &amp;lt;selected polygon feature&amp;gt;;
IGeometry splitGeometry = &amp;lt;polyline drawn by IRubberBand.TrackNew&amp;gt;;
IGeometry polygonGeometry = polygonFeature.ShapeCopy;
IGeometry leftSplitPart;
IGeometry rightSplitPart;
ITopologicalOperator topoOperator = polygonGeometry as ITopologicalOperator;
topoOperator.Cut(splitGeometry as IPolyline, out leftSplitPart, out rightSplitPart);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt;[/INDENT]The resulting geometries leftSplitPart and rightSplitPart are not empty and have the same shapetype of the featureclass I want to put them in;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Remove the Z from the leftSplitPart (with ZAware.DropZs()), but it makes no difference, because the error occurs even when I skip this step;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Start the IWorkspaceEdit::StartEditing(false) and IWorkspaceEdit::StartEditOperation (on the destination layer);[INDENT]&lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;IFeature newFeature = destinationLayer.FeatureClass.CreateFeature();
newFeature.Shape = leftSplitPart;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt;[/INDENT]and there the error pops up.....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What am I doing wrong? Any ideas? I'm (still) using 9.2 SP 6.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Aug 2010 12:29:50 GMT</pubDate>
    <dc:creator>PieterLinks</dc:creator>
    <dc:date>2010-08-13T12:29:50Z</dc:date>
    <item>
      <title>&amp;quot;Item not found in this collection&amp;quot; error at IFeature.set_Shape(IGeometry Shape)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-item-not-found-in-this-collection-amp/m-p/153310#M3953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I want to set the shape property of a newly created feature, I get this error:[INDENT]&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;System.Runtime.InteropServices.COMException (0x80040907): Item not found in this collection.&lt;BR /&gt;at ESRI.ArcGIS.Geodatabase.IFeature.set_Shape(IGeometry Shape)&lt;BR /&gt;at &amp;lt;myFunction&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/INDENT]This is what I do:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have two featurelayers - the one with the originating polygons which has Z, and a destination layer with polygons which has _no_ Z.[INDENT]&lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;IFeature polygonFeature = &amp;lt;selected polygon feature&amp;gt;;
IGeometry splitGeometry = &amp;lt;polyline drawn by IRubberBand.TrackNew&amp;gt;;
IGeometry polygonGeometry = polygonFeature.ShapeCopy;
IGeometry leftSplitPart;
IGeometry rightSplitPart;
ITopologicalOperator topoOperator = polygonGeometry as ITopologicalOperator;
topoOperator.Cut(splitGeometry as IPolyline, out leftSplitPart, out rightSplitPart);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt;[/INDENT]The resulting geometries leftSplitPart and rightSplitPart are not empty and have the same shapetype of the featureclass I want to put them in;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Remove the Z from the leftSplitPart (with ZAware.DropZs()), but it makes no difference, because the error occurs even when I skip this step;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Start the IWorkspaceEdit::StartEditing(false) and IWorkspaceEdit::StartEditOperation (on the destination layer);[INDENT]&lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;IFeature newFeature = destinationLayer.FeatureClass.CreateFeature();
newFeature.Shape = leftSplitPart;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt;[/INDENT]and there the error pops up.....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What am I doing wrong? Any ideas? I'm (still) using 9.2 SP 6.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Aug 2010 12:29:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-item-not-found-in-this-collection-amp/m-p/153310#M3953</guid>
      <dc:creator>PieterLinks</dc:creator>
      <dc:date>2010-08-13T12:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: "Item not found in this collection" error at IFeature.set_Shape(IGeometry Shape)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-item-not-found-in-this-collection-amp/m-p/153311#M3954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you tried setting IZAware.ZAware to False after dropping the z values?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Aug 2010 13:39:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-item-not-found-in-this-collection-amp/m-p/153311#M3954</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2010-08-13T13:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: "Item not found in this collection" error at IFeature.set_Shape(IGeometry Shape)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-item-not-found-in-this-collection-amp/m-p/153312#M3955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear Neil,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No, I didn't, but when I do, it works! How could I forget it..... Many thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have a nice day,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Aug 2010 12:19:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-item-not-found-in-this-collection-amp/m-p/153312#M3955</guid>
      <dc:creator>PieterLinks</dc:creator>
      <dc:date>2010-08-16T12:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: "Item not found in this collection" error at IFeature.set_Shape(IGeometry Shape)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-item-not-found-in-this-collection-amp/m-p/153313#M3956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was getting the same error when I tried to set the shape property of a newly created feature.&amp;nbsp; After much frustration, it turned out that the shape was a &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;point&lt;/SPAN&gt;&lt;SPAN&gt;, and the feature was in a &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;polygon&lt;/SPAN&gt;&lt;SPAN&gt; type feature class.&amp;nbsp; A better error message would have helped a lot.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Dec 2010 20:45:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-item-not-found-in-this-collection-amp/m-p/153313#M3956</guid>
      <dc:creator>MikeAdams</dc:creator>
      <dc:date>2010-12-01T20:45:50Z</dc:date>
    </item>
  </channel>
</rss>

