View Issue Details

IDProjectCategoryView StatusLast Update
0033434CommunityOCCT:Data Exchangepublic2023-09-30 01:30
ReporterichesnokovaAssigned To 
PrioritynormalSeverityminor 
Status newResolutionopen 
Product Version7.7.0 
Target VersionUnscheduled 
Summary0033434: Data Exchange - Incorrect converting of model from .stp file to .gltf file
DescriptionAfter converting to a .glb file, one of the parts of the model does not look the same as it was originally.
Regression since OCCT 7.7.0.
Steps To Reproduce
int main(int argc, char* argv[]) {
    const char* stepFileName = "C:\\Programs\\step2gltf\\test\\Case2_GEAR.step";
    const char* gltfFileName = "C:\\Programs\\step2gltf\\gltf\\Case2_GEAR_Official.glb";

    // Create XDE document
    Handle(TDocStd_Document) doc;
    Handle(XCAFApp_Application) app = XCAFApp_Application::GetApplication();
    BinXCAFDrivers::DefineFormat(app);
    app->NewDocument("BinXCAF", doc);

    // Parse step file into XDE document
    STEPCAFControl_Reader reader;
    IFSelect_ReturnStatus readStat = reader.ReadFile(stepFileName);
    reader.Transfer(doc);

    Handle(XCAFDoc_ShapeTool) shapeTool = XCAFDoc_DocumentTool::ShapeTool(doc->Main());
    TDF_LabelSequence aRootLabels;
    shapeTool->GetFreeShapes(aRootLabels);

    TopoDS_Compound aCompound;
    BRep_Builder    aBuildTool;
    aBuildTool.MakeCompound(aCompound);
    for (TDF_LabelSequence::Iterator aRootIter(aRootLabels); aRootIter.More(); aRootIter.Next())
    {
        const TDF_Label& aRootLabel = aRootIter.Value();
        TopoDS_Shape aRootShape;
        if (XCAFDoc_ShapeTool::GetShape(aRootLabel, aRootShape))
        {
            aBuildTool.Add(aCompound, aRootShape);
        }
    }

    // perform meshing
    Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer(); // holds visualization defaults
    BRepMesh_IncrementalMesh anAlgo;
    anAlgo.ChangeParameters().Deflection = 0.1;
    anAlgo.ChangeParameters().Angle = 20.0 * M_PI / 180.0; // 20 degrees
    anAlgo.ChangeParameters().InParallel = true;
    anAlgo.SetShape(aCompound);
    anAlgo.Perform();

    // write or export the document
    TColStd_IndexedDataMapOfStringString aMetadata;
    RWGltf_CafWriter aGltfWriter(gltfFileName, true);

    // STEP reader translates into mm units by default
    aGltfWriter.ChangeCoordinateSystemConverter().SetInputLengthUnit(0.001);
    aGltfWriter.ChangeCoordinateSystemConverter().SetInputCoordinateSystem(RWMesh_CoordinateSystem_Zup);
    Message_ProgressRange optionalIndicator;
    if (!aGltfWriter.Perform(doc, aMetadata, optionalIndicator))
    {
        // export error
    }
}
Additional information
and documentation updates
https://dev.opencascade.org/content/fail-convert-geomrectangulartrimmedsurface-step-files-gltf-files
TagsNo tags attached.
Test case number

Attached Files

  • Case2_GEAR.step (783,957 bytes)
  • Case2_GEAR_Official.glb (1,174,748 bytes)
  • input_model_picture.jpg (360,385 bytes)
  • output_result_picture.jpg (165,381 bytes)
  • step2gltf_official.cpp (2,606 bytes)

Activities

ichesnokova

2023-07-26 14:10

developer   ~0113790

Case2_GEAR.step (783,957 bytes)
Case2_GEAR_Official.glb (1,174,748 bytes)
input_model_picture.jpg (360,385 bytes)
output_result_picture.jpg (165,381 bytes)
step2gltf_official.cpp (2,606 bytes)

Issue History

Date Modified Username Field Change
2023-07-26 14:07 ichesnokova New Issue
2023-07-26 14:07 ichesnokova Assigned To => ika
2023-07-26 14:08 dpasukhi Product Version => 7.7.0
2023-07-26 14:10 ichesnokova Note Added: 0113790
2023-07-26 14:10 ichesnokova File Added: Case2_GEAR.step
2023-07-26 14:10 ichesnokova File Added: Case2_GEAR_Official.glb
2023-07-26 14:10 ichesnokova File Added: input_model_picture.jpg
2023-07-26 14:10 ichesnokova File Added: output_result_picture.jpg
2023-07-26 14:10 ichesnokova File Added: step2gltf_official.cpp
2023-07-26 14:16 dpasukhi Steps to Reproduce Updated
2023-07-26 14:16 dpasukhi Additional Information Updated
2023-09-30 01:30 ika Assigned To ika =>