For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Assembly Identification in STEP 203/214

himanshun's picture
Forums: 

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.

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.