XCAFPrs

Hi all,

I've got some problems with XCAFPrs:

1) Transparency
when I try to change the transparency like in the OCAFSample I don't see a result

void Im_Presentation3D::SetTransparency(const Standard_Real newTransparency)
{
if (!m_pViewerAIS->m_pAISContext.IsNull())
{
for (m_pViewerAIS->m_pAISContext->InitCurrent(); m_pViewerAIS->
m_pAISContext->MoreCurrent(); m_pViewerAIS->m_pAISContext->NextSelected())
{
if (!m_pViewerAIS->m_pAISContext->Current().IsNull())
m_pViewerAIS->m_pAISContext->SetTransparency(m_pViewerAIS->m_pAISContext->Current(), newTransparency, Standard_True);
}
}
}

2) Labels
Is there an easy way getting the TDF_Label for a selected shape in an AIS_InteractiveContext?

Since OCC is doing something similar in its XDE demo there should be a solution. Any hints would be nice.

Regards,

Patrik

Serge's picture

Hi,

The question #2:
If I've got you right you want to get a TDF_Label from selected AIS_Shape. If you use TPrsStd_AISPresentation to display the shape it's possible to find a label like that:

Handle(TPrsStd_AISPresentation) AP;

//aAISShape -> selected shape IO

if( aAISShape->HasOwner() ) {
AP= Handle(TPrsStd_AISPresentation)::DownCast(aAISShape->GetOwner());
TDF_Label aLabel = AP->Label();
}

Serge

Patrik Mueller's picture

Hi Serge,

thanks - but I've already solved it via XCAF_ShapeTool.
But it seems XAFPrs doesn't support transparency - I think I' have to write my own presentation.

Thanks for the help,

Patrik