<?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: Insert new Point to PointCollection in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/insert-new-point-to-pointcollection/m-p/58516#M1608</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Makes no difference, the same error occures.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I don´t understand is that adding the point without any information on the position (just use PointCollection.Addpoint(IPoint)) works as it should, but with arguments I get the mentioned error...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Jul 2013 10:13:03 GMT</pubDate>
    <dc:creator>CarstenSchumann</dc:creator>
    <dc:date>2013-07-11T10:13:03Z</dc:date>
    <item>
      <title>Insert new Point to PointCollection</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/insert-new-point-to-pointcollection/m-p/58514#M1606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;Hey folks around,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;when trying to update a features geometry by inserting a new point (using the IPointCollection-Interface) I run through an &lt;/SPAN&gt;&lt;STRONG&gt;System.Runtime.InteropServices.SEHException&lt;/STRONG&gt;&lt;SPAN&gt; which I can´t interpret in any way. But all posts concerning this topic simply add a new Point at the end of the geometry, but never in the middle or at the beginning.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My current code is the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;// the candidate to add to the result-list ICurve candidate = new PathClass();&amp;nbsp;&amp;nbsp; 
IPointCollection curvePoints = (IPointCollection) candidate; 
// add the new point at the beginning of the geometry 
object before = curvePoints.get_Point(0); 
object after = Type.Missing; 
curvePoints.AddPoint(fromPoint, ref before, ref after);&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Does anyone around know where the error is?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:13:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/insert-new-point-to-pointcollection/m-p/58514#M1606</guid>
      <dc:creator>CarstenSchumann</dc:creator>
      <dc:date>2021-12-10T22:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: Insert new Point to PointCollection</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/insert-new-point-to-pointcollection/m-p/58515#M1607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Carsten,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm guessing the error is occurring because your &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;candidate&lt;/SPAN&gt;&lt;SPAN&gt; is pointing to a &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;path&lt;/SPAN&gt;&lt;SPAN&gt; class which is a sequence of connected segments, try a polyline class?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Duncan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 09:48:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/insert-new-point-to-pointcollection/m-p/58515#M1607</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2013-07-11T09:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Insert new Point to PointCollection</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/insert-new-point-to-pointcollection/m-p/58516#M1608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Makes no difference, the same error occures.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I don´t understand is that adding the point without any information on the position (just use PointCollection.Addpoint(IPoint)) works as it should, but with arguments I get the mentioned error...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 10:13:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/insert-new-point-to-pointcollection/m-p/58516#M1608</guid>
      <dc:creator>CarstenSchumann</dc:creator>
      <dc:date>2013-07-11T10:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Insert new Point to PointCollection</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/insert-new-point-to-pointcollection/m-p/58517#M1609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I found this bit of C code on the ESRI website, midPoints is a IPointCollection pointer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;object before = 0 as object; midPoints.AddPoint(m_curve.FromPoint, ref before, ref missing);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 10:36:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/insert-new-point-to-pointcollection/m-p/58517#M1609</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2013-07-11T10:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Insert new Point to PointCollection</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/insert-new-point-to-pointcollection/m-p/58518#M1610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok, I tried it out and the error disappeared. Does this mean the object you´re using is rather the actual &lt;/SPAN&gt;&lt;STRONG&gt;point&lt;/STRONG&gt;&lt;SPAN&gt; but the &lt;/SPAN&gt;&lt;STRONG&gt;index&lt;/STRONG&gt;&lt;SPAN&gt; of this point casted as an object? Then the method is quite confusing as simply using integers for the indexes would simplify it...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the help&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The following finally works:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
ICurve candidate = new PathClass();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // the candidate to add to the result-list
IPointCollection curvePoints = (IPointCollection) candidate;
// ...
// add some points to the collection
// ...
// add the point at the beginning of the geometry
object before = (object) 0; // rather then curvePoints.get_Point(0); we could also use (object) 3 or whatever index we need
object after = Type.Missing;
curvePoints.AddPoint(fromPoint, ref before, ref after);
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:13:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/insert-new-point-to-pointcollection/m-p/58518#M1610</guid>
      <dc:creator>CarstenSchumann</dc:creator>
      <dc:date>2021-12-10T22:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Insert new Point to PointCollection</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/insert-new-point-to-pointcollection/m-p/58519#M1611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Accessing the point collection using an index makes a lot of sense to me but I totally agree the Help for this method is about as clear as mud. ESRI need to improve this with proper examples.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 12:24:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/insert-new-point-to-pointcollection/m-p/58519#M1611</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2013-07-11T12:24:38Z</dc:date>
    </item>
  </channel>
</rss>

