MantisBT - Community
View Issue Details
0032264Community[OCCT] OCCT:Data Exchangepublic2021-03-29 18:382021-04-14 11:44
grey.christoforo_170262 
bugmaster 
normalmajor 
verifiedfixed 
LinuxArch Linux5.11.10
[OCCT] 7.5.0 
[OCCT] 7.5.2 
bugs/step/bug32264
0032264: Data Exchange - STEP exporter generates bad geometry [REGRESSION since 7.4.0]
Today (v7.5.1), the step file export pathway generates incorrect geometry. This is not a problem in 7.4.0. I think it's also in 7.5.0.

- Use version 7.5.1 (I think 7.5.0 also shows the bug).
- Run the following draw test harness script with the attached good_geometry.brep file:

##### DRAWEXE.script Begin #####
pload XDE MODELING VISUALIZATION

vinit View1
restore good_geometry.brep good

testwritestep bad.stp good
testreadstep  bad.stp bad
vdisplay -dispMode 1 bad good
vsetlocation good 6 0 0
vfit
##### DRAWEXE.script End #####


- Then run it like this: DRAWEXE -i -f DRAWEXE.script

You'll now have a file on your disk called bad.stp which will contain incorrect geometry (as compared with good_geometry.brep). Several boolean subtractions have somehow turned into unions!
https://i.ibb.co/Xbk8HXb/Screenshot-from-2021-03-29-16-31-41.png [^]

Shows the bad (step exported and reimported) geometry on the left and the good (original .brep) file on the right.

Also see downstream bug reports:
https://github.com/CadQuery/cadquery/issues/697 [^]
https://tracker.freecadweb.org/view.php?id=4610 [^]
No tags attached.
has duplicate 0032273closed bugmaster Community Data Exchange - STEP Export producing bad geometry from BREP Files 
related to 0032278feedback ekrylova Open CASCADE Data Exchange - Incorrect saving of shape in STEP. 
? good_geometry.brep (24,283) 2021-03-29 18:38
https://tracker.dev.opencascade.org/
png Screenshot-from-2021-03-29-16-31-41.png (9,584) 2021-03-30 11:46
https://tracker.dev.opencascade.org/
? step_740_OK.stp (92,933) 2021-03-30 11:52
https://tracker.dev.opencascade.org/
? step_750_KO.stp (92,933) 2021-03-30 11:52
https://tracker.dev.opencascade.org/
? bug32264.brep (24,283) 2021-03-31 11:44
https://tracker.dev.opencascade.org/
Issue History
2021-03-29 18:38grey.christoforo_170262New Issue
2021-03-29 18:38grey.christoforo_170262Assigned To => gka
2021-03-29 18:38grey.christoforo_170262File Added: good_geometry.brep
2021-03-29 19:10kgvTarget Version => 7.6.0*
2021-03-29 19:10kgvSummarystep exporter generates bad geometry => Data Exchange - STEP exporter generates bad geometry
2021-03-29 19:10kgvDescription Updatedbug_revision_view_page.php?rev_id=24883#r24883
2021-03-29 19:10kgvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=24885#r24885
2021-03-29 23:22auAssigned Togka => au
2021-03-29 23:23auAssigned Toau => gka
2021-03-30 11:46kgvFile Added: Screenshot-from-2021-03-29-16-31-41.png
2021-03-30 11:52kgvFile Added: step_740_OK.stp
2021-03-30 11:52kgvFile Added: step_750_KO.stp
2021-03-30 11:52kgvSummaryData Exchange - STEP exporter generates bad geometry => Data Exchange - STEP exporter generates bad geometry [REGRESSION since 7.4.0]
2021-03-30 12:00kgvRelationship addedchild of 0031301
2021-03-30 12:00kgvNote Added: 0099858
2021-03-30 12:13grey.christoforo_170262Note Added: 0099860
2021-03-30 12:23kgvNote Added: 0099861
2021-03-30 12:24kgvNote Edited: 0099861bug_revision_view_page.php?bugnote_id=99861#r24900
2021-03-30 12:45grey.christoforo_170262Note Added: 0099862
2021-03-30 12:50kgvNote Added: 0099864
2021-03-30 12:53grey.christoforo_170262Note Added: 0099866
2021-03-30 13:44kgvNote Added: 0099868
2021-03-30 13:44kgvNote Edited: 0099868bug_revision_view_page.php?bugnote_id=99868#r24902
2021-03-30 14:17grey.christoforo_170262Note Added: 0099869
2021-03-30 15:00grey.christoforo_170262Note Added: 0099873
2021-03-30 15:05grey.christoforo_170262Note Edited: 0099873bug_revision_view_page.php?bugnote_id=99873#r24906
2021-03-31 11:43gitNote Added: 0099900
2021-03-31 11:44gkaFile Added: bug32264.brep
2021-03-31 13:55gitNote Added: 0099906
2021-03-31 14:55gkaRelationship addedrelated to 0032273
2021-03-31 15:40grey.christoforo_170262Note Edited: 0099873bug_revision_view_page.php?bugnote_id=99873#r24943
2021-03-31 15:44gkaNote Added: 0099911
2021-03-31 15:46gkaNote Added: 0099912
2021-03-31 15:46gkaAssigned Togka => abv
2021-03-31 15:46gkaStatusnew => resolved
2021-03-31 15:57grey.christoforo_170262Note Added: 0099913
2021-03-31 16:00gkaNote Added: 0099914
2021-03-31 19:31abvNote Added: 0099925
2021-03-31 19:31abvAssigned Toabv => bugmaster
2021-03-31 19:31abvStatusresolved => reviewed
2021-03-31 20:33abvTarget Version7.6.0* => 7.5.2
2021-04-02 14:12kgvRelationship addedrelated to 0032278
2021-04-03 11:57bugmasterNote Added: 0100025
2021-04-03 11:57bugmasterStatusreviewed => tested
2021-04-03 12:06bugmasterTest case number => bugs/step/bug32264
2021-04-03 12:13bugmasterChangeset attached => occt master 5e4f263d
2021-04-03 12:13bugmasterStatustested => verified
2021-04-03 12:13bugmasterResolutionopen => fixed
2021-04-03 12:50gitNote Added: 0100064
2021-04-03 14:11kgvRelationship replacedhas duplicate 0032273
2021-04-13 19:36dpasukhiRelationship addedrelated to 0032228
2021-04-14 11:44kgvRelationship replacedhas duplicate 0032228

Notes
(0099858)
kgv   
2021-03-30 12:00   
This test case is a regression after a patch for #0031301.
(0099860)
grey.christoforo_170262   
2021-03-30 12:13   
What's #0031301? I can't seem to resolve that number to anything (although maybe I'm just bad at using this site and too accustomed to github!).

Could you point to a commit hash?
(0099861)
kgv   
2021-03-30 12:23   
(edited on: 2021-03-30 12:24)
> What's 0031301?
This is a reference to another bug, which has fixed another STEP export issue.
It is inaccessible to you, but you can find related git commit in log using this number:
https://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff;h=7ef1f9b7c1d9301c158a593dc5facb5a33450318 [^]

(0099862)
grey.christoforo_170262   
2021-03-30 12:45   
Ah, thanks for the link!

This regression must have come from changes between the 7.4.0 and the 7.5.0 releases, right?
(0099864)
kgv   
2021-03-30 12:50   
> This regression must have come from changes between the 7.4.0 and the 7.5.0 releases, right?
Yes.
(0099866)
grey.christoforo_170262   
2021-03-30 12:53   
I'll see if I can help a bit with bisecting it.
(0099868)
kgv   
2021-03-30 13:44   
> I'll see if I can help a bit with bisecting it.
Thanks for help, but there is nothing to bisect - I've already identified exact commit.
So at this point it is necessary to analyze new test case and find the way to handle both scenarios.
Of course, you may just revert the commit, which would fix specific case, but this will lead to issues in other scenarios (which patch has fixed).

(0099869)
grey.christoforo_170262   
2021-03-30 14:17   
> I've already identified exact commit.
All makes sense to me now. I wasn't reading that commit correctly. Thanks for working so quickly to target the issue! I think I'll see what happens if I revert that commit. Seems like I should be watching out for side effects impacting very short/small edges in my step exports after reverting this.
(0099873)
grey.christoforo_170262   
2021-03-30 15:00   
(edited on: 2021-03-31 15:40)
I can confirm that reverting 7ef1f9b7c1d9301c158a593dc5facb5a33450318 fixes a number of incorrect and corrupted geometry features in __my__ project's step file outputs with no apparent side effects.

Thank you very much kgv! I'll be happy to test whatever final solution comes along in time!

(0099900)
git   
2021-03-31 11:43   
Branch CR32264 has been created by gka.

SHA-1: 056e13b1c067bb4bdd96837ab2ad6a848f3597b9


Detailed log of new commits:

Author: gka
Date: Wed Mar 31 11:43:16 2021 +0300

    0032264: Data Exchange - STEP exporter generates bad geometry [REGRESSION since 7.4.0]
    
    Location of edge is applied to geom curve before analysis of vertices projections
(0099906)
git   
2021-03-31 13:55   
Branch CR32264 has been updated forcibly by gka.

SHA-1: 7f536e166c716605eb625f283779da5f72b0d24f
(0099911)
gka   
2021-03-31 15:44   
Results of tests:

http://occt-tests/CR32264-master-gka-OCCT/Windows-64-VC14/summary.html [^]
http://occt-tests/CR32264-master-gka-OCCT/Debian80-64/summary.html [^]
http://occt-tests/CR32264-master-gka-Products/Debian80-64/diff_summary.html [^]
http://occt-tests/CR32264-master-gka-Products/Debian80-64/summary.html [^]
(0099912)
gka   
2021-03-31 15:46   
Branch CR32264 is ready to be reviewed.
(0099913)
grey.christoforo_170262   
2021-03-31 15:57   
I can confirm a patch made from branch CR32264 applies cleanly over the 7.5.1 release source and causes good step file exports with no apparent side effects. It fixes incorrect and corrupted step file geometry I was seeing in several of my projects.

Thank you very much for working so quickly to come up with a solution!
(0099914)
gka   
2021-03-31 16:00   
Thank you very much for confirmation.
(0099925)
abv   
2021-03-31 19:31   
No remarks, please integrate
(0100025)
bugmaster   
2021-04-03 11:57   
Combination -
OCCT branch : IR-2021-04-02
master SHA - 5e4f263d1cfd948e6a91aa584919bb6d86256a86
a87b7ddc8cb44606b91e3f37113847c3f5f50fdc
Products branch : IR-2021-04-02 SHA - 7cc5f9bb4eb61152ffc5290516ae20c649a33a55
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:
Debian80-64:
OCCT
Total CPU difference: 18055.90000000045 / 18179.810000000525 [-0.68%]
Products
Total CPU difference: 11506.800000000105 / 11565.220000000114 [-0.51%]
Windows-64-VC14:
OCCT
Total CPU difference: 19512.09375 / 19430.5 [+0.42%]
Products
Total CPU difference: 12943.234375 / 12843.765625 [+0.77%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
(0100064)
git   
2021-04-03 12:50   
Branch CR32264 has been deleted by inv.

SHA-1: 7f536e166c716605eb625f283779da5f72b0d24f