MantisBT - Open CASCADE
View Issue Details
0031074Open CASCADE[OCCT] OCCT:Data Exchangepublic2019-10-17 10:022020-09-14 10:43
kgv 
bugmaster 
normalminor 
verifiedfixed 
[OCCT] 7.4.0 
[OCCT] 7.5.0 
0031074: Data Exchange - RWMesh_CafReader::addShapeIntoDoc() incorrectly assigns sub-shapes within recursion
RWMesh_CafReader::addShapeIntoDoc() (and JTCAFControl_Reader::addShapeIntoDoc()) incorrectly implements recursion while assigning attributes to sub-shapes:
Standard_Boolean RWMesh_CafReader::addShapeIntoDoc (const TopoDS_Shape& theShape,
                                                    const TDF_Label& theLabel,
                                                    const TCollection_AsciiString& theParentName)

...
    // add shape as sub-shape
    aNewLabel = aShapeTool->AddSubShape (theLabel, theShape);
    if (!aNewLabel.IsNull())
    {
      Handle(XCAFDoc_ShapeMapTool) aShapeMapTool = XCAFDoc_ShapeMapTool::Set (aNewLabel);
      aShapeMapTool->SetShape (theShape);
    }
...
  // store sub-shapes (iterator is set to ignore Location)
  TCollection_AsciiString aDummyName;
  for (TopoDS_Iterator aSubShapeIter (theShape, Standard_True, Standard_False); aSubShapeIter.More(); 
aSubShapeIter.Next())
  {
    addShapeIntoDoc (aSubShapeIter.Value(), aNewRefLabel, aDummyName);
  }


so that when sub-shape also has sub-shapes, the method tries adding them as sub-shape to parent shape.
Based on description from XCAF team, this is incorrect - sub-shapes should be added as plain list of Component, not recursively on labels of sub-shapes; so that addShapeIntoDoc() should be called with Component label and not Sub-shape parent shape label.
In addition, it is desired NOT adding dedicated sub-shape labels in case, when it has no special attribute (color, name, metadata) to avoid redundant information in XCAF document.

Note that existing RWMesh_CafReader implementations RWGltf_CafReader and RWObj_CafReader fill the document with hierarchy of Compounds with Faces - so that the issue with sub-shapes and lost attributes should not practically happen. But this might become an issue in future - hence, should be fixed.

JTCAFControl_Reader contains code duplication of RWMesh_CafReader, so it might be worth sub-classing and revising JTCAFControl_Reader in scope of this or another issue.
No tags attached.
child of 0030692closed bugmaster Open CASCADE Data Exchange - introduce base framework RWMesh for importing mesh data formats into XDE document 
Issue History
2019-10-17 10:02kgvNew Issue
2019-10-17 10:02kgvAssigned To => gka
2019-10-17 10:03kgvRelationship addedrelated to 0031069
2019-10-17 10:03kgvRelationship addedchild of 0030692
2019-10-17 10:03kgvRelationship addedrelated to 0029890
2020-09-11 17:49gkaTarget Version7.5.0 => 7.6.0*
2020-09-11 19:43kgvRelationship addedrelated to 0030945
2020-09-11 19:45kgvNote Added: 0094514
2020-09-11 19:45kgvAssigned Togka => bugmaster
2020-09-11 19:45kgvStatusnew => feedback
2020-09-11 19:45kgvTarget Version7.6.0* => 7.5.0
2020-09-14 10:43bugmasterStatusfeedback => verified
2020-09-14 10:43bugmasterResolutionopen => fixed

Notes
(0094514)
kgv   
2020-09-11 19:45   
Dear bugmaster,

the issue has been fixed in scope of #0030945.
Please switch this bug to VERIFIED state.