1 -- Created on: 1999-09-13
2 -- Created by: data exchange team
3 -- Copyright (c) 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 CheckSmallFace from ShapeAnalysis
19 ---Purpose: Analysis of the face size
27 DataMapOfShapeShape from TopTools,
28 DataMapOfShapeListOfReal from ShapeAnalysis,
29 DataMapOfShapeListOfShape from TopTools,
30 Status from ShapeExtend
33 Create returns CheckSmallFace from ShapeAnalysis;
34 ---Purpose :Creates an empty tool
37 -- CheckShape (me : in out; S : Shape from TopoDS);
38 ---Purpose : Checks a Shape i.e. each of its faces, records checks as
39 -- diagnostics in the <infos>
41 -- If <infos> has not been set before, no check is done
43 -- For faces which are in a Shell, topological data are recorded
44 -- to allow recovering connectivities after fixing or removing
45 -- the small faces or parts of faces
47 -- CheckFace (me : in out; F : Face from TopoDS; inshell : Boolean);
48 ---Purpose : Enchains various checks on a face
49 -- inshell : to compute more informations, relevant to topology
52 IsSpotFace (me; F : Face from TopoDS;
53 spot : out Pnt from gp; spotol : out Real;
54 tol : Real = -1.0) returns Integer;
55 ---Purpose : Checks if a Face is as a Spot
56 -- Returns 0 if not, 1 if yes, 2 if yes and all vertices are the
58 -- By default, considers the tolerance zone of its vertices
59 -- A given value <tol> may be given to check a spot of this size
60 -- If a Face is a Spot, its location is returned in <spot>, and
61 -- <spotol> returns an equivalent tolerance, which is computed as
62 -- half of max dimension of min-max box of the face
64 CheckSpotFace (me : in out; F : Face from TopoDS; tol : Real = -1.0) returns Boolean;
65 ---Purpose : Acts as IsSpotFace, but records in <infos> a diagnostic
66 -- "SpotFace" with the Pnt as value (data "Location")
68 IsStripSupport (me: in out; F : Face; tol : Real = -1.0) returns Boolean;
69 ---Purpose : Checks if a Face lies on a Surface which is a strip
70 -- So the Face is a strip. But a Face may be a strip elsewhere ..
72 -- A given value <tol> may be given to check max width
73 -- By default, considers the tolerance zone of its edges
74 -- Returns 0 if not a strip support, 1 strip in U, 2 strip in V
76 CheckStripEdges (me; E1, E2 : Edge from TopoDS; tol : Real;
77 dmax : out Real) returns Boolean;
78 ---Purpose : Checks if two edges define a strip, i.e. distance maxi below
79 -- tolerance, given or some of those of E1 and E2
81 FindStripEdges (me: in out; F : Face from TopoDS;
82 E1, E2 : out Edge from TopoDS; tol : Real;dmax : out Real) returns Boolean;
83 ---Purpose : Searchs for two and only two edges up tolerance
84 -- Returns True if OK, false if not 2 edges
85 -- If True, returns the two edges and their maximum distance
88 CheckSingleStrip (me : in out; F : Face from TopoDS; E1,E2 : in out Edge from TopoDS;tol : Real = -1.0)
90 ---Purpose : Checks if a Face is a single strip, i.e. brings two great
91 -- edges which are confused on their whole length, possible other
92 -- edges are small or null length
94 -- Returns 0 if not a strip support, 1 strip in U, 2 strip in V
95 -- Records diagnostic in info if it is a single strip
98 CheckStripFace (me : in out; F : Face from TopoDS;E1,E2 : in out Edge from TopoDS; tol : Real = -1.0)
100 ---Purpose : Checks if a Face is as a Strip
101 -- Returns 0 if not or non determined, 1 if in U, 2 if in V
102 -- By default, considers the tolerance zone of its edges
103 -- A given value <tol> may be given to check a strip of max this width
105 -- If a Face is determined as a Strip, it is delinited by two
106 -- lists of edges. These lists are recorded in diagnostic
107 -- Diagnostic "StripFace" brings data "Direction" (U or V),
108 -- "List1" , "List2" (if they could be computed)
111 CheckSplittingVertices (me : in out; F : Face from TopoDS; MapEdges :in out DataMapOfShapeListOfShape from TopTools;
112 MapParam :in out DataMapOfShapeListOfReal from ShapeAnalysis; theAllVert : in out Compound from TopoDS) returns Integer;
113 ---Purpose : Checks if a Face brings vertices which split it, either
114 -- confused with non adjacent vertices, or confused with their
115 -- projection on non adjacent edges
116 -- Returns the count of found splitting vertices
117 -- Each vertex then brings a diagnostic "SplittingVertex",
118 -- with data : "Face" for the face, "Edge" for the split edge
121 CheckPin (me : in out; F : Face from TopoDS; whatrow,sence : in out Integer) returns Boolean;
122 ---Purpose : Checks if a Face has a pin, which can be edited
123 -- No singularity : no pin, returns 0
124 -- If there is a pin, checked topics, with returned value :
125 -- - 0 : nothing to do more
126 -- - 1 : "smooth", i.e. not a really sharp pin
127 -- -> diagnostic "SmoothPin"
128 -- - 2 : stretched pin, i.e. is possible to relimit the face by
129 -- another vertex, so that this vertex still gives a pin
130 -- -> diagnostic "StretchedPin" with location of vertex (Pnt)
132 CheckTwisted (me : in out; F : Face from TopoDS; paramu,paramv : in out Real) returns Boolean;
133 ---Purpose : Checks if a Face is twisted (apart from checking Pin, i.e. it
134 -- does not give information on pin, only "it is twisted")
136 CheckPinFace(me : in out; F : Face from TopoDS;mapEdges : in out DataMapOfShapeShape from TopTools;toler : Real = -1.0) returns Boolean;
138 CheckPinEdges(me; theFirstEdge: Edge from TopoDS;theSecondEdge: Edge from TopoDS; coef1,coef2 : Real;toler : Real) returns Boolean;
140 Status (me; status: Status from ShapeExtend) returns Boolean;
141 ---Purpose: Returns the status of last call to Perform()
142 -- ShapeExtend_OK : face was OK, nothing done
143 -- ShapeExtend_DONE1: some wires are fixed
144 -- ShapeExtend_DONE2: orientation of wires fixed
145 -- ShapeExtend_DONE3: missing seam added
146 -- ShapeExtend_DONE4: small area wire removed
147 -- ShapeExtend_DONE5: natural bounds added
148 -- ShapeExtend_FAIL1: some fails during fixing wires
149 -- ShapeExtend_FAIL2: cannot fix orientation of wires
150 -- ShapeExtend_FAIL3: cannot add missing seam
151 -- ShapeExtend_FAIL4: cannot remove small area wire
153 SetTolerance (me : in out; tol : Real);
154 ---Purpose : Sets a fixed Tolerance to check small face
155 -- By default, local tolerance zone is considered
158 -- SetMaxTolerance (me : in out; tol : Real);
159 ---Purpose : Sets a fixed MaxTolerance to check small face
162 -- SetMinTolerance (me : in out; tol : Real);
163 ---Purpose : Sets a fixed Tolerance to check small face
164 -- By default, local tolerance zone is considered
167 -- MaxTolerance (me : in out);
168 ---Purpose : Unset fixed tolerance, comes back to local tolerance zones
171 -- MinTolerance (me : in out);
172 ---Purpose : Unset fixed tolerance, comes back to local tolerance zones
175 Tolerance (me) returns Real;
176 ---Purpose : Returns the tolerance to check small faces, negative value if
177 -- local tolerances zones are to be considered
180 StatusSpot (me; status: Status from ShapeExtend) returns Boolean;
183 StatusStrip(me; status: Status from ShapeExtend) returns Boolean;
186 StatusPin(me; status: Status from ShapeExtend) returns Boolean;
189 StatusTwisted(me; status: Status from ShapeExtend) returns Boolean;
192 StatusSplitVert(me; status: Status from ShapeExtend) returns Boolean;
195 StatusPinFace(me; status: Status from ShapeExtend) returns Boolean;
197 StatusPinEdges(me; status: Status from ShapeExtend) returns Boolean;
201 myComp : Shape from TopoDS;
202 myStatus : Integer; -- error statusis
203 myStatusSpot : Integer;
204 myStatusStrip : Integer;
205 myStatusPin : Integer;
206 myStatusTwisted : Integer;
207 myStatusSplitVert: Integer;
208 myStatusPinFace : Integer;
209 myStatusPinEdges : Integer;