For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

How to make a side of TopoDS_Face transparent

Max Chen's picture
Forums: 

I have a TopoDS_Face on XY plane to present as a platform. What I want is, when I look from above the platform, it's solid. But when I look form below the platform, it's transparent.

I try the following code, it did't works

Handle(AIS_Shape) m_Platform = new AIS_Shape(aTopoDS_Shape_Platform);
m_Platform->SetColor(Quantity_NOC_LIGHTGRAY);

Handle(Graphic3d_AspectFillArea3d) aAspect = new Graphic3d_AspectFillArea3d;
Graphic3d_MaterialAspect ama(Graphic3d_NOM_TRANSPARENT);
aAspect->SetBackMaterial(ama);
m_Platform->Attributes()->SetBasicFillAreaAspect(aAspect);

m_Context->Display(m_Platform, AIS_Shaded, 0, Standard_True);

Kirill Gavrilov's picture

Don't use Graphic3d_PresentationAttributes::BasicFillAreaAspect() - this property has another purpose and is not used by regular presentation builder.
What you are looking for is Prs3d_Drawer::SetShadingAspect() in most cases.

Max Chen's picture

Thank you !

It works now

Handle(AIS_Shape) m_Platform = new AIS_Shape(aTopoDS_Shape_Platform);
Handle(Prs3d_ShadingAspect) aShadingAspect = new Prs3d_ShadingAspect;
aShadingAspect->SetTransparency(1.0, Aspect_TOFM_BACK_SIDE);
m_Platform->Attributes()->SetShadingAspect(aShadingAspect);
m_Platform->SetColor(Quantity_NOC_LIGHTGRAY);
m_Context->Display(m_Platform, AIS_Shaded, 0, Standard_True);

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.