MantisBT - Open CASCADE
View Issue Details
0023610Open CASCADE[OCCT] OCCT:DRAWpublic2012-12-03 09:302020-09-11 15:43
[OCCT] 7.6.0* 
0023610: checkshape command does not detect mismatch of the tolerance values among the sub-shapes of the shape
The current implementation of the checkshape command does not provide the detection of mismatch of the tolerance values among the sub-shapes of the shape.
For example:
 restore /dn43/new_tests_data-2012-11-02/public/brep/buc60462b.brep b1
 explode b1 f
 checkshape b1_1
 #This shape seems to be valid
 tolerance b1_1
 #FACE : MAX=0.0060000000000000001
 #EDGE : MAX=2.4118263892078198e-006
 #VERTEX : MAX=0.0060000000000000001

The check on the correspondence of the tolerance values between:
1. EDGE and its VERTICES (the tolerance value of the EDGE should be less then or equal to the minimal tolerance value of its VERTICES),
2. FACE and its sub-shapes (EDGES and VERTICES) (the tolerance value of the FACE should be less then or equal to the minimal tolerance value of its sub-shapes (EDGES and VERTICES))
should be added in the implementation of command.
restore /dn45/occttests/tests/ED/chl/data/buc60463b.brep b
explode b f
checkshape b_1
tolerance b_1
checkshape b_2
tolerance b_2
checkshape b_36
tolerance b_36
No tags attached.
has duplicate 0000330acknowledged skv Open CASCADE checkshape command consider the shape with incorrect order of tolerance as valid. 
related to 0023696assigned abk Open CASCADE Restore work of draw function nexplode for degenerated edges 
related to 0006280closed bugmaster Open CASCADE Problem is tolerance of vertices after blend operation 
Issue History
2012-12-03 09:30emvNew Issue
2012-12-03 09:30emvAssigned To => abv
2012-12-03 11:05abvAssigned Toabv => emv
2012-12-03 11:05abvStatusnew => assigned
2012-12-06 09:44abvAssigned Toemv => omy
2012-12-07 11:38omyNote Added: 0022615
2012-12-07 11:38omyAssigned Toomy => abv
2012-12-07 11:38omyStatusassigned => resolved
2012-12-11 10:19abvNote Added: 0022646
2012-12-11 10:19abvAssigned Toabv => omy
2012-12-11 10:19abvStatusresolved => assigned
2012-12-11 14:11omyNote Added: 0022649
2012-12-11 14:11omyAssigned Toomy => abv
2012-12-11 14:11omyStatusassigned => resolved
2012-12-11 14:11omyNote Edited: 0022649bug_revision_view_page.php?bugnote_id=22649#r4704
2012-12-11 14:11omyNote Edited: 0022649bug_revision_view_page.php?bugnote_id=22649#r4705
2012-12-11 19:33abvNote Added: 0022660
2012-12-11 19:33abvAssigned Toabv => emv
2012-12-11 19:33abvStatusresolved => feedback
2012-12-14 19:45abvNote Added: 0022713
2012-12-14 19:45abvAssigned Toemv => abk
2012-12-14 19:45abvStatusfeedback => assigned
2013-01-11 16:15abkNote Added: 0022943
2013-01-11 16:18abkNote Added: 0022944
2013-01-11 16:19abkAssigned Toabk => abv
2013-01-11 16:19abkStatusassigned => resolved
2013-01-11 16:39abvRelationship addedrelated to 0023696
2013-01-16 16:34bugmasterRelationship addedrelated to 0006280
2013-02-18 12:32abkNote Added: 0023367
2013-02-28 21:52abkNote Added: 0023541
2013-02-28 21:54abkAssigned Toabv => abk
2013-02-28 21:54abkStatusresolved => assigned
2013-03-14 17:33abkNote Added: 0023727
2013-03-14 17:34abkNote Added: 0023728
2013-03-14 17:34abkAssigned Toabk => abv
2013-03-14 17:34abkStatusassigned => resolved
2014-04-04 17:11abvTarget Version => 6.8.0
2014-09-26 08:51abvTarget Version6.8.0 => 7.1.0
2015-04-07 14:39msvRelationship addedrelated to 0026010
2015-04-09 12:00msvAssigned Toabv => msv
2015-04-10 10:13msvStatusresolved => assigned
2016-10-25 14:41msvTarget Version7.1.0 => 7.2.0
2017-07-20 12:01msvTarget Version7.2.0 => 7.3.0
2017-10-05 21:31abvRelationship addedhas duplicate 0000330
2018-02-25 23:12abvTarget Version7.3.0 => 7.4.0
2019-07-10 22:24abvTarget Version7.4.0 => 7.5.0
2020-09-11 15:43utverdovTarget Version7.5.0 => 7.6.0*

2012-12-07 11:38   
Dear abv,
The fix is integrated into branch CR23610.
Please, review.
2012-12-11 10:19   
Some remarks (mostly stylistic):

- In BRepCheck::CheckTolerance():
  a) move calls to BRep_Tool::Tolerance() on S out from the cycles, to avoid doing the same on each iteration
  b) there is no need to check tolerance of vertices contained in edges in the cycle made for face; however we need also to check vertices that can be contained in the face directly
  c) what is a purpose of variables aMin*Tolerance? please remove them
  d) this function is not needed at all (see below), please remove

- In BRepCheck_Edge::InContext():
  a) on line 243: why SubshapeNotInShape is changed to InvalidToleranceValue? looks like done by mistake
  b) on line 249: there is no need to call CheckTolerance which checks ALL edges; it is sufficient to compare tolerance of myShape (edge) and S (face)

- In BRepCheck_Vertex::InContext(), there is no need to call CheckTolerance which checks ALL vertices; it is sufficient to compare tolerance of myShape (vertex) and S (edge)

- In BRepTest_CheckCommands:
  a) in PrintSub(), please make aName to be a static buffer with greater size (e.g. 256) and use restricted size specification for sprintf, to avoid memory leaks (what we obviously have now) and corruption (which is quite possible)
  b) on line 178, avoid outputting specific message for wrong tolerance status
  с) in StructuralDump(), avoid using numeric values (1, ... 33); use enumeration values instead
  d) function FillProblems() is not needed; the following statement should work instead:
2012-12-11 14:11   
Dear abv,
I've made fixes in the branch according to your notes.
Please, review.

2012-12-11 19:33   
I have pushed the revised fix (rebased on master) to CR23610.

Note that the new check causes ~ 800 failures in automatic tests (out of ~ 11.500 tests in total). I suggest we shall discuss whether the tolerance criterion is really critical, to decide whether it should be enforced or can be abandoned.
2012-12-14 19:45   
I have pushed this correction applied to new BOP (0021762) to branch CR23610_CR21762. Please run tests and identify cases when OCCT algorithm produces shapes withh invalid tolerances, to be fixed.
2013-01-11 16:15   
Static public method EnsureToleranceRule(const TopoDS_Shape & theS) was
created in class BRepBuilderAPI_MakeShape to fix all tolerances of the
shape and it's subshapes by the tolerance rule:
vertex tolerance >= edge tolerance >= face tolerance.
Edge or vertex tolerance which does not satisfy the tolerance rule will be
Draw command EnsureTolRule was created to test new functional.
Tolerance post Build (Perform) fix was made for:
- BRepAlgoAPI_BooleanOperation,
- BRepBuilderAPI_Sewing,
- BRepFeat_MakePrism,
- BRepFilletAPI_MakeChamfer,
- BRepFilletAPI_MakeFillet,
- BRepOffsetAPI_MakePipe,
- BRepOffsetAPI_MakePipeShell,
- BRepOffsetAPI_NormalProjection,
- ShapeFix_Shape,
- ShapeUpgrade_ShapeDivide.

Draw command getsourcefile now returns result for:
- buildsweep,
- simulsweep,
- geompipe.

Method BRepGProp::LinearProperties was changed to avoid degenerated edges.

Correction of tolerances in result shape was made for group boolean and grids:
- heal drop_small_edges,

Correction of tolerances in input shapes was made for tests:
- bugs heal bug329,
- bugs modalg buc60462_1,
- bugs moddata buc60652_2,
- bugs step buc60948,
- bugs step bug630,
- bugs vis buc60661,
- bugs vis bug288_1,
- bugs vis bug288_4,
- bugs xde bug859,
- bugs xde bug861,
- feat featlf B8,
       featprism L2,
- sewing tol_0_01 T1.

Test case bugs/modalg/buc60462_2 was changed:
- tolerances were corrected on input shapes by the tolerance rule;
- set of error messages was changed.

Error message was changed in test files:
- chamfer/data/complex/B5,
- chamfer/data/complex/B6,
- chamfer/data/complex/B7.

Error messages was changed in test case heal/drop_small_edges/A4.

Draw function nexplode was replaced by explode in test case blend/complex/D4.

Error message was changed in test case data files:
- heal/data/advanced/H5,
- S7,
- ZC3,
- ZE6,
- ZE8,
- ZE9.
Result shape in the tests is invalid.

Error messages was changed in test case data file chamfer/data/complex/B9.

Error message was changed in test cases:
- thrusection/solids/A2,
- A3,
- A4,
- A5,
- A6,
- A7,
- A8,
- A9.
2013-01-11 16:18   
Branch CR23610 was rebased to branch CR23610_2.
Review it please and direct to testing.
2013-02-18 12:32   
The code was rebased to branch CR23610_3.
2013-02-28 21:52   
BRepBuilderAPI_MakeShape::EnsureToleranceRule was replaced by

BRepBuilderAPI_MakeShape::EnsureToleranceRule was removed.

Draw command 'EnsureTolRule' was replaced by command 'updatetolerance' in

Draw command 'EnsureTolRule' was removed.

Input shapes were corrected by 'updatetolerance' in tests:
- bugs modalg bug697_3,
- bug697_4,
- bug697_7,
- bug697_8,
- bug697_11,
- bug1255,
- bug1255_1,
- bug5729,
- bug6181,
- bug6182,
- bug6272_85,
- bug6272_86,
- bug10842_5.

Error message was changed in tests:
- blend complex F6,
- F8,
- bugs fclasses bug309,

Error message was changed in test data files:
- chamfer data complex B5,
- B7,
- heal data advanced ZD3,
- standard R5.

Error message was changed in test 'bugs modalg bug10232'.

Error message was changed in test file 'heal data advanced ZD1'.

Class BRepLib_ToleranceRule was created to work with shape tolerances by
tolerance rule.

Some code from BRepLib was moved to BRepLib_ToleranceRule.

Tolerance post Build (Perform) fix was changed for:
- BRepBuilderAPI_Sewing,
- BRepFeat_MakePrism,
- BRepFilletAPI_MakeChamfer,
- BRepFilletAPI_MakeFillet,
- BRepOffsetAPI_MakePipe,
- BRepOffsetAPI_MakePipeShell
so that input shapes remain unchanged by the fix.

Tolerance post Build (Perform) fix was slightly changed for:
- BRepOffsetAPI_NormalProjection,
- ShapeFix_Shape,
- ShapeUpgrade_ShapeDivide.

Correction of tolerances in input shapes was made for tests:
- blend buildevol F9,
- complex B6,
- B8,
- D5,
- E2,
- E4,
- E6,
- E9,
- sewing tol_0_01 G3,
- G4.
2013-03-14 17:33   
Build fix in CDL files was made.

Tolerances were corrected for input shapes in tests:
- bugs modalg_1 buc60462_2,
- bug1255,
- bug1255_1,
- bugs modalg_2 bug19811,
- bug22781_1,
- bug22781_2,
- bug22781_3,
- bug22781_4,
- bugs modalg_4 bug625,
- bug767,
- bugs moddata_2 bug75_2,
- bugs vis bug288_10,
- bugs vis bug288_7,
- pipe specific A1 - A9,
- B1 - B9,
- C1 - C6,
- K3 - K9,
- L1 - L9,
- M1 - M9,
- N1 - N5,
- S8 - S9,
- T1 - T9,
- U1 - U7.

Error messages were changed in tests and test files:
- bugs modalg_2 bug472_2,
- heal data advanced H5,
- drop_small_edges A4.

Input shapes checks were added in test bugs modalg_4 bug8842_1.

Tolerance post Build (Perform) fix was changed for BRepOffset_MakeOffset.

Standard_Boolean parameter theCopy with default value Standard_False was
added to methods LocOpe_WiresOnShape::Bind to determine whether to bind
passing shape or its copy.

Tolerance post Build (Perform) fix was created for
- BiTgte_Blend,
- LocOpe_Spliter.

Commands checkshape were added to tests:
- bugs modalg_2 bug22864,
- bug22946,
- modalg_4 bug8842_1.

Minor change in BRepFeat_SplitShape.cxx.
2013-03-14 17:34   
The fix was pushed to branch CR23610_5.
Please review it.