Thu, 12/14/2023 - 20:57
Hi,
I'm using OCCT 7.7.2 and I'm trying to use LayerTool::GetLayer().
As you can see in the source code, right now seems to return the name attribute instead of the actual layer.
Please see attached screenshot to see source code from 7.7.2 and screenshot from inspector in order to verify that sample CAD comes with layers.
Any way to read actual attribute layers from a label?
Kind regards,
Lorenzo Navarro
Attachments:
Thu, 12/14/2023 - 21:17
hello, which attiributes you want to read?
Best regards, Dmitrii.
Fri, 12/15/2023 - 13:40
Layers, please see the attached screenshot "layers.png"
As stated in the previous message, the actual implementation of GetLayers from LayerTool is not working.
Right now (v7.7.2),
XCADDoc_LayerTool::GetLayer(const TDF_Label& lab, TCollection_ExtendedString& aLayer) const
seems that is returning attributes names.Fri, 12/15/2023 - 12:59
You want to find label layer or connected shapes? We have no own class for Layer, only reference and connection + name, color and materials.
Best regards, Dmitrii.
Fri, 12/15/2023 - 13:01
Helps you to get connected shapes
Helps to get any layer labels.
Best regards, Dmitrii.
Fri, 12/15/2023 - 14:07
I want to get the layer that appears as a reference on a label.
Please see attached image "layers.png".
As I understand, In this case the layer 0:1:1:1:22 contains a reference to a layer 0:1:3:2 with name "table".
What I want is to get 0:1:3:2 in order to get the name.
I manage to get it using the following steps:
1- Iterate by all attributes from a label searching for a Layer attribute.
2- Once found get the GraphNode and then get the label associated to it.
3- Get name from that label.
As my understanding, steps 1 and 2 are the ones that
XCADDoc_LayerTool::GetLayer(const TDF_Label& lab, TCollection_ExtendedString& aLayer) const
should be doing...Fri, 12/15/2023 - 14:23
XCADDoc_LayerTool offer two way of connection: extract each LayerLabels(sequence of 0:1:3:*) or extract layer list connected with specific label.
There is full sample to extract shapes connected to specific layer. Any details in header file or documentation.
Fri, 12/15/2023 - 15:20
Sorry but why should I need the shapes in this case? I just want the layer associated with a specific Label.
The first 2 lines inside your
for
sample doesn't work:GetLayer as I said on my first message is returning the name attribute, as you can see in OCCT 7.7.2, and I think that this is incorrect:
Kind regards,
Lorenzo
Fri, 12/15/2023 - 16:06
Returning name is correct. Please read include file.
Getting layer connected to shape(shapeLabel) is available by "aLTool->GetLayers(const TopoDS_Shape& Sh, TDF_LabelSequence& aLayerLS)
Best regards, Dmitrii.
Fri, 12/15/2023 - 16:07
My sample was correct with purpose to extract each layer and its connection. If you need to excract layer from connection need another sample. Use my previous message about "aLTool->GetLayers(const TopoDS_Shape& Sh, TDF_LabelSequence& aLayerLS) "