如何获取CAD注记的中心点?

如下图所示的CAD注记,对齐方式为左对齐,在ArcMap里把CAD注记转点或者使用IFeature.Extent获取到的都是左下角的点,怎么获取到CAD注记的中心点呢。
CAD注记.png
已邀请:

Lemon_156

赞同来自:

CAD里的文本转为SHP点,转出的点不在CAD文本的中心点,有时还在CAD文本外面。

baci - 没有反馈手会抖

赞同来自:

我的方法
1. 使用GP工具 [Conversion Tools] -[ To Geodatabase]-[Import CAD Annotation],
生成的图层(layer1)的Geometry就是这个文本的外界矩形框。
我是在ArcMap中使用这个GP工具的,ArcEngine里面没试过。
2.用IArea.Centroid获取中心点。(layer1会有要素的Geomerty是空的,你需要做下处理)
 
//这是GP工具生成的图层
IFeatureLayer featureLayer = mapDocument.Layer[0, 0] as IFeatureLayer;
IFeatureClass featureClass = featureLayer?.FeatureClass;
var cursor = featureClass.Search(null, false);
IFeature feature;
while ((feature = cursor.NextFeature()) != null)
{
//这是新建的点图层
IFeatureClass fcP = (mapDocument.Layer[0, 1] as IFeatureLayer).FeatureClass;
IFeature feP = fcP.CreateFeature();
feP.Shape = (feature.Shape as IArea).Centroid;//获取中心点
feP.Store();
}

要回复问题请先登录注册