这个方法是从另外一位达人那里学习来的,豁然开朗
[quote]转载请注明baOZe[/quote]
//设置所有有图层颜色为黑色 BEGIN
AcDbDatabase * db;
//AcTransaction * tran;
db = acdbHostApplicationServices() -> workingDatabase();
//tran = db->transactionManager()->startTransaction();
AcDbLayerTable * pLayerTable;
AcDbLayerTableRecord *pLayerTblRcd;
AcDbLayerTableIterator *pLayerTableIterator;
db->getLayerTable(pLayerTable,AcDb::kForWrite);
pLayerTable->newIterator(pLayerTableIterator);
//char *pLayerName;
for(int i=1;!pLayerTableIterator->done();pLayerTableIterator->step(),i++){
pLayerTableIterator->getRecord(pLayerTblRcd,AcDb::kForWrite);
//pLayerTblRcd->getName(pLayerName);
AcCmColor color;
color.setRGB(0,0,0);
pLayerTblRcd->setColor(color);
pLayerTblRcd->close();
}
delete pLayerTableIterator;
pLayerTable->close();
//设置所有有图层颜色为黑色 END
[quote]转载请注明baOZe[/quote]
本文介绍了一个从另一位高手那里学习到的方法,如何通过编写代码批量将AutoCAD中的所有图层颜色设置为黑色。该教程详细阐述了实现此目标的步骤,包括初始化数据库、迭代图层表并修改颜色属性。最后确保所有图层颜色被统一调整为黑色。
371

被折叠的 条评论
为什么被折叠?



