For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Example for MeshVS_NodalColorPrsBuilder

Thornton's picture


I have found some examples for MeshVS_MeshPrsBuilder and it works well. But i want to colorize each triangle in a different color. MeshVS_NodalColorPrsBuilder or MeshVS_ElementalColorPrsBuilder should do the job. But i could'nt get both to work.

Does anybody has an example for MeshVS_NodalColorPrsBuilder or MeshVS_ElementalColorPrsBuilder? Or an instruction how to handle these builder?

Thanks for your help.


Sebastian Starkey's picture

Hi Brandt,

Did you solve your problem? I am trying to do something similar.

Thanks a lot,

Sepp Forcher's picture


you can do it with MeshVS_ElementalColorPrsBuilder:

Handle_MeshVS_ElementalColorPrsBuilder aBuilder = new MeshVS_ElementalColorPrsBuilder( meshVS, MeshVS_DMF_ElementalColorDataPrs | MeshVS_DMF_OCCMask);
const TColStd_PackedMapOfInteger& anAllElements = meshVS->GetDataSource()->GetAllElements();
TColStd_MapIteratorOfPackedMapOfInteger anIter(anAllElements);

for ( ; anIter.More(); anIter.Next() )
aBuilder->SetColor1( anIter.Key(), Quantity_Color(Quantity_NOC_WHITE));
int nBuilder = meshVS->GetBuildersCount();
if(nBuilder > 1)
meshVS->AddBuilder( aBuilder, Standard_True );