Skip to content

Commit

Permalink
0033318: Data Exchange - Modifying the BRep flag after exporting the …
Browse files Browse the repository at this point in the history
…shape

Fixed condition for setting 'checked' flag
  • Loading branch information
ir-ch authored and vglukhik committed May 17, 2023
1 parent bcfc5f0 commit e3841f9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/BinTools/BinTools_ShapeSet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion src/TopTools/TopTools_ShapeSet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
27 changes: 27 additions & 0 deletions tests/bugs/moddata_3/bug33318
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e3841f9

Please sign in to comment.