1 -- Created on: 1999-09-13
2 -- Created by: data exchange team
3 -- Copyright (c) 1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
23 class CheckSmallFace from ShapeAnalysis
33 DataMapOfShapeShape from TopTools,
34 DataMapOfShapeListOfReal from ShapeAnalysis,
35 DataMapOfShapeListOfShape from TopTools,
36 Status from ShapeExtend
39 Create returns CheckSmallFace from ShapeAnalysis;
40 ---Purpose :Creates an empty tool
43 -- CheckShape (me : in out; S : Shape from TopoDS);
44 ---Purpose : Checks a Shape i.e. each of its faces, records checks as
45 -- diagnostics in the <infos>
47 -- If <infos> has not been set before, no check is done
49 -- For faces which are in a Shell, topological data are recorded
50 -- to allow recovering connectivities after fixing or removing
51 -- the small faces or parts of faces
53 -- CheckFace (me : in out; F : Face from TopoDS; inshell : Boolean);
54 ---Purpose : Enchains various checks on a face
55 -- inshell : to compute more informations, relevant to topology
58 IsSpotFace (me; F : Face from TopoDS;
59 spot : out Pnt from gp; spotol : out Real;
60 tol : Real = -1.0) returns Integer;
61 ---Purpose : Checks if a Face is as a Spot
62 -- Returns 0 if not, 1 if yes, 2 if yes and all vertices are the
64 -- By default, considers the tolerance zone of its vertices
65 -- A given value <tol> may be given to check a spot of this size
66 -- If a Face is a Spot, its location is returned in <spot>, and
67 -- <spotol> returns an equivalent tolerance, which is computed as
68 -- half of max dimension of min-max box of the face
70 CheckSpotFace (me : in out; F : Face from TopoDS; tol : Real = -1.0) returns Boolean;
71 ---Purpose : Acts as IsSpotFace, but records in <infos> a diagnostic
72 -- "SpotFace" with the Pnt as value (data "Location")
74 IsStripSupport (me: in out; F : Face; tol : Real = -1.0) returns Boolean;
75 ---Purpose : Checks if a Face lies on a Surface which is a strip
76 -- So the Face is a strip. But a Face may be a strip elsewhere ..
78 -- A given value <tol> may be given to check max width
79 -- By default, considers the tolerance zone of its edges
80 -- Returns 0 if not a strip support, 1 strip in U, 2 strip in V
82 CheckStripEdges (me; E1, E2 : Edge from TopoDS; tol : Real;
83 dmax : out Real) returns Boolean;
84 ---Purpose : Checks if two edges define a strip, i.e. distance maxi below
85 -- tolerance, given or some of those of E1 and E2
87 FindStripEdges (me: in out; F : Face from TopoDS;
88 E1, E2 : out Edge from TopoDS; tol : Real;dmax : out Real) returns Boolean;
89 ---Purpose : Searchs for two and only two edges up tolerance
90 -- Returns True if OK, false if not 2 edges
91 -- If True, returns the two edges and their maximum distance
94 CheckSingleStrip (me : in out; F : Face from TopoDS; E1,E2 : in out Edge from TopoDS;tol : Real = -1.0)
96 ---Purpose : Checks if a Face is a single strip, i.e. brings two great
97 -- edges which are confused on their whole length, possible other
98 -- edges are small or null length
100 -- Returns 0 if not a strip support, 1 strip in U, 2 strip in V
101 -- Records diagnostic in info if it is a single strip
104 CheckStripFace (me : in out; F : Face from TopoDS;E1,E2 : in out Edge from TopoDS; tol : Real = -1.0)
106 ---Purpose : Checks if a Face is as a Strip
107 -- Returns 0 if not or non determined, 1 if in U, 2 if in V
108 -- By default, considers the tolerance zone of its edges
109 -- A given value <tol> may be given to check a strip of max this width
111 -- If a Face is determined as a Strip, it is delinited by two
112 -- lists of edges. These lists are recorded in diagnostic
113 -- Diagnostic "StripFace" brings data "Direction" (U or V),
114 -- "List1" , "List2" (if they could be computed)
117 CheckSplittingVertices (me : in out; F : Face from TopoDS; MapEdges :in out DataMapOfShapeListOfShape from TopTools;
118 MapParam :in out DataMapOfShapeListOfReal from ShapeAnalysis; theAllVert : in out Compound from TopoDS) returns Integer;
119 ---Purpose : Checks if a Face brings vertices which split it, either
120 -- confused with non adjacent vertices, or confused with their
121 -- projection on non adjacent edges
122 -- Returns the count of found splitting vertices
123 -- Each vertex then brings a diagnostic "SplittingVertex",
124 -- with data : "Face" for the face, "Edge" for the split edge
127 CheckPin (me : in out; F : Face from TopoDS; whatrow,sence : in out Integer) returns Boolean;
128 ---Purpose : Checks if a Face has a pin, which can be edited
129 -- No singularity : no pin, returns 0
130 -- If there is a pin, checked topics, with returned value :
131 -- - 0 : nothing to do more
132 -- - 1 : "smooth", i.e. not a really sharp pin
133 -- -> diagnostic "SmoothPin"
134 -- - 2 : stretched pin, i.e. is possible to relimit the face by
135 -- another vertex, so that this vertex still gives a pin
136 -- -> diagnostic "StretchedPin" with location of vertex (Pnt)
138 CheckTwisted (me : in out; F : Face from TopoDS; paramu,paramv : in out Real) returns Boolean;
139 ---Purpose : Checks if a Face is twisted (apart from checking Pin, i.e. it
140 -- does not give information on pin, only "it is twisted")
142 CheckPinFace(me : in out; F : Face from TopoDS;mapEdges : in out DataMapOfShapeShape from TopTools;toler : Real = -1.0) returns Boolean;
144 CheckPinEdges(me; theFirstEdge: Edge from TopoDS;theSecondEdge: Edge from TopoDS; coef1,coef2 : Real;toler : Real) returns Boolean;
146 Status (me; status: Status from ShapeExtend) returns Boolean;
147 ---Purpose: Returns the status of last call to Perform()
148 -- ShapeExtend_OK : face was OK, nothing done
149 -- ShapeExtend_DONE1: some wires are fixed
150 -- ShapeExtend_DONE2: orientation of wires fixed
151 -- ShapeExtend_DONE3: missing seam added
152 -- ShapeExtend_DONE4: small area wire removed
153 -- ShapeExtend_DONE5: natural bounds added
154 -- ShapeExtend_FAIL1: some fails during fixing wires
155 -- ShapeExtend_FAIL2: cannot fix orientation of wires
156 -- ShapeExtend_FAIL3: cannot add missing seam
157 -- ShapeExtend_FAIL4: cannot remove small area wire
159 SetTolerance (me : in out; tol : Real);
160 ---Purpose : Sets a fixed Tolerance to check small face
161 -- By default, local tolerance zone is considered
164 -- SetMaxTolerance (me : in out; tol : Real);
165 ---Purpose : Sets a fixed MaxTolerance to check small face
168 -- SetMinTolerance (me : in out; tol : Real);
169 ---Purpose : Sets a fixed Tolerance to check small face
170 -- By default, local tolerance zone is considered
173 -- MaxTolerance (me : in out);
174 ---Purpose : Unset fixed tolerance, comes back to local tolerance zones
177 -- MinTolerance (me : in out);
178 ---Purpose : Unset fixed tolerance, comes back to local tolerance zones
181 Tolerance (me) returns Real;
182 ---Purpose : Returns the tolerance to check small faces, negative value if
183 -- local tolerances zones are to be considered
186 StatusSpot (me; status: Status from ShapeExtend) returns Boolean;
189 StatusStrip(me; status: Status from ShapeExtend) returns Boolean;
192 StatusPin(me; status: Status from ShapeExtend) returns Boolean;
195 StatusTwisted(me; status: Status from ShapeExtend) returns Boolean;
198 StatusSplitVert(me; status: Status from ShapeExtend) returns Boolean;
201 StatusPinFace(me; status: Status from ShapeExtend) returns Boolean;
203 StatusPinEdges(me; status: Status from ShapeExtend) returns Boolean;
207 myComp : Shape from TopoDS;
208 myStatus : Integer; -- error statusis
209 myStatusSpot : Integer;
210 myStatusStrip : Integer;
211 myStatusPin : Integer;
212 myStatusTwisted : Integer;
213 myStatusSplitVert: Integer;
214 myStatusPinFace : Integer;
215 myStatusPinEdges : Integer;