
Sun, 03/02/2025 - 23:14
Forums:
Hello,
AIS_InteractiveContext::SetDisplayMode(AIS_WireFrame,true/);
shifts the current view of a set of AIS_Shape(s) to wireframe mode.
From pic00.png to pic01.png.
Here each wireframe of each shape is displayed with the color of the shape.
I would like to display the wireframe of each shape in a certain color. For example all the wireframes in black.
How to do this?
Grazie mille
Giovanni
Mon, 03/03/2025 - 09:01
Which presentations you have created in the first place (
XCAFPrs_AISObject
,AIS_ColoredShape
,AIS_Shape
), and how colors have been assigned to shapes?If you are using
XCAFPrs_AISObject
and colors come from document, I may suggest subclassingXCAFPrs_AISObject::Compute()
and calling base class implementation forAIS_Shaded
display mode andStdPrs_WFShape
forAIS_WireFrame
(e.g. skip the logic inXCAFPrs_AISObject
that does dispatching of colors).Tue, 03/04/2025 - 18:18
Thank you very much for the suggestion,
the presentation of the shapes has been built using
AIS_ColoredShape
so, for changing the color of each shape, for example
for obtaining a fully black wireframe, I use
//! ---------------------------------
//! color of the edges for wireframe
//! ---------------------------------
AIS_ListOfInteractive l;
occContext->ObjectsInside(l,AIS_KOI_Shape,-1);
for(AIS_ListIteratorOfListOfInteractive it(l); it.More(); it.Next())
{
occHandle(AIS_ExtendedShape) AIS = occHandle(AIS_ExtendedShape)::DownCast(it.Value());
if(AIS.IsNull()) continue;
TopTools_IndexedMapOfShape M;
TopExp::MapShapes(AIS->Shape(),TopAbs_EDGE,M);
for(int i=1; i<=M.Extent(); i++)
AIS->SetCustomColor(TopoDS::Edge(M.FindKey(i)),Quantity_NOC_BLACK);
}
occContext->SetDisplayMode(AIS_WireFrame,false);
and it works. See pic00_old and pic01_new
Regards