1 -- Created on: 1995-12-08
2 -- Created by: Jacques GOUSSARD
3 -- Copyright (c) 1995-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
8 -- This library is free software; you can redistribute it and/or modify it under
9 -- the terms of the GNU Lesser General Public License version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class Analyzer from BRepCheck
19 ---Purpose: A framework to check the overall
20 -- validity of a shape. For a shape to be valid in Open
21 -- CASCADE, it - or its component subshapes - must respect certain
22 -- criteria. These criteria are checked by the function IsValid.
23 -- Once you have determined whether a shape is valid or not, you can
24 -- diagnose its specific anomalies and correct them using the services of
25 -- the ShapeAnalysis, ShapeUpgrade, and ShapeFix packages.
27 uses Shape from TopoDS,
28 ShapeEnum from TopAbs,
29 Result from BRepCheck,
30 DataMapOfShapeResult from BRepCheck
32 raises NullObject from Standard,
33 NoSuchObject from Standard
37 Create(S: Shape from TopoDS;
38 GeomControls : Boolean from Standard = Standard_True)
39 ---Purpose: Constructs a shape validation object defined by the shape S.
40 -- <S> is the shape to control. <GeomControls> If
41 -- False only topological informaions are checked.
42 -- The geometricals controls are
44 -- BRepCheck_InvalidToleranceValue NYI
46 -- BRepCheck_InvalidCurveOnClosedSurface,
47 -- BRepCheck_InvalidCurveOnSurface,
48 -- BRepCheck_InvalidSameParameterFlag,
49 -- BRepCheck_InvalidToleranceValue NYI
51 -- BRepCheck_UnorientableShape,
52 -- BRepCheck_IntersectingWires,
53 -- BRepCheck_InvalidToleranceValue NYI
55 -- BRepCheck_SelfIntersectingWire
58 returns Analyzer from BRepCheck
59 raises NullObject from Standard;
63 Init(me: in out; S: Shape from TopoDS;
64 GeomControls : Boolean from Standard = Standard_True)
65 ---Purpose: <S> is the shape to control. <GeomControls> If
66 -- False only topological informaions are checked.
67 -- The geometricals controls are
69 -- BRepCheck_InvalidTolerance NYI
71 -- BRepCheck_InvalidCurveOnClosedSurface,
72 -- BRepCheck_InvalidCurveOnSurface,
73 -- BRepCheck_InvalidSameParameterFlag,
74 -- BRepCheck_InvalidTolerance NYI
76 -- BRepCheck_UnorientableShape,
77 -- BRepCheck_IntersectingWires,
78 -- BRepCheck_InvalidTolerance NYI
80 -- BRepCheck_SelfIntersectingWire
82 raises NullObject from Standard
87 IsValid(me; S: Shape from TopoDS)
88 ---Purpose: <S> is a subshape of the original shape. Returns
89 -- <STandard_True> if no default has been detected on
90 -- <S> and any of its subshape.
91 returns Boolean from Standard
92 raises NoSuchObject from Standard
97 ---Purpose: Returns true if no defect is
98 -- detected on the shape S or any of its subshapes.
99 -- Returns true if the shape S is valid.
100 -- This function checks whether a given shape is valid by checking that:
101 -- - the topology is correct
102 -- - parameterization of edges in particular is correct.
103 -- For the topology to be correct, the following conditions must be satisfied:
104 -- - edges should have at least two vertices if they are not
105 -- degenerate edges. The vertices should be within the range of
106 -- the bounding edges at the tolerance specified in the vertex,
107 -- - edges should share at least one face. The representation of
108 -- the edges should be within the tolerance criterion assigned to them.
109 -- - wires defining a face should not self-intersect and should be closed,
110 -- - there should be one wire which contains all other wires inside a face,
111 -- - wires should be correctly oriented with respect to each of the edges,
112 -- - faces should be correctly oriented, in particular with
113 -- respect to adjacent faces if these faces define a solid,
114 -- - shells defining a solid should be closed. There should
115 -- be one enclosing shell if the shape is a solid;
116 -- To check parameterization of edge, there are 2 approaches depending on
117 -- the edge?s contextual situation.
118 -- - if the edge is either single, or it is in the context
119 -- of a wire or a compound, its parameterization is defined by
120 -- the parameterization of its 3D curve and is considered as valid.
121 -- - If the edge is in the context of a face, it should
122 -- have SameParameter and SameRange flags set to Standard_True. To
123 -- check these flags, you should call the function
124 -- BRep_Tool::SameParameter and BRep_Tool::SameRange for an
125 -- edge. If at least one of these flags is set to Standard_False,
126 -- the edge is considered as invalid without any additional check.
127 -- If the edge is contained by a face, and it has SameParameter and
128 -- SameRange flags set to Standard_True, IsValid checks
129 -- whether representation of the edge on face, in context of which the
130 -- edge is considered, has the same parameterization up to the
131 -- tolerance value coded on the edge. For a given parameter t on the edge
132 -- having C as a 3D curve and one PCurve P on a surface S (base
133 -- surface of the reference face), this checks that |C(t) - S(P(t))|
134 -- is less than or equal to tolerance, where tolerance is the tolerance
135 -- value coded on the edge.
137 returns Boolean from Standard
142 Result(me; SubS: Shape from TopoDS)
144 ---C++: return const&
146 returns any Result from BRepCheck
147 raises NoSuchObject from Standard
151 --- Private implementation method
153 Put(me: in out; S: Shape from TopoDS; Gctrl: Boolean from Standard)
158 Perform(me: in out; S: Shape from TopoDS)
163 ValidSub(me; S: Shape from TopoDS; SubType: ShapeEnum from TopAbs)
165 returns Boolean from Standard
171 myShape : Shape from TopoDS;
172 myMap : DataMapOfShapeResult from BRepCheck;