
Tue, 12/23/2008 - 12:27
Forums:
Hello!
I am trying to assign custom attributes to a subshape in an xcaf document that was generated by STEPCAFControl_Reader. None of ShapeTool's member functions FindMainShape, Search or SearchUsingMap return a non-null Label for the main shape. I created a map of the subshapes found in the document using TopExp::MapShapes on the shapes returned by ShapeTool::GetShapes. In this map I was able to find the subshape I was looking for.
How can I use ShapeTool to find the main shape or assembly?
Regards,
Dirk
Tue, 12/23/2008 - 16:14
Storing a map of subshape, mainlabel worked to find the mainshape. After setting and initializing an XCAFDoc_ShapeMapTool for each free shape, I could then call XCAFDoc_ShapeTool::AddSubshape( mainlabel, subshape ) and receive a valid subshape label. This only seems to work around some problem. What is going wrong here? What am I missing?
Thanks,
Dirk
Wed, 01/07/2009 - 18:12
FindMainShape considers only main shapes that are not assemblies. Does anybody know the reason for this? Where can I find more information on assemblies? How can I reference a subshape of an assembly?
Thanks,
Dirk
Wed, 01/07/2009 - 18:37
Hi Dirk,
here's a snippet to iterate the subshapes of an assembly:
if (m_pXDEShapes->IsAssembly(tmpLabel))
{
TDF_LabelSequence shapeLabels;
TDF_Label aLabel;
m_pXDEShapes->GetComponents(tmpLabel, shapeLabels);
Standard_Integer nbShapes = shapeLabels.Length();
for (Standard_Integer i = 1; i <= nbShapes; i++)
{
Im_Entity3DPtr tmpEntity = ReadShape(shapeLabels.Value(i));
}
Ignore ReadShape - its one of my methods...
Hope this helps,
Patrik