Ais_shape Setcolor but remain origin eadge color

I try set ais_shape color but remain orgin edge color, i use code below , it works

ais_shape = new AIS_Shape(shape);
ais_shape->SetTransparency(transparency);
ais_shape->SetColor(color);
const Handle(Prs3d_Drawer) contextDrawer = ais_shape->Attributes();
contextDrawer->SetFaceBoundaryAspect(new Prs3d_LineAspect(Quantity_NOC_GRAY20, Aspect_TOL_SOLID, 0.5));
ctx->Display(ais_shape, false);

but every time I set smae shape but another color ,

ais_shape->SetColor(color);

edge color change to setcolor's color

even though i set LineAspect again, it dosen't work,why?

ais_shape->SetColor(color);
const Handle(Prs3d_Drawer) contextDrawer = ais_shape->Attributes();
contextDrawer->SetFaceBoundaryAspect(new Prs3d_LineAspect(Quantity_NOC_GRAY20, Aspect_TOL_SOLID, 0.5));

tsunghung tsai's picture

reply by myself

solution is

after SetColor
in order to remain edge color

set origin ais_shape's LineAspect
origin contextDrawer->FaceBoundaryAspect()->SetColor(Quantity_NOC_GRAY20);

not give a new LineAspect
contextDrawer->SetFaceBoundaryAspect(new Prs3d_LineAspect(Quantity_NOC_GRAY20, Aspect_TOL_SOLID, 0.5));

ais_shape->SetColor(color);
ais_shape->SetTransparency(transparency);
const Handle(Prs3d_Drawer) contextDrawer = ais_shape->Attributes();
contextDrawer->FaceBoundaryAspect()->SetColor(Quantity_NOC_GRAY20);