Hi AllI'm attempting to run a batch process which cuts a polygon and deletes the original polygon after inserting the two new 'post cut' polygons into the feature class. The code I've included below works fine and then all of a sudden it just stops deleting the 'pre-cut' polygon. This then causes problems else where in the process where I find intersecting polygons and should only return one and of course it finds two and throws an error. As you can see I've even tried to pause the code to let ArcObjects do it's thing with no success. Any ideas out there why all of a sudden the polygons stop getting deleted?CheersAdrian
private void CutPolygonFeature(IPoint offsetPoint1, IPoint offsetPoint2, ref IFeature pFeatPoly, ref IFeatureClass polyFC, ref IApplication App)
{
IPolyline pLine;
ITopologicalOperator4 pTopo;
IGeometryCollection pGeoCol;
IFeature pFeatNew;
int i, j;
try
{
pLine = CreatePolylineByPoints(offsetPoint1, offsetPoint2);
//cut with intLine
pTopo = (ITopologicalOperator4)pFeatPoly.Shape;
pGeoCol = pTopo.Cut2(pLine);
pEditor.StartOperation();
for (i = 0; i < pGeoCol.GeometryCount; i++)
{
pFeatNew = polyFC.CreateFeature();
pFeatNew.Shape = pGeoCol.get_Geometry(i);
for (j = 2; j < pFeatPoly.Fields.FieldCount; j++)
{
pFeatNew.set_Value(j, pFeatPoly.get_Value(j));
}
pFeatNew.Store();
}
pFeatPoly.Delete();
polyFC.Update(null, true);
Thread.Sleep(100);
pEditor.StopOperation("Cut made");
//function to activate the save edits command button on the Editor toolbar
ArcCom.SaveEdits(App);
Thread.Sleep(100);
}
finally
{
offsetPoint1 = null;
offsetPoint2 = null;
pLine = null;
pTopo = null;
pGeoCol = null;
pFeatNew = null;
}
}