0024624: Lost word in license statement in source files
[occt.git] / src / BRepBuilderAPI / BRepBuilderAPI_Sewing.cdl
CommitLineData
b311480e 1-- Created on: 1995-03-23
2-- Created by: Jing Cheng MEI
3-- Copyright (c) 1995-1999 Matra Datavision
973c2be1 4-- Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5--
973c2be1 6-- This file is part of Open CASCADE Technology software library.
b311480e 7--
d5f74e42 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
973c2be1 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.
b311480e 13--
973c2be1 14-- Alternatively, this file may be used under the terms of Open CASCADE
15-- commercial license or contractual agreement.
7fd59977 16
7fd59977 17-- Modified Thu May 7 15:20:25 1998 by David Carbonel (dcl)
18-- Little faces management.
19-- Add of Cutting option.
20-- Optimisation of cutting fonction
21-- Modified Thu Jan 21 13:00:58 MET 1999 by Jing Cheng MEI
22-- Nonmanifold processing
23
24class Sewing from BRepBuilderAPI inherits TShared from MMgt
25
26 ---Purpose: Provides methods to
27 --
28 -- - identify possible contigous boundaries (for control
29 -- afterwards)
30 --
31 -- - assemble contigous shapes into one shape.
32 -- Only manifold shapes will be found. Sewing will not
33 -- be done in case of multiple edges.
34 --
35 -- For sewing, use this function as following:
36 -- - create an empty object
37 -- - default tolerance 1.E-06
38 -- - with face analysis on
39 -- - with sewing operation on
40 -- - set the cutting option as you need (default True)
41 -- - define a tolerance
42 -- - add shapes to be sewed -> Add
43 -- - compute -> Perfom
44 -- - output the resulted shapes
45 -- - output free edges if necessary
46 -- - output multiple edges if necessary
47 -- - output the problems if any
48
49 -- For control, use this function as following:
50 -- - create an empty object
51 -- - default tolerance 1.E-06
52 -- - with face analysis on
53 -- - with sewing operation on
54 -- - set the cutting option as you need (default True)
55 -- - define a tolerance to capture contigous boundaries
56 -- - set if necessary face analysis off
57 -- - set sewing operation off
58 -- - add shapes to be controlled -> Add
59 -- - compute -> Perfom
60 -- - output couples of connected edges (contigous) and
61 -- their original boundary for control
62 -- - output the problems if any
63
64
65uses
66
67 Shape from TopoDS,
68 Edge from TopoDS,
69 ListOfShape from TopTools,
70 MapOfShape from TopTools,
71 DataMapOfShapeShape from TopTools,
72 DataMapOfShapeListOfShape from TopTools,
73 IndexedMapOfShape from TopTools,
74 IndexedDataMapOfShapeShape from TopTools,
75 IndexedDataMapOfShapeListOfShape from TopTools,
76 SequenceOfShape from TopTools,
77 Array1OfShape from TopTools,
78 Face from TopoDS,
79 Array1OfInteger from TColStd,
80 Array1OfPnt from TColgp,
81 Array2OfPnt2d from TColgp,
82 Array1OfBoolean from TColStd,
83 Array1OfReal from TColStd,
84 IndexedMapOfInteger from TColStd,
85 Surface from Geom,
86 Location from TopLoc,
87 Curve from Geom2d,
88 Curve from Geom,
89 Surface from Geom,
90 Pnt from gp,
91 ReShape from BRepTools,
92 SequenceOfInteger from TColStd,
93 SequenceOfReal from TColStd,
92434a36
A
94 SequenceOfPnt from TColgp,
95 ProgressIndicator from Message
7fd59977 96
97raises
98
99 OutOfRange from Standard,
100 NoSuchObject from Standard
101
102is
103
104 Create(tolerance: Real = 1.0e-06; -- tolerance of connexity
105 option1 : Boolean = Standard_True; -- option for sewing
106 option2 : Boolean = Standard_True; -- option for analysis of degenerated shapes
107 option3 : Boolean = Standard_True; -- option for cutting of free edges.
108 option4 : Boolean = Standard_False) -- option for non manifold processing
109 returns Sewing from BRepBuilderAPI;
110 ---Purpose: Creates an object with
111 -- tolerance of connexity
112 -- option for sewing (if false only control)
113 -- option for analysis of degenerated shapes
114 -- option for cutting of free edges.
115 -- option for non manifold processing
116
117 Init(me : mutable; tolerance: Real = 1.0e-06; -- tolerance of connexity
118 option1: Boolean = Standard_True; -- option for sewing
119 option2: Boolean = Standard_True; -- option for analysis of degenerated shapes
120 option3: Boolean = Standard_True; -- option for cutting free edge after first merging
121 -- This option can be set to False if no edge need to be cut.
122 option4: Boolean = Standard_False);-- option for non manifold processing
123 ---Purpose: initialize the parameters if necessary
124
125 Load(me : mutable; shape : Shape from TopoDS);
126 ---Purpose: Loades the context shape.
127
128 Add(me : mutable; shape : Shape from TopoDS);
129 ---Purpose: Defines the shapes to be sewed or controlled
130
92434a36
A
131 Perform(me : mutable;
132 thePI : ProgressIndicator from Message = 0);
7fd59977 133 ---Purpose: Computing
92434a36 134 -- thePI - progress indicator of algorithm
7fd59977 135
136 SewedShape(me) returns Shape from TopoDS;
137 ---C++: return const &
138 ---Purpose: Gives the sewed shape
139 -- a null shape if nothing constructed
140 -- may be a face, a shell, a solid or a compound
0794c042 141
142 SetContext(me : mutable; theContext : ReShape from BRepTools);
143 ---Purpose: set context
144
145 GetContext(me) returns ReShape from BRepTools;
146 ---C++: return const &
147 ---Purpose: return context
7fd59977 148
149 NbFreeEdges(me) returns Integer;
150 ---Purpose: Gives the number of free edges (edge shared by one face)
151
152 FreeEdge(me; index: Integer) returns Edge from TopoDS
153 raises OutOfRange from Standard; -- raised if index < 1 or > NbFreeEdges
154 ---C++: return const &
155 ---Purpose: Gives each free edge
156
157 NbMultipleEdges(me) returns Integer;
158 ---Purpose: Gives the number of multiple edges
159 -- (edge shared by more than two faces)
160
161 MultipleEdge(me; index: Integer) returns Edge from TopoDS
162 raises OutOfRange from Standard; -- raised if index < 1 or > NbMultipleEdges
163 ---C++: return const &
164 ---Purpose: Gives each multiple edge
165
166 NbContigousEdges(me) returns Integer;
167 ---Purpose: Gives the number of contigous edges (edge shared by two faces)
168
169 ContigousEdge(me; index: Integer) returns Edge from TopoDS
170 raises OutOfRange from Standard; -- raised if index < 1 or > NbContigousEdges
171 ---C++: return const &
172 ---Purpose: Gives each contigous edge
173
174 ContigousEdgeCouple(me; index: Integer) returns ListOfShape from TopTools
175 raises OutOfRange from Standard; -- raised if index < 1 or > NbContigousEdges
176 ---C++: return const &
177 ---Purpose: Gives the sections (edge) belonging to a contigous edge
178
179 IsSectionBound(me; section: Edge from TopoDS) returns Boolean;
180 ---Purpose: Indicates if a section is bound (before use SectionToBoundary)
181
182 SectionToBoundary(me; section: Edge from TopoDS) returns Edge from TopoDS
183 raises NoSuchObject from Standard; -- raised if section has not been bound
184 ---C++: return const &
185 ---Purpose: Gives the original edge (free boundary) which becomes the
186 -- the section. Remember that sections constitute common edges.
187 -- This imformation is important for control because with
188 -- original edge we can find the surface to which the section
189 -- is attached.
190
191 NbDegeneratedShapes(me) returns Integer;
192 ---Purpose: Gives the number of degenerated shapes
193
194 DegeneratedShape(me; index: Integer) returns Shape from TopoDS
195 raises OutOfRange from Standard; -- raised if index < 1 or > NbDegeneratedShapes
196 ---C++: return const &
197 ---Purpose: Gives each degenerated shape
198
199 IsDegenerated(me; shape: Shape from TopoDS) returns Boolean;
200 ---Purpose: Indicates if a input shape is degenerated
201
202 IsModified(me; shape: Shape from TopoDS) returns Boolean;
203 ---Purpose: Indicates if a input shape has been modified
204
205 Modified(me ; shape: Shape from TopoDS) returns Shape from TopoDS
206 raises NoSuchObject from Standard; -- raised if shape has not been modified
207 ---C++: return const &
208 ---Purpose: Gives a modifieded shape
209
210 IsModifiedSubShape(me; shape: Shape from TopoDS) returns Boolean;
211 ---Purpose: Indicates if a input subshape has been modified
212
213 ModifiedSubShape(me ; shape: Shape from TopoDS) returns Shape from TopoDS
214 raises NoSuchObject from Standard; -- raised if shape has not been modified
215 ---Purpose: Gives a modifieded subshape
216
217 Dump(me);
218 ---Purpose: print the informations
219
220 NbDeletedFaces(me) returns Integer;
221 ---Purpose: Gives the number of deleted faces (faces smallest than tolerance)
222
223 DeletedFace(me; index: Integer) returns Face from TopoDS
224 raises OutOfRange from Standard; -- raised if index < 1 or > NbDeletedFaces
225 ---C++: return const &
226 ---Purpose: Gives each deleted face
227
228 WhichFace(me; theEdg: Edge from TopoDS; index: Integer = 1) returns Face from TopoDS;
229 ---Purpose: Gives a modified shape
230
231 SameParameterMode(me) returns Boolean;
232 ---C++: inline
233 ---Purpose: Gets same parameter mode.
234
235 SetSameParameterMode(me: in mutable; SameParameterMode : Boolean);
236 ---C++: inline
237 ---Purpose: Sets same parameter mode.
238
239 Tolerance(me) returns Real;
240 ---C++: inline
241 ---Purpose: Gives set tolerance.
242
243 SetTolerance(me: mutable; theToler : Real);
244 ---C++: inline
245 ---Purpose: Sets tolerance
246 MinTolerance(me) returns Real;
247 ---C++: inline
248 ---Purpose: Gives set min tolerance.
249
250 SetMinTolerance(me: mutable; theMinToler : Real);
251 ---C++: inline
252 ---Purpose: Sets min tolerance
253
254 MaxTolerance(me) returns Real;
255 ---C++: inline
256 ---Purpose: Gives set max tolerance
257
258 SetMaxTolerance(me:mutable; theMaxToler : Real);
259 ---C++: inline
260 ---Purpose: Sets max tolerance.
261
262 FaceMode(me) returns Boolean;
263 ---C++: inline
264 ---Purpose: Returns mode for sewing faces By default - true.
265
266 SetFaceMode(me: mutable; theFaceMode : Boolean);
267 ---C++: inline
268 ---Purpose: Sets mode for sewing faces By default - true.
269
270 FloatingEdgesMode(me) returns Boolean;
271 ---C++: inline
272 ---Purpose: Returns mode for sewing floating edges By default - false.
273
274 SetFloatingEdgesMode(me: mutable; theFloatingEdgesMode : Boolean);
275 ---C++: inline
276 ---Purpose: Sets mode for sewing floating edges By default - false.
277
278-- CuttingFloatingEdgesMode(me) returns Boolean;
279 ---C++: inline
280 ---Purpose: Returns mode for cutting floating edges By default - false.
281
282-- SetCuttingFloatingEdgesMode(me: mutable; theCuttingFloatingEdgesMode : Boolean);
283 ---C++: inline
284 ---Purpose: Sets mode for cutting floating edges By default - false.
285
286 LocalTolerancesMode(me) returns Boolean;
287 ---C++: inline
288 ---Purpose: Returns mode for accounting of local tolerances
289 -- of edges and vertices during of merging.
290
291 SetLocalTolerancesMode(me: mutable; theLocalTolerancesMode : Boolean);
292 ---C++: inline
293 ---Purpose: Sets mode for accounting of local tolerances
294 -- of edges and vertices during of merging
295 -- in this case WorkTolerance = myTolerance + tolEdge1+ tolEdg2;
296
297 SetNonManifoldMode(me: mutable; theNonManifoldMode : Boolean);
298 ---C++: inline
299 ---Purpose: Sets mode for non-manifold sewing.
300
301 NonManifoldMode(me) returns Boolean;
302 ---C++: inline
303 ---Purpose: Gets mode for non-manifold sewing.
304 -------------------------
305 --- INTERNAL FUCTIONS ---
306 -------------------------
307
92434a36
A
308 Cutting(me : mutable;
309 thePI : ProgressIndicator from Message = 0) is protected;
7fd59977 310 ---Purpose: Performs cutting of sections
92434a36 311 -- thePI - progress indicator of processing
7fd59977 312
92434a36
A
313 Merging(me : mutable; passage : Boolean;
314 thePI : ProgressIndicator from Message = 0) is protected;
7fd59977 315
316 IsMergedClosed(me;
317 Edge1 : Edge from TopoDS;
318 Edge2 : Edge from TopoDS;
319 fase : Face from TopoDS)
320 returns Boolean is protected;
321
322 FindCandidates(me : mutable;
323 seqSections : in out SequenceOfShape from TopTools;
324 mapReference : in out IndexedMapOfInteger from TColStd;
325 seqCandidates : in out SequenceOfInteger from TColStd;
326 seqOrientations : in out SequenceOfInteger from TColStd)
327 returns Boolean is protected;
328
329 AnalysisNearestEdges(me : mutable;
330 sequenceSec : SequenceOfShape from TopTools;
331 seqIndCandidate : in out SequenceOfInteger from TColStd;
332 seqOrientations : in out SequenceOfInteger from TColStd;
333 evalDist : Boolean = Standard_True) is protected;
334
335 ---Purpose:
336
337 MergedNearestEdges(me : mutable;
338 edge : Shape from TopoDS;
339 SeqMergedEdge : in out SequenceOfShape from TopTools;
340 SeqMergedOri : in out SequenceOfInteger from TColStd)
341 returns Boolean is protected;
342 ---Purpose: Merged nearest edges.
343
92434a36
A
344 EdgeProcessing(me : mutable;
345 thePI : ProgressIndicator from Message = 0) is protected;
7fd59977 346
347 CreateOutputInformations(me : mutable) is protected;
348
349 ---------------------------------
350 --- VIRTUAL INTERNAL FUCTIONS ---
351 ---------------------------------
352
353 IsUClosedSurface(me; surf : Surface from Geom; theEdge : Shape from TopoDS;
354 theloc : Location from TopLoc)
355 returns Boolean is virtual protected;
356 ---Purpose: Defines if surface is U closed.
357
358 IsVClosedSurface(me; surf : Surface from Geom; theEdge : Shape from TopoDS;
359 theloc : Location from TopLoc)
360 returns Boolean is virtual protected;
361 ---Purpose:Defines if surface is V closed.
362
92434a36
A
363 FaceAnalysis(me : mutable;
364 thePI : ProgressIndicator from Message = 0) is virtual protected;
365 ---Purpose:
366 -- This method is called from Perform only
367 -- thePI - progress indicator of processing
7fd59977 368
369 FindFreeBoundaries(me : mutable) is virtual protected;
370 ---Purpose:
371 -- This method is called from Perform only
372
92434a36
A
373 VerticesAssembling(me : mutable;
374 thePI : ProgressIndicator from Message = 0) is virtual protected;
375 ---Purpose:
376 -- This method is called from Perform only
377 -- thePI - progress indicator of processing
7fd59977 378
379 CreateSewedShape(me : mutable) is virtual protected;
380 ---Purpose:
381 -- This method is called from Perform only
382
383 GetFreeWires(me : mutable;
384 MapFreeEdges : in out MapOfShape from TopTools;
385 seqWires : in out SequenceOfShape from TopTools) is virtual protected;
386 ---Purpose: Get wire from free edges.
387 -- This method is called from EdgeProcessing only
388
389 EvaluateAngulars(me;
390 sequenceSec : in out SequenceOfShape from TopTools;
391 secForward : in out Array1OfBoolean from TColStd;
392 tabAng : in out Array1OfReal from TColStd;
393 indRef : in Integer) is virtual protected;
394 ---Purpose:
395 -- This method is called from MergingOfSections only
396
397 EvaluateDistances(me;
398 sequenceSec : in out SequenceOfShape from TopTools;
399 secForward : in out Array1OfBoolean from TColStd;
400 tabAng : in out Array1OfReal from TColStd;
401 arrLen : in out Array1OfReal from TColStd;
402 tabMinDist : in out Array1OfReal from TColStd;
403 indRef : in Integer) is virtual protected;
404 ---Purpose:
405 -- This method is called from MergingOfSections only
406
407 SameRange(me;
408 CurvePtr : Curve from Geom2d;
409 FirstOnCurve : Real from Standard;
410 LastOnCurve : Real from Standard;
411 RequestedFirst : Real from Standard;
412 RequestedLast : Real from Standard)
413 returns Curve from Geom2d is virtual protected;
414 ---Purpose:
415 -- This method is called from SameParameterEdge only
416
417 SameParameter(me; edge : Edge from TopoDS) is virtual protected;
418 ---Purpose:
419 -- This method is called from SameParameterEdge only
420
421 SameParameterEdge(me : mutable;
422 edge : Shape from TopoDS;
423 seqEdges : SequenceOfShape from TopTools;
424 seqForward : SequenceOfInteger from TColStd;
425 mapMerged : in out MapOfShape from TopTools;
426 locReShape : ReShape from BRepTools)
427 returns Edge from TopoDS is virtual protected;
428 ---Purpose:
429 -- This method is called from Merging only
430
431 SameParameterEdge(me : mutable;
432 edge1 : Edge from TopoDS;
433 edge2 : Edge from TopoDS;
434 listFaces1 : ListOfShape from TopTools;
435 listFaces2 : ListOfShape from TopTools;
436 secForward : Boolean ;
437 whichSec : in out Integer;
438 firstCall : Boolean = Standard_True)
439 returns Edge from TopoDS is virtual protected;
440 ---Purpose:
441 -- This method is called from Merging only
442
443 ProjectPointsOnCurve(me;
444 arrPnt : Array1OfPnt from TColgp;
445 Crv : Curve from Geom;
446 first : Real from Standard;
447 last : Real from Standard;
448 arrDist : in out Array1OfReal from TColStd;
449 arrPara : in out Array1OfReal from TColStd;
2028d00c
G
450 arrProj : in out Array1OfPnt from TColgp;
451 isConsiderEnds : in Boolean from Standard) is protected;
7fd59977 452 ---Purpose: Projects points on curve
453 -- This method is called from Cutting only
454
455 CreateCuttingNodes(me : mutable;
456 MapVert : IndexedMapOfShape from TopTools;
457 bound : Shape from TopoDS;
458 vfirst : Shape from TopoDS;
459 vlast : Shape from TopoDS;
460 arrDist : Array1OfReal from TColStd;
461 arrPara : Array1OfReal from TColStd;
462 arrPnt : Array1OfPnt from TColgp;
463 seqNode : in out SequenceOfShape from TopTools;
464 seqPara : in out SequenceOfReal from TColStd) is virtual protected;
465 ---Purpose: Creates cutting vertices on projections
466 -- This method is called from Cutting only
467
468 CreateSections(me : mutable;
469 bound : Shape from TopoDS;
470 seqNode : SequenceOfShape from TopTools;
471 seqPara : SequenceOfReal from TColStd;
472 listEdge : in out ListOfShape from TopTools) is virtual protected;
473 ---Purpose: Performs cutting of bound
474 -- This method is called from Cutting only
475
476 SameParameterShape(me : mutable) is virtual protected;
477 ---Purpose: Makes all edges from shape same parameter
478 -- if SameParameterMode is equal to Standard_True
479 -- This method is called from Perform only
480
481fields
482
483 -- Input data
484 myTolerance : Real is protected;
485 mySewing : Boolean is protected;
486 myAnalysis : Boolean is protected;
487 myCutting : Boolean is protected;
488 -- Indicates if the cutting will be done or not.
489 -- Default value is true.
490 myNonmanifold : Boolean is protected;
491 myFaceMode : Boolean; -- Mode for sewing faces by default true
492 myFloatingEdgesMode : Boolean; -- Mode for sewing floating edges by default - false
493-- myCuttingFloatingEdgesMode : Boolean; -- Mode for cutting of floating edges by default - false
494 mySameParameterMode : Boolean;
495 myLocalToleranceMode : Boolean;
496
497 myOldShapes : IndexedDataMapOfShapeShape from TopTools is protected;
498 -- input shape -> input shape after analysis
499 mySewedShape : Shape from TopoDS is protected;
500 -- contains the sewed shape
501 myDegenerated : IndexedMapOfShape from TopTools is protected;
502 -- contains all degenerated shapes
503 myFreeEdges : IndexedMapOfShape from TopTools is protected;
504 -- contains all free edges
505 -- (edge shared by only one face)
506 myMultipleEdges : IndexedMapOfShape from TopTools is protected;
507 -- contains all multiple edges
508 -- (edge shared by more than two faces)
509 myContigousEdges : IndexedDataMapOfShapeListOfShape from TopTools is protected;
510 -- contains all contigous edges
511 -- (edge shared by two faces) and a list of sections
512 -- (two edges) which constitute each contigous edge
513 myContigSecBound : DataMapOfShapeShape is protected;
514 -- for each section belong to a contigous edge
515 -- indicates its the original free boundary
516
517 -- Work data
518 -- OldShape : input shapes
519 -- Shape : input shapes after analysis
520 -- Bound : free boundaries
521 -- Section : free boundaries after cutting
522 -- Edge : connected sections become edge
523 -- - Free edge : edge shared by one face
524 -- - Contigous edge : edge shared by two faces
525 -- - Multiple edge : edge shared by more than two faces
526 -- Vertex : vertices on free boundaries
527 -- Node : assembled vertices become node
528
529 myNbShapes : Integer is protected; -- number of input shapes after analysis
530 myNbVertices : Integer is protected; -- number of nodes after assembling
531 myNbEdges : Integer is protected; -- number of edges after merging
532
533 myBoundFaces : IndexedDataMapOfShapeListOfShape from TopTools is protected;
534 -- for EACH bound contains a list of faces (REFERENCE map)
535 myBoundSections : DataMapOfShapeListOfShape from TopTools is protected;
536 -- for bound contains a list of cutting sections if any
537 --mySectionEdge : DataMapOfShapeShape from TopTools is protected;
538 -- for section contains a merged edge for this section
539 mySectionBound : DataMapOfShapeShape from TopTools is protected;
540 -- for EACH section contains its bound
541 myVertexNode : IndexedDataMapOfShapeShape from TopTools is protected;
542 -- for EACH original vertex contains a node
543 myVertexNodeFree : IndexedDataMapOfShapeShape from TopTools is protected;
544 -- for EACH floating vertex contains a node
545 myNodeSections : DataMapOfShapeListOfShape from TopTools is protected;
546 -- for EACH node contains a list of sections
547 myCuttingNode : DataMapOfShapeListOfShape from TopTools is protected;
548 -- nodes cutting edges
549 myLittleFace : IndexedMapOfShape from TopTools is protected;
550 -- Faces to be suppress because they are too little
551 myMinTolerance : Real;
552
553 myMaxTolerance : Real;
554
555 myShape : Shape from TopoDS is protected;
556
557 myReShape : ReShape from BRepTools is protected;
558 myMergedEdges : MapOfShape from TopTools;
559end Sewing;