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