<?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 Re: Issue when add point to a IPointCollection in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/issue-when-add-point-to-a-ipointcollection/m-p/387927#M10319</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Akos Halmai,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your explanation, will follow you advice and update the result.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Oct 2016 08:57:49 GMT</pubDate>
    <dc:creator>WuYang</dc:creator>
    <dc:date>2016-10-07T08:57:49Z</dc:date>
    <item>
      <title>Issue when add point to a IPointCollection</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/issue-when-add-point-to-a-ipointcollection/m-p/387925#M10317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My polygon has several interior rings, and I want to move all vertices in these interior rings. I define the list of interior ring points into a list of IPointCollection, but when I try to add point to an IPointCollection, I got the "Index was out of range. Must be non-negative and less than the size of the collection" error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;Dim polygon As IPolygon4 = TryCast(mFeature.Shape, IPolygon4)
Dim exteriorRingGeometryBag As IGeometryBag = polygon.ExteriorRingBag
Dim exteriorRingGeometryCollection As IGeometryCollection = TryCast(exteriorRingGeometryBag, IGeometryCollection)
Dim inRing As List(Of IPointCollection) = New List(Of IPointCollection)

For i = 0 To exteriorRingGeometryCollection.GeometryCount - 1
&amp;nbsp; &amp;nbsp; Dim exteriorRingGeometry As IGeometry = exteriorRingGeometryCollection.Geometry(i)
&amp;nbsp; &amp;nbsp; Dim exteriorRingPointCollection As IPointCollection = TryCast(exteriorRingGeometry, IPointCollection)
&amp;nbsp; &amp;nbsp; Dim interiorRingGeometryBag As IGeometryBag = polygon.InteriorRingBag(TryCast(exteriorRingGeometry, IRing))
&amp;nbsp; &amp;nbsp; Dim interiorRingGeometryCollection As IGeometryCollection = TryCast(interiorRingGeometryBag, IGeometryCollection)

&amp;nbsp; &amp;nbsp; For k = 0 To interiorRingGeometryCollection.GeometryCount - 1
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dim InteriorRingGeometry As IGeometry = interiorRingGeometryCollection.Geometry(k)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dim InteriorRingPointCollection As IPointCollection = TryCast(InteriorRingGeometry, IPointCollection)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; For m = 0 To InteriorRingPointCollection.PointCount - 1
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dim pp As IPoint = InteriorRingPointCollection.Point(m)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pp.X = Round(pp.X, 2)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pp.Y = Round(pp.Y, 2)

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;inRing(k).AddPoint(pp) &amp;nbsp;' I got error this line

&amp;nbsp; &amp;nbsp; Next
Next‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:48:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/issue-when-add-point-to-a-ipointcollection/m-p/387925#M10317</guid>
      <dc:creator>WuYang</dc:creator>
      <dc:date>2021-12-11T17:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Issue when add point to a IPointCollection</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/issue-when-add-point-to-a-ipointcollection/m-p/387926#M10318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There’s a variable called inRing, defined as a new List of IPointCollection, where the List is coming from the .NET’s Generic namespace. If you define such a list there is nothing inside, it is an empty container with zero instances in it. It’s not like a predefined array with exact number items. It’s totally empty. First, you should add an object (witch implements the IPointCollection interface) to the list with the inRing.Add method. This would be the 0th item in the list. After that you can add a point. However your solution seems complicated. Applying the IEnumVertex interface on the internal rings is probably easier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ákos Halmai&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Oct 2016 10:14:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/issue-when-add-point-to-a-ipointcollection/m-p/387926#M10318</guid>
      <dc:creator>ÁkosHalmai</dc:creator>
      <dc:date>2016-10-06T10:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: Issue when add point to a IPointCollection</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/issue-when-add-point-to-a-ipointcollection/m-p/387927#M10319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Akos Halmai,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your explanation, will follow you advice and update the result.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Oct 2016 08:57:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/issue-when-add-point-to-a-ipointcollection/m-p/387927#M10319</guid>
      <dc:creator>WuYang</dc:creator>
      <dc:date>2016-10-07T08:57:49Z</dc:date>
    </item>
  </channel>
</rss>

