From 3cf0f6c033d440f8e820b97d424912a749827ef5 Mon Sep 17 00:00:00 2001 From: ichesnok Date: Thu, 23 Mar 2023 20:06:06 +0000 Subject: [PATCH] 0033318: Data Exchange - Modifying the BRep flag after exporting the shape Fixed condition for setting 'checked' flag --- src/BinTools/BinTools_ShapeSet.cxx | 3 +-- src/TopTools/TopTools_ShapeSet.cxx | 2 +- tests/bugs/moddata_3/bug33318 | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 tests/bugs/moddata_3/bug33318 diff --git a/src/BinTools/BinTools_ShapeSet.cxx b/src/BinTools/BinTools_ShapeSet.cxx index 0460882c7e..9f2cde22fe 100644 --- a/src/BinTools/BinTools_ShapeSet.cxx +++ b/src/BinTools/BinTools_ShapeSet.cxx @@ -479,8 +479,7 @@ void BinTools_ShapeSet::ReadFlagsAndSubs(TopoDS_Shape& S, const TopAbs_ShapeEnum S.Free(aFree); S.Modified(aMod); - if (FormatNb() != BinTools_FormatVersion_VERSION_2 && - FormatNb() != BinTools_FormatVersion_VERSION_3) + if (FormatNb() == BinTools_FormatVersion_VERSION_1) { aChecked = false; // force check at reading } diff --git a/src/TopTools/TopTools_ShapeSet.cxx b/src/TopTools/TopTools_ShapeSet.cxx index ba63755e9e..d37542d54c 100644 --- a/src/TopTools/TopTools_ShapeSet.cxx +++ b/src/TopTools/TopTools_ShapeSet.cxx @@ -702,7 +702,7 @@ void TopTools_ShapeSet::Read(Standard_IStream& IS, const Message_ProgressRange& S.Free (buffer[0] == '1'); S.Modified (buffer[1] == '1'); - const bool isChecked = myFormatNb == TopTools_FormatVersion_VERSION_2 + const bool isChecked = myFormatNb >= TopTools_FormatVersion_VERSION_2 && buffer[2] == '1'; S.Checked (isChecked); diff --git a/tests/bugs/moddata_3/bug33318 b/tests/bugs/moddata_3/bug33318 new file mode 100644 index 0000000000..534473f3f8 --- /dev/null +++ b/tests/bugs/moddata_3/bug33318 @@ -0,0 +1,27 @@ +puts "===========================================================" +puts "0033318: Data Exchange - Modifying the BRep flag after exporting the shape" +puts "===========================================================" + +pload XDE + +set filepath [locate_data_file bug28620.brep] +set f1 [open $filepath "r"] +set string1 [read $f1] +close $f1 + +set conf {provider.BREP.OCC.write.binary : 0} + +set aTmpFile ${imagedir}/tmpfile1.brep +readfile sh1 $filepath +writefile sh1 $aTmpFile -conf $conf + +set f2 [open $aTmpFile "r"] +set string2 [read $f2] +close $f2 + +set newstr [string trim $string2] +if { [string first $newstr [string trim $string1]] == -1 } { + puts "Error: strings is not equal" +} + +file delete -force $aTmpFile