<?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 Can't get ITopologicalOperator4.Cut2 to work. in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-get-itopologicaloperator4-cut2-to-work/m-p/1370990#M20632</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to split a polygon by a line, but I can't get ITopologicalOperator4.Cut2 to work. The&amp;nbsp;outPolygon variable becomes null. Test data is in a file geodatabase. Any ideas?&lt;/P&gt;&lt;P&gt;var mxd = ArcMap.Application.Document as IMxDocument;&lt;/P&gt;&lt;P&gt;IFeatureClass inFc = ((IFeatureLayer)mxd.FocusMap.Layer[0]).FeatureClass;&amp;nbsp;&amp;nbsp;&amp;nbsp; // One simple polygon&lt;/P&gt;&lt;P&gt;IFeatureClass lineFc = ((IFeatureLayer)mxd.FocusMap.Layer[1]).FeatureClass; // One simple polyline stretching over the polygon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IFeatureCursor inCur = inFc.Search(null, true);&lt;/P&gt;&lt;P&gt;IFeature inFtr = inCur.NextFeature();&lt;/P&gt;&lt;P&gt;IPolygon polygon = inFtr.ShapeCopy as IPolygon;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IFeatureCursor lineCur = lineFc.Search(null, true);&lt;/P&gt;&lt;P&gt;IFeature lineFtr = lineCur.NextFeature();&lt;/P&gt;&lt;P&gt;IPolyline polyline = lineFtr.ShapeCopy as IPolyline;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ITopologicalOperator4 topo = polygon as ITopologicalOperator4;&lt;/P&gt;&lt;P&gt;IGeometryCollection geomColl = topo.Cut2(polyline);&lt;/P&gt;&lt;P&gt;IPolygon outPolygon = geomColl as IPolygon; // outPolygon is null&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jan 2024 15:24:51 GMT</pubDate>
    <dc:creator>Mikael-J</dc:creator>
    <dc:date>2024-01-17T15:24:51Z</dc:date>
    <item>
      <title>Can't get ITopologicalOperator4.Cut2 to work.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-get-itopologicaloperator4-cut2-to-work/m-p/1370990#M20632</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to split a polygon by a line, but I can't get ITopologicalOperator4.Cut2 to work. The&amp;nbsp;outPolygon variable becomes null. Test data is in a file geodatabase. Any ideas?&lt;/P&gt;&lt;P&gt;var mxd = ArcMap.Application.Document as IMxDocument;&lt;/P&gt;&lt;P&gt;IFeatureClass inFc = ((IFeatureLayer)mxd.FocusMap.Layer[0]).FeatureClass;&amp;nbsp;&amp;nbsp;&amp;nbsp; // One simple polygon&lt;/P&gt;&lt;P&gt;IFeatureClass lineFc = ((IFeatureLayer)mxd.FocusMap.Layer[1]).FeatureClass; // One simple polyline stretching over the polygon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IFeatureCursor inCur = inFc.Search(null, true);&lt;/P&gt;&lt;P&gt;IFeature inFtr = inCur.NextFeature();&lt;/P&gt;&lt;P&gt;IPolygon polygon = inFtr.ShapeCopy as IPolygon;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IFeatureCursor lineCur = lineFc.Search(null, true);&lt;/P&gt;&lt;P&gt;IFeature lineFtr = lineCur.NextFeature();&lt;/P&gt;&lt;P&gt;IPolyline polyline = lineFtr.ShapeCopy as IPolyline;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ITopologicalOperator4 topo = polygon as ITopologicalOperator4;&lt;/P&gt;&lt;P&gt;IGeometryCollection geomColl = topo.Cut2(polyline);&lt;/P&gt;&lt;P&gt;IPolygon outPolygon = geomColl as IPolygon; // outPolygon is null&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 15:24:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-get-itopologicaloperator4-cut2-to-work/m-p/1370990#M20632</guid>
      <dc:creator>Mikael-J</dc:creator>
      <dc:date>2024-01-17T15:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get ITopologicalOperator4.Cut2 to work.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-get-itopologicaloperator4-cut2-to-work/m-p/1371576#M20633</link>
      <description>&lt;P&gt;My question is:&amp;nbsp; Is geomColl null?&amp;nbsp; Or do you have two polygons in that collection?&lt;/P&gt;&lt;P&gt;The "As" operator will set outPolygon to null if geomColl cannot be cast into an IPolygon type.&lt;/P&gt;&lt;P&gt;If geomColl.GeometryCount = 2, you might need to pull out one polygon at a time.&lt;/P&gt;&lt;P&gt;Brent Hoskisson&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 13:44:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-get-itopologicaloperator4-cut2-to-work/m-p/1371576#M20633</guid>
      <dc:creator>BrentHoskisson</dc:creator>
      <dc:date>2024-01-18T13:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get ITopologicalOperator4.Cut2 to work.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-get-itopologicaloperator4-cut2-to-work/m-p/1371617#M20634</link>
      <description>&lt;P&gt;Hi, and thank you for the response.&lt;/P&gt;&lt;P&gt;The input data is only one simple rectangle polygon in a file geodatabase, and the resulting clipped output polygon becomes null (&lt;SPAN&gt;IPolygon outPolygon = geomColl as IPolygon; // outPolygon is null). I want the output to be one multipart polygon. But I will try to pull out each polygon part and then put them together&amp;nbsp;again.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 15:04:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-get-itopologicaloperator4-cut2-to-work/m-p/1371617#M20634</guid>
      <dc:creator>Mikael-J</dc:creator>
      <dc:date>2024-01-18T15:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get ITopologicalOperator4.Cut2 to work.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-get-itopologicaloperator4-cut2-to-work/m-p/1372119#M20635</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I tried to pull out each geometry and to put them together again using a geometrycollection, se below. All geometries are known_simple, and the output geomColl collection do have a geometry count of 2. But at the first&amp;nbsp;AddGeometry row ArcMap crashes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ITopologicalOperator4 topo = polygon as ITopologicalOperator4;&lt;BR /&gt;IGeometryCollection geomColl = topo.Cut2(polyline);&lt;/P&gt;&lt;P&gt;object obj = Type.Missing;&lt;BR /&gt;IGeometryCollection gc = new PolygonClass();&lt;BR /&gt;gc.AddGeometry(geomColl.get_Geometry(0), ref obj, ref obj);&lt;BR /&gt;gc.AddGeometry(geomColl.get_Geometry(1), ref obj, ref obj);&lt;BR /&gt;gc.GeometriesChanged();&lt;/P&gt;&lt;P&gt;IPolygon p = gc as IPolygon;&lt;/P&gt;&lt;P&gt;Mikael&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 06:35:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-get-itopologicaloperator4-cut2-to-work/m-p/1372119#M20635</guid>
      <dc:creator>Mikael-J</dc:creator>
      <dc:date>2024-01-19T06:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get ITopologicalOperator4.Cut2 to work.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-get-itopologicaloperator4-cut2-to-work/m-p/1372801#M20636</link>
      <description>&lt;P&gt;Couldn't get the ITopologicalOperator4.Cut2 to work. So I used the&amp;nbsp;ITopologicalOperator2.Cut(splitLine, out p1, out p2) instead. That works almost as expected. It splits the polygon in two pieces p1 and p2. The only weird thing is that it dissolves any polygon parts in p1 and p2, that is not expected at all. But it solved my problem. Many thanks.&lt;/P&gt;&lt;P&gt;/Mikael&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 06:44:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-get-itopologicaloperator4-cut2-to-work/m-p/1372801#M20636</guid>
      <dc:creator>Mikael-J</dc:creator>
      <dc:date>2024-01-22T06:44:20Z</dc:date>
    </item>
  </channel>
</rss>

