Tue, 10/16/2018 - 17:20
Forums:
I'm using AIS_ColoredShape to display a compound shape containing many wires ("Z-slices" computed out of a shape).
I use AIS_ColoredDrawer::SetHidden(bool) to dynamically show/hide some wires :
const bool hiddenOn = ...;
const TopoDS_Wire& wire = ...;
Handle_AIS_ColoredDrawer aspects = m_aisShape->CustomAspects(wire);
if (!aspects.IsNull())
aspects->SetHidden(hiddenOn);
I then call AIS_InteractiveContext::RecomputePrsOnly() to update the display, but it's slow.
What would be the fastest way to update display after show/hide subshapes of AIS_ColoredShape ?
Wed, 10/17/2018 - 12:23
Hiding sub-shapes within existing presentation without special tricks requires its re-computation. If you need switching visibility dynamically and your AIS_ColoredShape holds a big shape, then you better splitting it into smaller pieces (so that re-computation would take less time). Also, AIS_InteractiveContext::Erase() is a cheap operation (no re-computation) - use it for entire AIS_InteractiveObject, when possible.
Tue, 04/12/2022 - 08:27
I faced same performance issue while hiding/showing sub shapes. I tried the following trick. Hopefully it can solve the performance issue.
if(!m_layer->isVisible ())
SetCustomTransparency (m_shape, 1);
else
SetCustomTransparency (m_shape, 0);
UpdatePresentations ();