MantisBT - Open CASCADE
View Issue Details
0027342Open CASCADE[OCCT] OCCT:Data Exchangepublic2016-04-04 10:472018-12-10 14:02
abv 
abv 
normalminor 
resolvedopen 
 
[OCCT] 7.4.0* 
0027342: STEP - support C++ streams for import / export
Currently STEP translator provides interface to read or save STEP files indicated by file name. For some usages (e.g. to be able to read / write compressed STEP files), it will be instrumental to have interface accepting std::stream in addition to file name.

Note that support of external references in XDE should be also adapted somehow to use of streams (probably as separate issue).
1. Run the ImportExport sample
2. File - Import - STEP...
3. Use filter "ZIP files"
4. Open ZIP archive in which there is one STEP file
No tags attached.
related to 0028312closed apn Open CASCADE Configuration, genproj.tcl - support CSF_ZLIB and CSF_LIBLZMA within project generator 
Issue History
2016-04-04 10:47abvNew Issue
2016-04-04 10:47abvAssigned To => gka
2016-04-04 10:50abvAssigned Togka => imn
2016-04-04 10:50abvStatusnew => assigned
2016-04-04 10:50abvDescription Updatedbug_revision_view_page.php?rev_id=13383#r13383
2016-04-04 11:07gitNote Added: 0052316
2016-04-04 11:19imnNote Added: 0052320
2016-04-04 11:19imnAssigned Toimn => abv
2016-04-04 11:19imnStatusassigned => resolved
2016-04-04 11:19imnSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13385#r13385
2016-04-04 11:26gitNote Added: 0052323
2016-04-06 20:08gitNote Added: 0052455
2016-04-08 10:09imnNote Added: 0052503
2016-11-03 17:38abvTarget Version7.1.0 => 7.2.0
2016-12-29 12:30kgvRelationship addedrelated to 0028312
2017-05-28 17:19kgvRelationship addedrelated to 0026700
2017-08-15 17:11abvTarget Version7.2.0 => 7.4.0*
2018-11-15 19:02gitNote Added: 0081117
2018-11-21 18:56gitNote Added: 0081200
2018-11-26 17:11gitNote Added: 0081264
2018-11-27 17:07gitNote Added: 0081272
2018-11-28 14:10kgvNote Added: 0081282
2018-11-28 14:11kgvNote Edited: 0081282bug_revision_view_page.php?bugnote_id=81282#r20433
2018-11-28 14:11kgvNote Edited: 0081282bug_revision_view_page.php?bugnote_id=81282#r20434
2018-11-29 13:13gitNote Added: 0081292
2018-11-29 13:29ikaNote Added: 0081293
2018-11-29 13:31ikaAssigned Toabv => gka
2018-11-29 16:37gkaNote Added: 0081297
2018-11-29 16:37gkaAssigned Togka => abv
2018-12-06 17:29gitNote Added: 0081412
2018-12-07 15:01szyRelationship addedchild of 0030397
2018-12-07 19:04gitNote Added: 0081426
2018-12-10 11:38ikaNote Added: 0081430
2018-12-10 14:02apnNote Added: 0081432

Notes
(0052316)
git   
2016-04-04 11:07   
Branch CR27342 has been created by imn.

SHA-1: 7b996f71d96a08e406233f3a0e23bd0a7389e226


Detailed log of new commits:

Author: Ivan MECHETIN
Date: Mon Apr 4 11:06:14 2016 +0300

    0027342: STEP - support C++ streams for import / export
    
    - Although Lex and YACC predate C++, have been generated a C++ parser.
    - Porting parser now allows use C++ stream's
    - Added the function of reading the zip archive (zip.cxx, zip.h files with BSD License) with the STEP file
    -- xxx.zip names and archive file inside xxx.stp or (xxx.step) must match
    -- and reading limit no more than one STEP file in the zip-archive
(0052320)
imn   
2016-04-04 11:19   
Dear abv,

Please review the changes in CR27342.
(0052323)
git   
2016-04-04 11:26   
Branch CR27342 has been updated forcibly by imn.

SHA-1: a132adcdb39651d48c381708c6e5d985be30d34b
(0052455)
git   
2016-04-06 20:08   
Branch CR27342_1 has been created by imn.

SHA-1: c18d6bd0551453db447d1f34c9bb98ea66a2d57a


Detailed log of new commits:

Author: imn
Date: Wed Apr 6 16:09:55 2016 +0300

    0027342: STEP - support C++ streams for import / export
    
    - Although Lex and YACC predate C++, have been generated a C++ parser.
    - Porting parser now allows use C++ stream's
    - Added in ImportExport sample the function of reading the .stpZ files (Zip_Files.cxx, Zip_Files.h files with BSD License) with the STEP file
    -- xxx.stpZ names and archive file inside xxx.stp or (xxx.step) must match
    -- and reading limit no more than one STEP file in the stpZ compressed file
(0052503)
imn   
2016-04-08 10:09   
Dear abv,

Please review the changes in CR27342_1.
(0081117)
git   
2018-11-15 19:02   
Branch CR27342_2 has been created by ika.

SHA-1: 7132ac94f700d1bf4b37d9a72b295976ba866dd6


Detailed log of new commits:

Author: imn
Date: Wed Apr 6 16:09:55 2016 +0300

    0027342: STEP - support C++ streams for import / export
    
    - Although Lex and YACC predate C++, have been generated a C++ parser.
    - Porting parser now allows use C++ stream's
    - Added in ImportExport sample the function of reading the .stpZ files (Zip_Files.cxx, Zip_Files.h files with BSD License) with the STEP file
    -- xxx.stpZ names and archive file inside xxx.stp or (xxx.step) must match
    -- and reading limit no more than one STEP file in the stpZ compressed file
(0081200)
git   
2018-11-21 18:56   
Branch CR27342_2 has been updated forcibly by ika.

SHA-1: 8a44065e82c1ab6d20ee7cf1811609251bd1f664
(0081264)
git   
2018-11-26 17:11   
Branch CR27342_2 has been updated forcibly by ika.

SHA-1: 2dde58265b12b2f106f51a83e01e49f7040242df
(0081272)
git   
2018-11-27 17:07   
Branch CR27342_2 has been updated forcibly by ika.

SHA-1: e4061a2cce10c5b2aec5d9294be388b4b9c1bd88
(0081282)
kgv   
2018-11-28 14:10   
(edited on: 2018-11-28 14:11)
Maybe we can split patch in two peaces so that a new feature of MFC Sample is moved into dedicated patch?

It would be also great preparing a new commit description, since original one has unclear wording (like "Although Lex and YACC predate C++, have been generated a C++ parser" which I barely can understand, at least without looking into patch itself).

(0081292)
git   
2018-11-29 13:13   
Branch CR27342_2 has been updated forcibly by ika.

SHA-1: 68fdfab5a9eed9d3b281148b400d5699c86b49ec
(0081293)
ika   
2018-11-29 13:29   
Dear GKA,

now this patch in compliled without errors and warnings, could you please have a look at branches CR27342_2 in OCCT (this is only my fixes initial changes are saved as separate commit) and CR27342 in Products.

http://occt-tests/CR27342_2-CR27342-ika-Products/Windows-64-VC14/diff_summary.html [^]
http://occt-tests/CR27342_2-CR27342-ika-OCCT/Debian80-64/diff_summary.html [^]
http://occt-tests/CR27342_2-CR27342-ika-OCCT/Windows-64-VC14/diff_summary.html [^]
http://occt-tests/CR27342_2-CR27342-ika-Products/Debian80-64/diff_summary.html [^]
(0081297)
gka   
2018-11-29 16:37   
It seems that it will be better:
1.to split commit on the two different commits first for using "c++ parser" and second to read and second for reading ZIP archive containing step file.

2. to avoid replacing existing API method:
 XSControl_Reader::ReadFile(const Standard_CString filename) on the
IFSelect_ReturnStatus XSControl_Reader::ReadFile (const Standard_CString filename, std::istream* istream = 0)
and add new API method XSControl_Reader::ReadStrem(std::istream* istream) to read from stream.
The same situation is with API method IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile(const Standard_CString filename) which was replaced on the IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile
  (const Standard_CString filename, std::istream* istream)


3. Replace abstract virtual method:
    virtual Standard_Integer IFSelect_WorkLibrary::ReadFile(const Standard_CString name, std::istream* istream, Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol) const = 0;

on the empty method:
virtual Standard_Integer IFSelect_WorkLibrary::ReadFile(const Standard_CString name, std::istream* istream, Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol)
{
 return 1;
}
Such correction will allow to avoid modification of the
 IGESSelect_WorkLibrary,
 AcisData_WorkLibrary,
 DxfFile_WorkLibrary,
 XtSelect_WorkLibrary
(0081412)
git   
2018-12-06 17:29   
Branch CR27342_3 has been created by ika.

SHA-1: ee4d9157acdf34beda11a70bca5fb35f9a001e86


Detailed log of new commits:

Author: imn
Date: Wed Apr 6 16:09:55 2016 +0300

    0027342: STEP - support C++ streams for import / export
    
    - New possibility to import STEP from stream.
    - Update STEP low-level parser, using bison/flex generator from C to C++.
    
    Add new method ReadStream(const Standard_CString filename, std::istream* istream) for all necessary classes to access main StepFile_Read() function with using stream.
(0081426)
git   
2018-12-07 19:04   
Branch CR27342_3 has been updated by apn.

SHA-1: 5106b5754b7701eac29e2dd0d18a73f925900510


Detailed log of new commits:

Author: apn
Date: Fri Dec 7 19:02:09 2018 +0300

    Add possibility to generate .cxx (not only .c) files from yacc and lex files

(0081430)
ika   
2018-12-10 11:38   
Dear ABV,

this is an intermediate version for patch

>> Branch CR27342_3 has been created by ika.
>> SHA-1: ee4d9157acdf34beda11a70bca5fb35f9a001e86

could you please review it?

Test results are OK:
http://occt-tests/CR27342_3-master-ika-OCCT/Debian80-64/diff_summary.html [^]
http://occt-tests/CR27342_3-master-ika-OCCT/Windows-64-VC14/diff_summary.html [^]
http://occt-tests/CR27342_3-master-ika-Products/Debian80-64/diff_summary.html [^]
http://occt-tests/CR27342_3-master-ika-Products/Windows-64-VC14/diff_summary.html [^]
(0081432)
apn   
2018-12-10 14:02   
Dear ika,

I've updated CMake procedure for generating .cxx from yacc and lex files.
For building files from cmake:
 - set option BUILD_YACCLEX to ON
 - define variables 3RDPARTY_BISON_EXECUTABLE and 3RDPARTY_FLEX_EXECUTABLE (paths to exe of these programms)

But there are some problems during generation .cxx files. Generated files appear in folder src/TKXSBase, but they should replace already existing files in folder src/StepFile (it's correctly working for ExprIntrp yacc and lex files).

I've tried different version on flex-bison:
\\apn\Delivery\win_flex_bison-2.0.zip - versions matches the ones in the step.yacc (bison 2.7) and lex.step.cxx (flex 2.5.37)
\\apn\Delivery\win_flex_bison-latest.zip

Could you please check this problem.