In my ArcObjects projects, there is a function to Insert a polygon feature from a Source FeatureClass into a Target FeatureClass (fc_Target). The related code is below:
IFeature f_Target = fc_Target.CreateFeature();
f_Target.Shape = f_Source.Shape; // f_Source - feature of Source FeatureClass; Got error
However, it throws an error: The geometry is not Z-aware. Then, I found that the fc_Source is a type of PlogonZM, while the fc_Target is type of Polygon. How can this problem be fixed? Thanks.
Solved! Go to Solution.
The reported error was gone with the code below:
IZAware zAware = (IZAware)f_Source.Shape;
if (zAware.ZAware != false) {
zAware = (IZAware)f_Source.Shape;
zAware.DropZs();
zAware.ZAware = false;
}
IZAware zAware2 = (IZAware)f_Target.Shape;
f_Target.Shape = f_Source.Shape;
Thanks for your review.
The reported error was gone with the code below:
IZAware zAware = (IZAware)f_Source.Shape;
if (zAware.ZAware != false) {
zAware = (IZAware)f_Source.Shape;
zAware.DropZs();
zAware.ZAware = false;
}
IZAware zAware2 = (IZAware)f_Target.Shape;
f_Target.Shape = f_Source.Shape;
Thanks for your review.