
Fri, 11/03/2006 - 12:04
I am reading step files using XDE. I am facing problem in identifying sub-assemblies in an assembly.
Using STEPCAFControl_Reader class as follows:
/////// Code ///////
reader = new STEPCAFControl_Reader();
reader->Reader().ClearShapes();
retStatus = reader->ReadFile( (Standard_CString) inputFile);
Handle(TDocStd_Document) doc = new TDocStd_Document("step_model");
if ( reader->Transfer( doc))
{
Handle(XCAFDoc_ShapeTool) root = XCAFDoc_DocumentTool::ShapeTool( doc->Main());
TDF_LabelSequence labels;
root->GetFreeShapes( labels); // root assemblies and components
unsigned int nRoots = labels.Length();
for ( unsigned int i = 1; i
{
TDF_Label label = labels.Value(i);
// Root assembly
if(XCAFDoc_ShapeTool::IsAssembly( label))
{
//Sub-assembly and parts shapes
TDF_ChildIDIterator nodeIterator( label, XCAFDoc::ShapeRefGUID());
for (; nodeIterator.More(); nodeIterator.Next())
{
Handle(TDataStd_TreeNode) node = Handle(TDataStd_TreeNode)::DownCast(nodeIterator.Value());
if ( node->HasFather())
{
TDF_Label parentLabel = node->Father()->Label();
// Sub- Assembly
if ( parentLabel.HasChild())
{
}
else
//Part
.....
////// Code End ////////////
The sub assembly identification works in some step files, but not all.I will be really happy if I can get some clues as to where it can be wrong. Is there a consistent way to identify sub-assembly irrespective of file scema( 203 or 214).
Thanks in advance. I will post replies which may help others also.
Fri, 02/09/2007 - 13:09
hi him,
Me too facing the same problem...let me kno whether you got it resolved it by now....
Regards,
Arun prasath
Fri, 02/09/2007 - 13:12
hi him,
Me too facing the same problem...let me kno whether you got it resolved it by now....
Regards,
Arun prasath