static void TestBrepColor(void)
{
AcDb3dSolid *pBox = new AcDb3dSolid();
pBox->createBox(10,20,30);
AcCmColor specialColor;
AcBr::ErrorStatus bs;
AcArray<AcDbSubentId> arrSubentId;
{
AcBrBrep brEnt; bs = brEnt.set(*pBox);
if (bs != AcBr::eOk)
return;
AcBrBrepFaceTraverser bft;
bs = bft.setBrep(brEnt);
if (bs != AcBr::eOk)
return;
// Выполняем проход по всем граням
for ( ; !bft.done(); bft.next())
{
AcBrFace face;
bs = bft.getFace(face);
if (bs != Acad::eOk)
{
acutPrintf(L"\nОшибка getFace");
break;
}
AcDbFullSubentPath Path(kNullSubent);
AcDbSubentId subentId;
AcBr::ErrorStatus bss = face.getSubentPath(Path);
subentId = Path.subentId();
arrSubentId.append(subentId);
}
}
for (int i = 0; i < arrSubentId.length(); i++)
{
specialColor.setColorIndex(i);
pBox->setSubentColor(arrSubentId[i],specialColor);
}
Acad::ErrorStatus es = Acad::eOk;
AcDbBlockTableRecordPointer pCurSpace(acdbCurDwg()->currentSpaceId(), AcDb::kForWrite);
if (pCurSpace.openStatus() == Acad::eOk) {
if (pCurSpace->appendAcDbEntity(pBox) == Acad::eOk) {
pBox->close();
} else {
delete pBox;
}
} else {
delete pBox;
}
}