根据用户选择的实体,确定该实体所在的图层

CString LayerByEnt(AcDbObjectId objId)
{
//选择实体
ads_name ss;
ads_point pt;
int nRs = acedEntSel(_T("\n 请选择要删除图层的一个实体:"), ss, pt);
if (RTNORM != nRs)
{
return (_T("选择实体失败!"));
}

//获得实体ID
//AcDbObjectId objId;
if (Acad::eOk != acdbGetObjectId(objId, ss))
{
return (_T("操作失败!"));
}

//获得该实体所在的图层
AcDbEntity *pEnt;
if (Acad::eOk != acdbOpenAcDbEntity(pEnt, objId, ZcDb::kForWrite))
{
return (_T("操作失败!"));;
}
CString strLayerName = pEnt->layer();
pEnt->close();
return strLayerName;

}

posted on 2015-09-06 15:55  !!-阳光-!!  阅读(390)  评论(0编辑  收藏  举报

导航