Forum archiveIssue archiveVisualization and 3D Viewer

Archived discussion

Can't apply transparency for XCAFPrs_AISObject

Visualization and 3D ViewerWed, 03/27/2019 - 20:491 reply

Browse this forum
QuestionAuthor

Hello, I'm trying to make a XCAFPrs_AISObject item half-transparent with :

Handle_AIS_InteractiveContext context = ...;
Handle_XCAFPrs_AISObject obj = ...;
context->SetTransparency(obj, 0.5, false);
context->UpdateCurrentViewer();

but this just doesn't work, the displayed shaded shape stays opaque.

I even tried to call "context->Redisplay(obj, true);" but without any success.

Any idea ?

 

Discussion

1 archived reply

Posts are displayed in their archived order.

01Commenter-1

XCAFPrs_AISObject is not a usual AIS object - it is a presentation for XCAF Label.
XCAF document defines presentation properties of shapes and sub-shapes (colors, including transparency),
and XCAFPrs_AISObject is designed to apply these properties while computing presentation.

Therefore, expected workflow of working with XCAFPrs is modifying the document (XCAFDoc_ColorTool) and then redisplaying presentable object.

It is possible, though, modifying presentation properties without changing the document,
but this requires understanding of XCAFPrs_AISObject / AIS_ColoredShape implementation details - like playing with DispatchStyles()/DefaultStyle() methods.
Or, if document properties are not actually needed - just use AIS_Shape instead.