View Issue Details

IDProjectCategoryView StatusLast Update
0033318CommunityOCCT:Data Exchangepublic2023-05-22 03:17
Reporterdpasukhi Assigned Tovglukhik  
PrioritynormalSeveritymajor 
Status verifiedResolutionfixed 
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

git

2023-03-23 23:06

administrator   ~0113320

Branch CR33318 has been created by ichesnokova.

SHA-1: 5f7e28e538f7cf30e85a6462f266ed7f69bfabef


Detailed log of new commits:

Author: ichesnok
Date: Thu Mar 23 20:06:06 2023 +0000

    0033318: Data Exchange - Modifying the BRep flag after exporting the shape
    
    fixed

dpasukhi

2023-03-24 11:28

administrator   ~0113321

Last edited: 2023-03-24 11:31

Dear @ichesnokova
Please create new test (or use existed) for checking Bin files (if it is possible)
And update commit massage to more detailed ( 3-5 words are enounght )

There is only one not important remark:
Please use only one new line at the file end
  24 set newstr2 [string trim $string2]
  25 if { [string first $newstr2 $newstr1] == -1 } {
  26   puts "Error: strings is not equal"
  27 }
  28 
  29 

There is additional asking ( reporter try to use Bin format and as i understand get the same trouble, I think they are wrong )
occt\src\BinTools\BinTools_ShapeSet.cxx
482 - 486
Looks fine, but I think it is better to use if (FormatNb() == BinTools_FormatVersion_VERSION_1)
It is why all upper versions should check this flag (I hope).
Or you can update the same way as for TopTools_ShapeSet (your fix)
  if (FormatNb() != BinTools_FormatVersion_VERSION_2 &&
      FormatNb() != BinTools_FormatVersion_VERSION_3)
  {
    aChecked = false; // force check at reading
  }

git

2023-03-24 15:11

administrator   ~0113322

Branch CR33318 has been updated forcibly by ichesnokova.

SHA-1: 35efa392d8d4a797f09e0ec1ff544b608a0a2a68

git

2023-03-24 15:30

administrator   ~0113323

Branch CR33318 has been updated forcibly by ichesnokova.

SHA-1: d64077f14c0a61b5ff812cdba5d03e7c3d025781

git

2023-03-27 13:10

administrator   ~0113334

Branch CR33318 has been updated forcibly by ichesnokova.

SHA-1: d9f13087e2941710c0c52f1b04bbcbb5e1f3d599

git

2023-05-09 15:15

administrator   ~0113449

Branch CR33318 has been updated forcibly by ichesnokova.

SHA-1: 51662ec1528b44af6dd0d33a5af5bf96251e1e4e

git

2023-05-10 10:36

administrator   ~0113451

Branch CR33318 has been updated forcibly by ichesnokova.

SHA-1: b93ffd25bf468ace24c0953fbc2658e271ef577e

ichesnokova

2023-05-17 16:17

developer   ~0113513

Dear dpasukhi, please review branch CR33318.
Tests: http://jenkins-test-10.nnov.opencascade.com/view/CR33318-master-ichesnok/view/ALL/

dpasukhi

2023-05-17 16:17

administrator   ~0113514

Dear bugmaster,
Please integrate:
OCCT: CR33318
PROD: NO

vglukhik

2023-05-22 02:59

administrator   ~0113550

Combination -
OCCT branch : IR-2023-05-19
Products branch : IR-2023-05-19
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Ubuntu2004-64:
OCCT
Total CPU difference: 18391.170000000107 / 18189.450000000208 [+1.11%]
Products
Total CPU difference: 12017.159999999963 / 12137.909999999983 [-0.99%]
Windows-64-VC142:
OCCT
Total CPU difference: 20046.90625 / 19812.3125 [+1.18%]
Products
Total CPU difference: 14550.09375 / 13941.0625 [+4.37%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2023-05-22 03:17

administrator   ~0113553

Branch CR33318 has been deleted by mnt.

SHA-1: b93ffd25bf468ace24c0953fbc2658e271ef577e

Related Changesets

occt: master e3841f9f

2023-03-23 20:06:06

ichesnok


Committer: vglukhik Details Diff
0033318: Data Exchange - Modifying the BRep flag after exporting the shape

Fixed condition for setting 'checked' flag
Affected Issues
0033318
mod - src/BinTools/BinTools_ShapeSet.cxx Diff File
mod - src/TopTools/TopTools_ShapeSet.cxx Diff File
add - tests/bugs/moddata_3/bug33318 Diff File

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
2023-03-23 12:22 dpasukhi Assigned To ika => ichesnokova
2023-03-23 12:22 dpasukhi Status new => assigned
2023-03-23 23:06 git Note Added: 0113320
2023-03-24 11:28 dpasukhi Note Added: 0113321
2023-03-24 11:28 dpasukhi Note Edited: 0113321
2023-03-24 11:29 dpasukhi Note Edited: 0113321
2023-03-24 11:30 dpasukhi Note Edited: 0113321
2023-03-24 11:31 dpasukhi Note Edited: 0113321
2023-03-24 15:11 git Note Added: 0113322
2023-03-24 15:30 git Note Added: 0113323
2023-03-27 13:10 git Note Added: 0113334
2023-05-09 15:15 git Note Added: 0113449
2023-05-10 10:36 git Note Added: 0113451
2023-05-17 16:17 ichesnokova Assigned To ichesnokova => dpasukhi
2023-05-17 16:17 ichesnokova Status assigned => resolved
2023-05-17 16:17 ichesnokova Note Added: 0113513
2023-05-17 16:17 dpasukhi Assigned To dpasukhi => bugmaster
2023-05-17 16:17 dpasukhi Status resolved => reviewed
2023-05-17 16:17 dpasukhi Note Added: 0113514
2023-05-22 02:59 vglukhik Note Added: 0113550
2023-05-22 03:02 vglukhik Changeset attached => occt master e3841f9f
2023-05-22 03:02 vglukhik Assigned To bugmaster => vglukhik
2023-05-22 03:02 vglukhik Status reviewed => verified
2023-05-22 03:02 vglukhik Resolution open => fixed
2023-05-22 03:17 git Note Added: 0113553