Sure, you may use AIS_ColoredShape::CustomAspects() to customize drawer for a subshape in desired way, including material aspect (like XCAFPrs_AISObject does to dispatch materials from XCAF document).
Archived discussion
AIS_ColoredShape, Set Material of sub-shape
Hey Everyone
I was wondering if it's possible to set the material(Graphic3d_MaterialAspect) of each individual subShape of a AIS_ColoredShape object.
Best regards
Discussion
2 archived replies
Posts are displayed in their archived order.
Yes, i checked the source code of XCAFPrs_AISObject and fixed it like this:
void SubShapeAspectHandler(Handle(AIS_ColoredShape) aisColoredShape, const TopoDS_Shape & subShape, const Graphic3d_MaterialAspect theAspect)
{
aisColoredShape->CustomAspects(subShape)->SetOwnMaterial();
aisColoredShape->CustomAspects(subShape)->SetupOwnShadingAspect();
aisColoredShape->CustomAspects(subShape)->ShadingAspect()->Aspect()->SetFrontMaterial(theAspect);
}