QuestionAuthorHi,
I have the following content in my STEP file:
#14=PRESENTATION_LAYER_ASSIGNMENT('1',
'{052BF154-476B-4C88-8FBB-936FDCD2AF3D}',(#62568,#37507,#62569,#393,#37508,
#37509,#37510,#37511,#37512,#37513,#62570,#62571,#62572,#37514));
I'm using the XCAFDoc_DocumentTool::LayerTool to read the layers:
Handle(XCAFDoc_LayerTool) myLayers = XCAFDoc_DocumentTool::LayerTool(hDoc->Main());
myLayers->GetLayerLabels(layers);
for (int i = 1; i < layers.Length(); ++i)
{
// const Standard_GUID nameGuid("TDataStd_Name");
Handle(TDataStd_Name) nameAttr = new TDataStd_Name();
Handle(XCAFDoc_GraphNode) graphNodeAttr = new XCAFDoc_GraphNode();
graphNodeAttr->SetGraphID("efd212e8-6dfd-11d4-b9c8-0060b0ee281b");
auto l = layers.Value(i);
l.FindAttribute(nameAttr->ID(), nameAttr);
bool found = l.FindAttribute(graphNodeAttr->ID(), graphNodeAttr);
LOG_INFO("nb label children: " << l.NbChildren());
LOG_INFO("nb label attributes: " << l.NbAttributes());
LOG_INFO("name: " << nameAttr->Get());
LOG_INFO("nb graph node children: " << graphNodeAttr->NbChildren());
}
I can read the layer name and "content" just fine. But the PRESENTATION_LAYER_ASSIGNMENT entity also includes a description field.
I need to read that description field. How can I do that?
Thank you for your help,
01AuthorAnswering my own question after a few hours poking around in the OpenCascade code:
Handle(XSControl_WorkSession) session = aReader.Reader().WS();
Handle(Standard_Type) tSVPLA = STANDARD_TYPE(StepVisual_PresentationLayerAssignment);
Handle(Interface_InterfaceModel) Model = session->Model();
Standard_Integer nb = Model->NbEntities();
for (Standard_Integer i = 1; i <= nb; i ++)
{
Handle(Standard_Transient) enti = Model->Value(i);
if (!enti->IsKind(tSVPLA))
continue;
Handle(StepVisual_PresentationLayerAssignment) SVPLA = Handle(StepVisual_PresentationLayerAssignment)::DownCast(enti);
Handle(TCollection_HAsciiString) descr = SVPLA->Description();
Handle(TCollection_HAsciiString) hName = SVPLA->Name();
layerNameToDescription[hName->ToCString()] = descr->ToCString();
}