View Issue Details

IDProjectCategoryView StatusLast Update
0033318CommunityOCCT:Data Exchangepublic2023-01-25 18:41
Reporterdpasukhi Assigned Toika  
PrioritynormalSeveritymajor 
Status newResolutionopen 
Product Version7.7.0 
Target Version7.8.0 
Summary0033318: Data Exchange - Modifying the BRep flag after exporting the shape
Descriptionhttps://dev.opencascade.org/content/differences-breptools-serializationdeserialization-75-76
[Regression]
In my application I use BRepTools.Write() and BRepTools.Read() to serialize TopoDS_Shape instances to file.
I have found some differences in the behavior of this method when upgrading from OpenCASCADE 7.5 to 7.6. I would expect that if I use BRepTools.Write/Read to serialize and deserialize objects to string as follows:
shape_1 -> string_1 -> shape_2 -> string_2
then string_1 and string_2 would be equal.
With OCCT 7.6, this fails on some shapes where OCCT 7.5 would pass.
As an example, here is a snippet using the OCP bindings in Python.
def dump(shape):
    b = io.BytesIO()
    BRepTools.BRepTools.Write_s(shape, b)
    return b.getvalue().decode('utf-8')
def load(s):
    shape = TopoDS.TopoDS_Shape()
    builder = BRep.BRep_Builder()
    b = io.BytesIO(bytes(s, 'utf-8'))
    BRepTools.BRepTools.Read_s(shape, b, builder)
    return shape
pnt = gp.gp_Pnt(1, 0, 0)
shape_1 = BRepPrimAPI.BRepPrimAPI_MakeSphere(pnt, 1.0).Shape()
# serialize
ser_1 = dump(shape_1)
# deserialize
shape_2 = load(ser_1)
# serialize again
ser_2 = dump(shape_2)
with open('ser_1-7.5.3.txt', 'w') as f:
    f.write(ser_1)
with open('ser_2-7.5.3.txt', 'w') as f:
    f.write(ser_2)
# make sure serialization is the same
assert ser_1 == ser_2

With OCCT 7.5.3, ser_1 == ser_2, while with OCCT 7.6.3 ser_1 != ser_2.
The difference is small - the "checked" bit of the shell entity is flipped.
Is this expected? What is the significance of the "checked" bit?
I also experience the same issue with BinTools, although it is harder to read the output.
TagsNo tags attached.
Test case number

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2023-01-17 01:57 dpasukhi New Issue
2023-01-17 01:57 dpasukhi Assigned To => ika
2023-01-25 18:41 dpasukhi Severity minor => major