_银子

提供更专注、更专心、更专业的服务
  首页  :: 联系 :: 订阅 订阅  :: 管理

CAD图层颜色

Posted on 2011-09-30 17:33  _银子  阅读(314)  评论(0)    收藏  举报
  1. //设置所有有图层颜色为黑色 BEGIN   
  2. AcDbDatabase *  db;   
  3. //AcTransaction * tran;   
  4.   
  5. db  =  acdbHostApplicationServices() -> workingDatabase();   
  6.   
  7. //tran = db->transactionManager()->startTransaction();   
  8.   
  9. AcDbLayerTable * pLayerTable;   
  10. AcDbLayerTableRecord *pLayerTblRcd;   
  11. AcDbLayerTableIterator *pLayerTableIterator;   
  12.   
  13. db->getLayerTable(pLayerTable,AcDb::kForWrite);   
  14.   
  15. pLayerTable->newIterator(pLayerTableIterator);   
  16. //char *pLayerName;   
  17. for(int i=1;!pLayerTableIterator->done();pLayerTableIterator->step(),i++){   
  18.     pLayerTableIterator->getRecord(pLayerTblRcd,AcDb::kForWrite);   
  19.     //pLayerTblRcd->getName(pLayerName);   
  20.     AcCmColor color;   
  21.     color.setRGB(0,0,0);   
  22.     pLayerTblRcd->setColor(color);   
  23.     pLayerTblRcd->close();   
  24. }   
  25.   
  26. delete pLayerTableIterator;   
  27. pLayerTable->close();