Object ARX 统一设置所有图层的RGB颜色

这个方法是从另外一位达人那里学习来的,豁然开朗

	//设置所有有图层颜色为黑色 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


引用
转载请注明baOZe

你可能感兴趣的:(遍历,AcDbLayerTable,getLayerTable)