It is quite simple, I have a polygon and a polyline passing through it and I want to split the polygon with this polyline
Public Sub splitPolygonWithLine(polyFeature As IFeature, lineFeature As IFeature, outFc As IFeatureClass) Dim fields As IFields Dim field As IField Dim fieldCount As Integer Dim topoOp As ITopologicalOperator4 Dim geoColl As IGeometryCollection Dim x As Integer Dim outFeat As IFeature Set topoOp = polyFeature.ShapeCopy Set geoColl = New GeometryBag Set geoColl = topoOp.Cut2(lineFeature.ShapeCopy) Set topoOp = Nothing x = 0 Do While x < geoColl.GeometryCount Set outFeat = outFc.CreateFeature Set outFeat.Shape = geoColl.Geometry(x) Set fields = polyFeature.fields For fieldCount = 0 To fields.fieldCount - 1 Set field = polyFeature.fields.field(fieldCount) If Not field.Type = esriFieldTypeGeometry And Not field.Type = esriFieldTypeOID And field.Editable Then outFeat.value(fieldCount) = polyFeature.value(fieldCount) End If Next fieldCount outFeat.Store x = x + 1 Loop polyFeature.Delete End Sub