CString LayerByEnt(AcDbObjectId objId)
{
//选择实体
ads_name ss;
ads_point pt;
int nRs = acedEntSel(_T("
请选择要删除图层的一个实体:"), 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;
}