MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0029373Community[OCCT] OCCT:Data Exchangepublic2017-12-06 15:512017-12-06 19:04
ReporterBenjaminBihler 
Assigned Togka 
PrioritynormalSeverityminor 
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target Version[OCCT] 7.3.0*Fixed in Version 
Summary0029373: STEP exporter writes TopoDS_Wire as TopoDS_Edges
DescriptionThe problem has been described here: https://www.opencascade.com/content/save-wire-step-file. [^]

If a TopoDS_Wire is exported to a STEP file and read back, then it appears as a compound of TopoDS_Edges. If this STEP file is opened in CATIA, the connectivity is lost. On the other hand, if CATIA exports a wire to a STEP file, both CATIA and OCCT get a wire when they read in the file. This greatly reduces the convenience of OCCT STEP files when working with CATIA.

An example program is pasted as "Steps To Reproduce".

Ideas from the reporter (who is not at all familiar with the STEP format):
CATIA seems to export a wire as a "COMPOSITE_CURVE", while OCCT exports the wire as a "GEOMETRIC_CURVE_SET". The former seems to be somehow better...?
Steps To Reproducemain.cpp, please also see the attached files:

#include <TopoDS_Edge.hxx>
#include <TopoDS_Wire.hxx>
#include <TopExp_Explorer.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <STEPControl_Reader.hxx>
#include <STEPControl_Writer.hxx>
#include <GC_MakeSegment.hxx>

#include <iostream>

void checkStepFile(const std::string& filePath)
{
    STEPControl_Reader reader;

    IFSelect_ReturnStatus status = reader.ReadFile(filePath.c_str());

    if (status != IFSelect_RetDone)
    {
        std::cerr << "Could not read file." << std::endl;
        exit(1);
    }

    bool failsonly = false;
    reader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity);

    int rootsNumber = reader.NbRootsForTransfer();
    reader.PrintCheckTransfer(failsonly, IFSelect_ItemsByEntity);

    for (Standard_Integer rootIndex = 1; rootIndex <= rootsNumber; rootIndex++)
    {
        reader.TransferRoot(rootIndex);
        int shapesNumber = reader.NbShapes();

        for (int shapeIndex = 1; shapeIndex <= shapesNumber; shapeIndex++)
        {
            TopoDS_Shape shape = reader.Shape(shapeIndex);

            std::cout << "Shape " << shapeIndex << " has type: " << shape.ShapeType()
                    << std::endl;

            if (TopAbs_COMPOUND == shape.ShapeType())
            {
                std::cout << "Exploring shape." << std::endl;

                for (TopExp_Explorer explorer(shape, TopAbs_EDGE, TopAbs_WIRE); explorer.More();
                        explorer.Next())
                {
                    std::cout << "Compound contains an edge." << std::endl;
                }

                for (TopExp_Explorer explorer(shape, TopAbs_WIRE); explorer.More();
                        explorer.Next())
                {
                    std::cout << "Compound contains a wire." << std::endl;
                }
            }
        }
    }
}

int main(int, char**)
{
    const std::string filePath = "C://Test.stp"; [^]
    const std::string catiaFilePath = "C://TestCATIA.stp"; [^]

    TopoDS_Edge aEdge1 = BRepBuilderAPI_MakeEdge(
            GC_MakeSegment(gp_Pnt(0., 0., 0.), gp_Pnt(0., 10., 0.)).Value());
    TopoDS_Edge aEdge2 = BRepBuilderAPI_MakeEdge(
            GC_MakeSegment(gp_Pnt(0., 10., 0.), gp_Pnt(10., 10., 0.)).Value());
    TopoDS_Edge aEdge3 = BRepBuilderAPI_MakeEdge(
            GC_MakeSegment(gp_Pnt(10., 10., 0.), gp_Pnt(10., 0., 0.)).Value());
    TopoDS_Edge aEdge4 = BRepBuilderAPI_MakeEdge(
            GC_MakeSegment(gp_Pnt(10., 0., 0.), gp_Pnt(0., 0., 0.)).Value());

    TopoDS_Wire aWire1 =
            BRepBuilderAPI_MakeWire(aEdge1, aEdge2, aEdge3, aEdge4).Wire();

    STEPControl_Writer writer;
    writer.Transfer(aWire1, STEPControl_AsIs);
    writer.Write(filePath.c_str());

    std::cout << std::endl << "Checking the file that we have written:"
            << std::endl << std::endl;

    checkStepFile(filePath);

    std::cout << std::endl << "Checking the file that CATIA has written:"
            << std::endl << std::endl;

    checkStepFile(catiaFilePath);

    return 0;
}
TagsNo tags attached.
Test case number
Attached Files? file icon TestCATIA.stp (4,662 bytes) 2017-12-06 15:51
? file icon TestOCCT.stp (3,243 bytes) 2017-12-06 15:52

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2017-12-06 15:51 BenjaminBihler New Issue
2017-12-06 15:51 BenjaminBihler Assigned To => gka
2017-12-06 15:51 BenjaminBihler File Added: TestCATIA.stp
2017-12-06 15:52 BenjaminBihler File Added: TestOCCT.stp


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker