1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00
occt/src/BOPAlgo/BOPAlgo_CheckResult.cdl
nbv e98e39903b 0025410: Tool for extended check of validity of the curve on the surface
Modifications:
1. class BOPTools_AlgoTools
1.1. method
 Standard_Boolean BOPTools_AlgoTools::ComputeTolerance
  (const Handle(Geom_Curve)& theCurve3D,
   const Handle(Geom2d_Curve)& theCurve2D,
   const Handle(Geom_Surface)& theSurf,
   const Standard_Real theFirst,
   const Standard_Real theLast,
   Standard_Real& theMaxDist,
   Standard_Real& theMaxPar)
  It computes the max distance between points taken from 3D and 2D curves by the same parameter

1.2. method
 Standard_Boolean BOPTools_AlgoTools::ComputeTolerance
  (const TopoDS_Face& theFace,
   const TopoDS_Edge& theEdge,
   Standard_Real& theMaxDist,
   Standard_Real& theParameter)
  Computes the valid value of the tolerance for the edge using the function above.

2.  Added possibility to check shape on the validity of the curves on the surfaces.
2.1. New status BOPAlgo_InvalidCurveOnSurface has been added to the enumeration BOPAlgo_CheckStatus
2.2. class BOPAlgo_ArgumentAnalyzer
 method
   void BOPAlgo_ArgumentAnalyzer::TestCurveOnSurface()
 It checks each edge/face pair in the shape using the method ComputeTolerance from BOPTools_AlgoTools and stores invalid pairs to myResults.
 Invalid pairs are those which contain the edge with tolerance value less then the value computed by the ComputeTolerance method.

2.3. class BOPAlgo_CheckResult
 Added new fields:
    myMaxDist1 : Real from Standard;
    myMaxDist2 : Real from Standard;
    myMaxPar1  : Real from Standard;
    myMaxPar2  : Real from Standard;
 and corresponding setters and getters.
 These fields are used to store the results of the TestCurveOnSurface() check.

3. Added new option to the bopargcheck command and two new commands.
class BOPTest_CheckCommands
3.1. command bopargcheck
 As it is using the BOPAlgo_ArgumentAnalyzer class to check the shapes
 it checks also the validity of the curves on the surfaces.
 The output for the invalid shapes is following:

Draw[]> bopargcheck b2 /ic #f
Made faulty shape: s1COnS_1 (MaxDist = 0.0013334343378738308, MaxPar = 0.02884285498274167)
Made faulty shape: s1COnS_2 (MaxDist = 0.0013334340648766174, MaxPar = 0.02884285497934707)
Made faulty shape: s1COnS_3 (MaxDist = 0.0013335086668628978, MaxPar = 1.4133051942712607)
Made faulty shape: s1COnS_4 (MaxDist = 0.0013335086525838983, MaxPar = 1.4133051942713901)
Faulties for FIRST  shape found : 4
---------------------------------
Shapes are not suppotrted by BOP: NO
Self-Intersections              : NO
Check for SI has been aborted   : NO
Too small edges                 : NO
Bad faces                       : NO
Too close vertices              : NO
Too close edges                 : NO
Shapes with Continuity C0       : NO
Invalid Curve on Surface        : YES  Cases(4)  Total shapes(8)

Faulties for SECOND  shape found : 0

 The compounds s1COnS_* contain pair of edge and face.
 MaxDist is maximal distance between points taken from 3D curve of the edge and 2D curve of that edge on the face.
 MaxPar is a parameter in which the MaxDist is reached.

 To disable this check it is necessary to use option /S (bopargcheck shape /S).

3.2. command xdistef
 Usage of the command:
   xdistef edge face
 It computes distance between points taken from 3D curve of the edge and 2D curve of that edge on the face.
 Example:
Draw[]> explode s1COnS_1
s1COnS_1_1 s1COnS_1_2
Draw[]> whatis s1COnS_1_1
s1COnS_1_1 is a shape EDGE FORWARD Modified Orientable
Draw[]> whatis s1COnS_1_2
s1COnS_1_2 is a shape FACE FORWARD Modified Orientable
Draw[]> xdistef s1COnS_1_1 s1COnS_1_2
Max Distance = 0.0013334343378738308; Parameter on curve = 0.02884285498274167

3.3. command checkcurveonsurf
 Usage of the command:
  checkcurveonsurf shape.
 It checks each edge/face pair in the shape using the method ComputeTolerance from BOPTools_AlgoTools.
Example:
Draw[]> checkcurveonsurf b2
Invalid curves on surface:
edge e_0 on face f_0 (max dist: 0.0013334343378738, parameter on curve: 0.0288428549827417)
edge e_1 on face f_0 (max dist: 0.0013334340648766, parameter on curve: 0.0288428549793471)
edge e_2 on face f_1 (max dist: 0.0013335086668629, parameter on curve: 1.4133051942712607)
edge e_3 on face f_1 (max dist: 0.0013335086525839, parameter on curve: 1.4133051942713901)

Sugestions to fix the shape:
explode b2 e;
settolerance b2_6 0.0013335086668629;
settolerance b2_7 0.0013334343378738;
settolerance b2_8 0.0013334340648766;
settolerance b2_10 0.0013335086525839;

The command gives suggestions to fix the shape by increasing tolerance values of the invalid edges.
In some cases the tolerance values suggested by the tool can be very large.
Such values should be used very carefully, because setting large tolerance values to the sub-shapes
of the shape can make it non valid (self-interfered) or lead to unexpected result when using
such shapes in some operations (boolean for example).

Test case for issue CR25410
2014-10-30 14:27:29 +03:00

116 lines
3.6 KiB
Plaintext

-- Created on: 2004-09-03
-- Created by: Oleg FEDYAEV
-- Copyright (c) 2004-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class CheckResult from BOPAlgo
---Purpose: contains information about faulty shapes and faulty types
--- can't be processed by Boolean Operations
uses
Shape from TopoDS,
CheckStatus from BOPAlgo,
ListOfShape from BOPCol
is
Create
returns CheckResult;
---Purpose: empty constructor
SetShape1(me: in out; TheShape : Shape from TopoDS);
---Purpose: sets ancestor shape (object) for faulty sub-shapes
AddFaultyShape1(me: in out; TheShape: Shape from TopoDS);
---Purpose: adds faulty sub-shapes from object to a list
SetShape2(me: in out; TheShape: Shape from TopoDS);
---Purpose: sets ancestor shape (tool) for faulty sub-shapes
AddFaultyShape2(me: in out; TheShape: Shape from TopoDS);
---Purpose: adds faulty sub-shapes from tool to a list
GetShape1(me)
returns Shape from TopoDS;
---C++: return const&
---Purpose: returns ancestor shape (object) for faulties
GetShape2(me)
returns Shape from TopoDS;
---C++: return const&
---Purpose: returns ancestor shape (tool) for faulties
GetFaultyShapes1(me)
returns ListOfShape from BOPCol;
---C++: return const&
---Purpose: returns list of faulty shapes for object
GetFaultyShapes2(me)
returns ListOfShape from BOPCol;
---C++: return const&
---Purpose: returns list of faulty shapes for tool
SetCheckStatus(me: in out; TheStatus: CheckStatus from BOPAlgo);
---Purpose: set status of faulty
GetCheckStatus(me)
returns CheckStatus from BOPAlgo;
---Purpose: gets status of faulty
SetMaxDistance1(me:out;
theDist : Real from Standard);
---Purpose: Sets max distance for the first shape
SetMaxDistance2(me:out;
theDist : Real from Standard);
---Purpose: Sets max distance for the second shape
SetMaxParameter1(me:out;
thePar : Real from Standard);
---Purpose: Sets the parameter for the first shape
SetMaxParameter2(me:out;
thePar : Real from Standard);
---Purpose: Sets the parameter for the second shape
GetMaxDistance1(me)
returns Real from Standard;
---Purpose: Returns the distance for the first shape
GetMaxDistance2(me)
returns Real from Standard;
---Purpose: Returns the distance for the second shape
GetMaxParameter1(me)
returns Real from Standard;
---Purpose: Returns the parameter for the fircst shape
GetMaxParameter2(me)
returns Real from Standard;
---Purpose: Returns the parameter for the second shape
fields
myShape1 : Shape from TopoDS;
myShape2 : Shape from TopoDS;
myStatus : CheckStatus from BOPAlgo;
myFaulty1 : ListOfShape from BOPCol;
myFaulty2 : ListOfShape from BOPCol;
myMaxDist1 : Real from Standard;
myMaxDist2 : Real from Standard;
myMaxPar1 : Real from Standard;
myMaxPar2 : Real from Standard;
end CheckResult;