Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0029435Community[OCCT] OCCT:Data Exchangepublic2018-01-18 15:082019-07-10 22:05
Assigned Togka 
PlatformMinGW-w64OSWindowsOS Version7
Product Version[OCCT] 7.3.0 
Target Version[OCCT] 7.5.0*Fixed in Version 
Summary0029435: Exporting wires consisting of more than one edge results in loss of color data in IGES
DescriptionConsider a case where two wires are exported to an IGES file using IGESControl_writer. One Wire consists of two or more edges and the other consists of one edge only. During export, same names and colors are assigned to the corresponding IGESData_IGESEntity of each wire.

However, when the two wires are imported using IGESControl_Reader and their corresponding IGESData_IGESEntity are also fetched then the names are present as they were exported but the color data of the wire with two or more edges is not retrieved.

An example source code is provided to reproduce the explained problem.
Steps To Reproduce#include <TopoDS_Edge.hxx>
#include <TopoDS_Wire.hxx>
#include <TopExp_Explorer.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <GC_MakeSegment.hxx>
#include <IGESControl_Controller.hxx>
#include <Interface_Static.hxx>
#include <XSControl_WorkSession.hxx>
#include <XSControl_TransferReader.hxx>
#include <IGESGraph_Color.hxx>
#include <IGESData_IGESEntity.hxx>
#include <IGESCAFControl.hxx>
#include <IGESBasic_Name.hxx>
#include <BRepToIGES_BREntity.hxx>
#include <IGESControl_Writer.hxx>
#include <IGESControl_Reader.hxx>
#include <Quantity_Color.hxx>

#include <vector>

int main(int argc, char* argv[])
    const std::string filePath = "C://Test.igs"; [^]

//////// GENERATING TEST SHAPES //////////////////
    TopoDS_Edge singleEdge = BRepBuilderAPI_MakeEdge(
            GC_MakeSegment(gp_Pnt(30., 0., 0.), gp_Pnt(30., 10., 0.)).Value());
    TopoDS_Wire singleEdgeWire =

    TopoDS_Edge edge1 = BRepBuilderAPI_MakeEdge(
            GC_MakeSegment(gp_Pnt(60., 0., 0.), gp_Pnt(60., 10., 0.)).Value());
    TopoDS_Edge edge2 = BRepBuilderAPI_MakeEdge(
            GC_MakeSegment(gp_Pnt(60., 10., 0.), gp_Pnt(70., 10., 0.)).Value());
    TopoDS_Wire halfSquareWire =
            BRepBuilderAPI_MakeWire(edge1, edge2).Wire();

    std::vector<TopoDS_Wire> wires { singleEdgeWire, halfSquareWire };

//////// WRITING TO THE IGES FILE //////////////////
    IGESControl_Writer writer;

    BRepToIGES_BREntity shapeConverter;

    for (unsigned int index = 0; index < wires.size(); ++index)
        Handle(IGESData_IGESEntity) entity
                = shapeConverter.TransferShape(;
        Standard_Integer rank = IGESCAFControl::EncodeColor(Quantity_NOC_RED);

        Handle(IGESGraph_Color) color;
        entity->InitColor(color, rank);

        std::cout << "Color rank of wire that has been written: "
                << entity->RankColor() << std::endl;

        Handle(TCollection_HAsciiString) label =
                new TCollection_HAsciiString(new TCollection_HAsciiString("Named Wire"));

        // SetLabel(...) is not used as it does not support long names (> 8 chars)
        Handle(IGESBasic_Name) longNameEntity = new IGESBasic_Name();
        longNameEntity->Init(1, label);





//////// READING THE EXPORTED FILE //////////////////

    IGESControl_Reader reader;

    int rootsNumber = reader.NbRootsForTransfer();
    for (Standard_Integer rootIndex = 1; rootIndex <= rootsNumber; ++rootIndex)

    std::vector<TopoDS_Shape> shapes;
    int shapesNumber = reader.NbShapes();

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

    const Handle(XSControl_WorkSession)& workSession = reader.WS();
    const Handle(XSControl_TransferReader)& transferReader =

    for (auto& shape : shapes)
        const Handle(IGESData_IGESEntity)& shapeEntity =
                        transferReader->EntityFromShapeResult(shape, -1));

        TCollection_HAsciiString shapeName = shapeEntity->NameValue();

        std::cout << "Name during reading shape: " << shapeName.ToCString() << std::endl;

        int colorRank = shapeEntity->RankColor();

        std::cout << "Color Rank during reading shape: " << colorRank << std::endl;

    return 0;
TagsNo tags attached.
Test case number
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2018-01-18 15:08 ziaulazam New Issue
2018-01-18 15:08 ziaulazam Assigned To => gka
2018-01-18 15:32 ziaulazam Steps to Reproduce Updated View Revisions
2019-07-10 22:05 abv Target Version 7.4.0 => 7.5.0*

Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker