DiscussionsIssue archiveOther usage issues

Archived discussion

SetColor, wrong colors

Other usage issuesSun, 08/24/2014 - 00:532 replies

Browse this forum
QuestionAuthor

I create a box and set its color to black

BRepPrimAPI_MakeBox mb(1,1,1);
Handle_AIS_Shape mybox = new AIS_Shape(mb.Shape());
mybox->SetColor(Quantity_NOC_BLACK);
context->Display(mybox);

However, it's not black, it's brownish. What am I doing wrong?

Best regards

Discussion

2 archived replies

Posts are displayed in their archived order.

01Commenter-1

Dear John,
This is expected behavior of method SetColor(), which modifies color properties of already assigned material.
You may assign another material using SetMaterial(Graphic3d_NOM_PLASTIC) in advance (default material is Gold, which has physical properties; Plastic is more reliable for color customizations) to achieve more predictable color modulation.
See below Draw reproducer:

pload MODELING VISUALIZATION
box b 1 2 3
vinit View1
vtop
vsetdispmode 1
vdisplay b
vfit
vsetmaterial b plastic
vsetcolor b black

Best regards
FSR

02Author

Thanks!