mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0027245: DRAW command to test binary persistence for shapes
- Added new static methods Read and Write in BinTools class to store/retrieve a shape in binary format. - Added new draw commands "binsave" and "binrestore" - Added test cases to test the new methods. - Updated documantation with desription of the new BinTools class methods and corresponding BRepTools class methods.
This commit is contained in:
@@ -1247,4 +1247,19 @@ For example, in the wire in the image we want to recuperate the edges in the ord
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@subsection occt_modat_5_6 Storage of shapes
|
||||
|
||||
**BRepTools** and **BinTools** packages contain methods *Read* and *Write* allowing to read and write a Shape to/from a stream or a file.
|
||||
The methods provided by **BRepTools** package use ASCII storage format; **BinTools** package use binary format.
|
||||
Each of these methods has two arguments:
|
||||
- a *TopoDS_Shape* object to be read/written;
|
||||
- a stream object or a file name to read from/write to.
|
||||
|
||||
The following sample code reads a shape from ASCII file and writes it to a binary one:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
|
||||
TopoDS_Shape aShape;
|
||||
if (BRepTools::Read (aShape, "source_file.txt")) {
|
||||
BinTools::Write (aShape, "result_file.bin");
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
Reference in New Issue
Block a user