- 积分
- 311
- 明经币
- 个
- 注册时间
- 2012-4-7
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
static void XiangMu_lvdi(void)
{
double area;
/*double allarea=500;*/
// Add your code for command XiangMu._lvdi here
AcDbLayerTable *pLayerTbl;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pLayerTbl,AcDb::kForRead);
if(!pLayerTbl->has(_T("绿地")))
{
acutPrintf(_T("当前图形不包含该图层"));
pLayerTbl->close();
return;
}
AcDbObjectId layerId;
pLayerTbl->getAt(_T("绿地"),layerId);
pLayerTbl->close();
AcDbBlockTable *pBlkTbl;
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlkTbl,AcDb::kForRead);
AcDbBlockTableRecord *pBlkTblRcd;
pBlkTbl->getAt(ACDB_MODEL_SPACE,pBlkTblRcd,AcDb::kForRead);
pBlkTbl->close();
AcDbBlockTableRecordIterator *pltr;
pBlkTblRcd->newIterator(pltr);
AcDbEntity *pEnt;
for(pltr->start();!pltr->done();pltr->step())
{
pltr->getEntity(pEnt,AcDb::kForWrite);
if(pEnt->layerId()==layerId)
{
AcDb2dPolyline *pPolyLine=AcDb2dPolyline::cast(pEnt);
pPolyLine->getArea(area);
}
pEnt->close();
}
/*lvdilv=area/allarea;*/
acutPrintf(_T("%10.2f\n"),area);
delete pltr;
pBlkTblRcd->close();
}
} ;
执行命令之后出现acad.exe 中的 0x1001231e (XiangMu.arx) 处最可能的异常: 0xC0000005: 读取位置 0x00000000 时发生访问冲突
错误
|
|