Problem with material of AIS_ConnectedInteractive

Hi all,
Sorry for my poor English.

I'm trying to set material for AIS_ConnectedInteractive using following part of code, but I have some problem:

Handle(AIS_InteractiveContext) myAISContext = ...

BRepPrimAPI_MakeBox box(gp_Pnt(0.0,0.0,0.0), 100, 100, 100);

Handle(AIS_Shape) mainAISObject = new AIS_Shape(box.Solid());
mainAISObject->SetMaterial(Graphic3d_NOM_GLASS); //this works OK

gp_Trsf location;
Handle(AIS_ConnectedInteractive) connAISObject = new AIS_ConnectedInteractive;
connAISObject->Connect(mainAISObject, location);
connAISObject->SetMaterial(Graphic3d_NOM_COPPER); //not working

myAISContext->Display(mainAISObject, Standard_False);
myAISContext->Display(connAISObject, Standard_True);

The result is that connAISObject is displayed with the same material as mainAISObject.
How to propertly set material for AIS_ConnectedInteractive?


jelle's picture

Set the material using you myAISContext object, rather than on the main/conn AISObject
It ( confusingly? ) also has a SetMaterial / SetTransparency method.


skulach's picture

Thanks for reply.
I've already tried using myAISContext->SetMaterial/SetTransparency but without any luck.
Calling SetMaterial/SetTransparency with mainAISObject changes material of both main and conn AISObject. Seems like both mainAISObject and connAISObject shared one material.