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