Hello.
AIS interface of OCCT is flexible and offers you full control on any attributes.
There are 2 possible solution, write you own drawing or override attributes of already existed shapes. I will share some small samples, but correct samples require the infromation about your implementation.
Additionally, OCCT offers technical support (guiding you with OCCT usage), custom development (helping to create or modify your application or only some parts), trainings (online or on-side trainings with OCCT experts) and e-learnings.
The sample (it is just peaces of different classes, but just samples with overriding material of solids or edges):
void ImageDump::displayCutCurves(const BSONReader::CuttingCurves& aCuttingCurvesData,
Handle(AIS_InteractiveContext) theContext) const
{
for (const auto& aCurveData : aCuttingCurvesData)
{
for (const auto& aTransformation : aCurveData.second)
{
Handle(AIS_Shape) aShapePrs = new AIS_Shape(aCurveData.first);
aShapePrs->SetLocalTransformation(aTransformation);
const Quantity_Color aCuttingLineColor = myVisParams.UseSpecifiedColor
? myVisParams.ColorCuttingLine
: Quantity_NOC_BLUE;
aShapePrs->SetColor(aCuttingLineColor);
aShapePrs->Attributes()->SetLineAspect(new Prs3d_LineAspect(aCuttingLineColor, Aspect_TOL_SOLID, 5.0));
theContext->Display(aShapePrs, AIS_Shaded, -1, Standard_False);
}
}
}
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(myDoc->Main());
TDF_LabelSequence aRootLabels;
aShapeTool->GetFreeShapes(aRootLabels);
for (TDF_LabelSequence::Iterator anIt(aRootLabels); anIt.More(); anIt.Next())
{
Handle(XCAFPrs_AISObject) aShapePrs = new XCAFPrs_AISObject(anIt.Value());
if (myVisParams.HasFaceBoundaries)
{
aShapePrs->Attributes()->SetFaceBoundaryAspect(new Prs3d_LineAspect(myVisParams.BoundariesColor, Aspect_TOL_SOLID, 1.0));
}
aContext->Display(aShapePrs, AIS_Shaded, -1, Standard_False);
}
void ImageDump::displaySolids(const BSONShapesData& theShapesData,
Handle(AIS_InteractiveContext) theContext)
{
for (const auto& aShapeData : theShapesData.GetShapesData())
{
const TopoDS_Shape& aCurrentShape = aShapeData.first;
const BSONShapesData::ShapeIndices& aCurrentIndices = aShapeData.second;
const std::vector<gp_Trsf>* aTransformations = theShapesData.GetTransformations(aCurrentIndices);
if (!aTransformations)
{
continue;
}
for (const auto& aTransformation : *aTransformations)
{
Handle(AIS_ColoredShape) aShapePrsTransformed = new AIS_ColoredShape(aCurrentShape);
// Set color.
if (const Quantity_Color* aColor = theShapesData.GetColor(aCurrentIndices))
{
aShapePrsTransformed->SetColor(*aColor);
}
// Set transformation.
aShapePrsTransformed->SetLocalTransformation(aTransformation);
// Set face boundary aspect.
if (myVisParams.HasFaceBoundaries)
{
aShapePrsTransformed->Attributes()->SetFaceBoundaryAspect(new Prs3d_LineAspect(myVisParams.BoundariesColor,
Aspect_TOL_SOLID,
1.));
}
// Add to context.
theContext->Display(aShapePrsTransformed, AIS_Shaded, -1, Standard_False);
}
}
}Best regards, Commenter-1