Integration of OCCT 6.5.0 from SVN
[occt.git] / src / BRepToIGES / BRepToIGES_BRWire.cxx
CommitLineData
7fd59977 1// Copyright: Matra-Datavision 1995
2// File: BRepToIGES_BRWire.cxx
3// Created: Fri Jan 27 11:51:27 1995
4// Author: Marie Jose MARTZ
5// <mjm>
6//:q4 abv 16.03.99: PRO17828 face 555: transform pcurves on SurfaceOfRevolution
7//szv#4 S4163
8//S4181 pdn implementing of writing IGES elementary surfaces.
9
10#include <BRepToIGES_BRWire.ixx>
11
12#include <BRep_Tool.hxx>
13#include <BRepTools.hxx>
14#include <BRepTools_WireExplorer.hxx>
15
16#include <gp.hxx>
17#include <gp_Ax2d.hxx>
18#include <gp_Dir2d.hxx>
19#include <gp_Pnt2d.hxx>
20#include <gp_Trsf.hxx>
21#include <gp_Trsf2d.hxx>
22
23#include <Geom_CartesianPoint.hxx>
24#include <Geom_ConicalSurface.hxx>
25#include <Geom_Curve.hxx>
26#include <Geom_CylindricalSurface.hxx>
27#include <Geom_Plane.hxx>
28#include <Geom_RectangularTrimmedSurface.hxx>
29#include <Geom_SphericalSurface.hxx>
30#include <Geom_SurfaceOfLinearExtrusion.hxx>
31#include <Geom_SurfaceOfRevolution.hxx>
32#include <Geom_ToroidalSurface.hxx>
33#include <Geom_TrimmedCurve.hxx>
34
35#include <Geom2d_Curve.hxx>
36#include <Geom2d_Line.hxx>
37
38#include <GeomToIGES_GeomPoint.hxx>
39#include <GeomToIGES_GeomCurve.hxx>
40
41#include <Geom2dToIGES_Geom2dCurve.hxx>
42
43#include <IGESData_HArray1OfIGESEntity.hxx>
44#include <IGESData_IGESEntity.hxx>
45#include <IGESData_IGESModel.hxx>
46
47#include <IGESGeom_CompositeCurve.hxx>
48#include <IGESGeom_Point.hxx>
49
50#include <Interface_Macros.hxx>
51
52#include <Precision.hxx>
53
54#include <TColStd_HSequenceOfTransient.hxx>
55
56#include <TopoDS.hxx>
57#include <TopoDS_Vertex.hxx>
58#include <TopoDS_Edge.hxx>
59#include <TopoDS_Wire.hxx>
60#include <TopoDS_Shape.hxx>
61
62#include <TopAbs_ShapeEnum.hxx>
63#include <TopAbs_Orientation.hxx>
64#include <TopExp.hxx>
65#include <TopExp_Explorer.hxx>
66#include <Interface_Static.hxx>
67#include <ShapeBuild_Edge.hxx>
68#include <Geom_OffsetSurface.hxx>
69#include <ShapeExtend_WireData.hxx>
70#include <ShapeFix_Wire.hxx>
71
72
73//=============================================================================
74// BRepToIGES_BRWire
75//=============================================================================
76
77BRepToIGES_BRWire::BRepToIGES_BRWire()
78{
79}
80
81
82//=============================================================================
83// BRepToIGES_BRWire
84//=============================================================================
85
86BRepToIGES_BRWire::BRepToIGES_BRWire
87(const BRepToIGES_BREntity& BR)
88: BRepToIGES_BREntity(BR)
89{
90}
91
92
93//=============================================================================
94// TransferWire
95//=============================================================================
96
97Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferWire
98(const TopoDS_Shape& start)
99{
100 Handle(IGESData_IGESEntity) res;
101
102 if (start.IsNull()) return res;
103
104 if (start.ShapeType() == TopAbs_VERTEX) {
105 TopoDS_Vertex V = TopoDS::Vertex(start);
106 res = TransferVertex(V);
107 }
108 else if (start.ShapeType() == TopAbs_EDGE) {
109 TopoDS_Edge E = TopoDS::Edge(start);
110 res = TransferEdge(E, Standard_False);
111 }
112 else if (start.ShapeType() == TopAbs_WIRE) {
113 TopoDS_Wire W = TopoDS::Wire(start);
114 res = TransferWire(W);
115 }
116 else {
117 // message d`erreur
118 }
119 return res;
120}
121
122
123//=============================================================================
124// TransferVertex
125//
126//=============================================================================
127
128Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferVertex
129(const TopoDS_Vertex& myvertex)
130{
131 Handle(IGESData_IGESEntity) res;
132 if ( myvertex.IsNull()) return res;
133
134 Handle(Geom_CartesianPoint) Point;
135 Point = new Geom_CartesianPoint(BRep_Tool::Pnt(myvertex));
136 Handle(IGESData_IGESEntity) IVertex;
137 if (!Point.IsNull()) {
138 GeomToIGES_GeomPoint GP;
139 GP.SetModel(GetModel());
140 IVertex = GP.TransferPoint(Point);
141 }
142
143 if (!IVertex.IsNull()) res = IVertex;
144 return res;
145}
146
147
148//=============================================================================
149// TransferVertex
150//
151//=============================================================================
152
153Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferVertex
154(const TopoDS_Vertex& myvertex,
155 const TopoDS_Edge& myedge,
156 Standard_Real& parameter)
157{
158 Handle(IGESData_IGESEntity) res;
159 if ( myvertex.IsNull()) return res;
160
161 Handle(IGESData_IGESEntity) IVertex = TransferVertex(myvertex);
162
163 // returns the parameter of myvertex on myedge
164 parameter = BRep_Tool::Parameter(myvertex,myedge);
165
166 if (!IVertex.IsNull()) res = IVertex;
167 return res;
168}
169
170
171//=============================================================================
172// TransferVertex
173//
174//=============================================================================
175
176Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferVertex
177(const TopoDS_Vertex& myvertex,
178 const TopoDS_Edge& myedge,
179 const TopoDS_Face& myface,
180 Standard_Real& parameter)
181{
182 Handle(IGESData_IGESEntity) res;
183 if ( myvertex.IsNull()) return res;
184
185 Handle(IGESData_IGESEntity) IVertex = TransferVertex(myvertex);
186
187 // returns the parameter of myvertex on the pcurve of myedge on myface
188 parameter = BRep_Tool::Parameter(myvertex, myedge, myface);
189
190 if (!IVertex.IsNull()) res = IVertex;
191 return res;
192}
193
194
195//=============================================================================
196// TransferVertex
197//
198//=============================================================================
199
200Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferVertex
201(const TopoDS_Vertex& myvertex,
202 const TopoDS_Edge& myedge,
203 const Handle(Geom_Surface)& mysurface,
204 const TopLoc_Location& myloc,
205 Standard_Real& parameter)
206{
207 Handle(IGESData_IGESEntity) res;
208 if ( myvertex.IsNull()) return res;
209
210 Handle(IGESData_IGESEntity) IVertex = TransferVertex(myvertex);
211
212 // returns the parameter of myvertex on the pcurve of myedge on mysurface
213 parameter = BRep_Tool::Parameter(myvertex, myedge, mysurface, myloc);
214
215 if (!IVertex.IsNull()) res = IVertex;
216 return res;
217}
218
219
220//=============================================================================
221// TransferVertex
222//
223//=============================================================================
224
225Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferVertex
226(const TopoDS_Vertex& myvertex,
227 const TopoDS_Face& myface,
228 gp_Pnt2d& mypoint)
229{
230 Handle(IGESData_IGESEntity) res;
231 if ( myvertex.IsNull()) return res;
232
233 Handle(IGESData_IGESEntity) IVertex = TransferVertex(myvertex);
234
235 // returns the parameter of myvertex on myface
236 mypoint = BRep_Tool::Parameters(myvertex, myface);
237
238 if (!IVertex.IsNull()) res = IVertex;
239 return res;
240}
241
242
243//=============================================================================
244// TransferEdge
245//=============================================================================
246
247Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferEdge
248(const TopoDS_Edge& myedge,
249 const Standard_Boolean isBRepMode)
250{
251 Handle(IGESData_IGESEntity) res;
252 if ( myedge.IsNull()) return res;
253
254 // returns the 3d curve of the edge and the parameter range
255 TopLoc_Location L;
256 Standard_Real First, Last, U1, U2;
257 Handle(IGESData_IGESEntity) ICurve;
258 Handle(Geom_Curve) Curve3d = BRep_Tool::Curve(myedge, L, First, Last);
259
260 //#28 rln 19.10.98 UKI60155, etc.
261 //Only Bezier will be converted into B-Spline, not Conic. This conertation
262 //will be done only inside GeomToIGES package for simplifying the code.
263
264 //#29 rln 19.10.98
265 //Unnecessary duplication of curves is removed.
266
267 if (!Curve3d.IsNull()) {
268 gp_Trsf Tr = L.Transformation();
269 if (Tr.Form() != gp_Identity)
270 Curve3d = Handle(Geom_Curve)::DownCast(Curve3d->Transformed (Tr));
271 else
272 Curve3d = Handle(Geom_Curve)::DownCast(Curve3d->Copy());
273
274 if (myedge.Orientation() == TopAbs_REVERSED && !isBRepMode) {
275 U1 = Curve3d->ReversedParameter(Last);
276 U2 = Curve3d->ReversedParameter(First);
277 Curve3d->Reverse();
278 }
279 else {
280 U1 = First;
281 U2 = Last;
282 }
283
284 GeomToIGES_GeomCurve GC;
285 GC.SetModel(GetModel());
286 ICurve = GC.TransferCurve(Curve3d, U1, U2);
287 }
288
289 //#31 rln 19.10.98
290 //Vertices are not translated into IGES anymore since they are not put into
291 //the model
292
293 if (!ICurve.IsNull()) res = ICurve;
294
295 SetShapeResult ( myedge, res );
296
297 return res;
298}
299
300
301//=============================================================================
302// TransferEdge
303//=============================================================================
304
305Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferEdge (const TopoDS_Edge& myedge,
306 const TopoDS_Face& myface,
307 const Standard_Real length,
308 const Standard_Boolean isBRepMode)
309{
310 Handle(IGESData_IGESEntity) res;
311 if ( myedge.IsNull() || GetPCurveMode() ==0 ||
312 ( ! isBRepMode && BRep_Tool::Degenerated ( myedge ) ) ) return res;
313
314 //S4181 pdn 23.04.99 adjusting length factor according to analytic mode.
315 Standard_Real myLen = length;
316 Standard_Boolean analyticMode = ( GetConvertSurfaceMode() ==0 && isBRepMode );
317
318 // returns the 2d curve associated to myedge in the parametric space of myface
319 Standard_Real First, Last;
320
321 Handle(Geom2d_Curve) Curve2d = BRep_Tool::CurveOnSurface
322 (myedge, myface, First, Last);
323 Handle(IGESData_IGESEntity) ICurve2d;
324 //#29 rln 19.10.98
325
326 if (!Curve2d.IsNull()) {
327 // Pour les surfaces "de revolution" et "LinearExtrusion", il faut
328 // appliquer une translation des courbes 2d pour etre en accord
329 // sur l`origine (U,V) entre IGES et BRep (pour Cylindrical,
330 // Conical et SurfaceOfLinearExtrusion)
331 // Il faut inverser (u,v) surfaces de revol.
332
333 TopLoc_Location L;
334 Handle(Geom_Surface) st = BRep_Tool::Surface(myface, L);
335 Standard_Real Ufirst, Ulast, Vfirst, Vlast;
336 BRepTools::UVBounds(myface, Ufirst, Ulast, Vfirst, Vlast);
337 Handle(Geom_Surface) Surf;
338
339 if (st->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
340 DeclareAndCast(Geom_RectangularTrimmedSurface, rectang, st);
341 Surf = rectang->BasisSurface();
342 }
343 else
344 Surf = st;
345
346 //:abv 19.06.02: writing (loopback) on file offseted_sphere.rle in BRep mode
347 if (st->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
348 DeclareAndCast(Geom_OffsetSurface, offset, Surf);
349 Surf = offset->BasisSurface();
350 }
351
352 //S4181 pdn 20.04.99 transformation of pcurves id defined by type of surface
353 // and analytic mode.
354 // skl 18.07.2005 for OCC9490 : in following if() commented
355 // condition for SurfaceOfLinearExtrusion
356 Standard_Boolean needShift = (!analyticMode&&
357 ((Surf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) ||
358 (Surf->IsKind(STANDARD_TYPE(Geom_ConicalSurface)))/* ||
359 (Surf->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)))*/));
360 //:q4 abv 16 Mar 99: PRO17828 face 555: shift pcurves on SurfaceOfRevolution
361 if (Surf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
362 Handle(Geom_SurfaceOfRevolution) rev =
363 Handle(Geom_SurfaceOfRevolution)::DownCast ( Surf );
364 Handle(Geom_Curve) curve = rev->BasisCurve();
365 // skl 31.05.2004 for OCC6004
366 if(curve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
367 Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(curve);
368 curve = tc->BasisCurve();
369 }
370 if ( curve->IsKind(STANDARD_TYPE(Geom_Line)) ) needShift = Standard_True;
371 }
372 if ( needShift ) {
373 gp_Trsf2d TR;
374 TR.SetTranslation(gp_Pnt2d(0.,0.),gp_Pnt2d(0.,-Vfirst));
375 Curve2d = Handle(Geom2d_Curve)::DownCast(Curve2d->Transformed(TR));
376 }
377 else Curve2d = Handle(Geom2d_Curve)::DownCast(Curve2d->Copy());
378
379 if (!analyticMode&&((Surf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) ||
380 (Surf->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) ||
381 (Surf->IsKind(STANDARD_TYPE(Geom_SphericalSurface))))) {
382 //#30 rln 19.10.98 transformation of pcurves for IGES Surface of Revolution
383 Curve2d->Mirror (gp_Ax2d (gp::Origin2d(), gp_Dir2d (1.,1.)));
384 Curve2d->Mirror (gp::OX2d());
385 Curve2d->Translate (gp_Vec2d (0, 2 * PI));
386 }
387
388 if(Surf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))||
389 (Surf->IsKind(STANDARD_TYPE(Geom_ToroidalSurface)))){
390 Curve2d->Mirror (gp_Ax2d (gp::Origin2d(), gp_Dir2d (1.,1.)));
391 Curve2d->Mirror (gp::OX2d());
392 Curve2d->Translate (gp_Vec2d (0, 2 * PI));
393 }
394
395 if (analyticMode&&(Surf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ||
396 Surf->IsKind(STANDARD_TYPE(Geom_ConicalSurface))))
397 myLen = PI/180.;
398
399 if (analyticMode&&(Surf->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) ||
400 Surf->IsKind(STANDARD_TYPE(Geom_ToroidalSurface)))) {
401 gp_Trsf2d trans;
402 trans.SetScale(gp_Pnt2d(0,0),180./PI);
403 Curve2d->Transform(trans);
404 First = Curve2d->TransformedParameter(First,trans);
405 Last = Curve2d->TransformedParameter(Last, trans);
406 }
407
408 if (analyticMode&&(Surf->IsKind(STANDARD_TYPE(Geom_ConicalSurface)))) {
409 Handle(Geom_ConicalSurface) con = Handle(Geom_ConicalSurface)::DownCast ( Surf );
410 if(con->SemiAngle() < 0) {
411 Standard_Real vApex = 2 * con->RefRadius() / Sin (con->SemiAngle());
412 Curve2d->Translate (gp_Vec2d (0, vApex));
413 }
414 }
415 //S4181 transfer functionality
416 gp_Trsf2d trans;
417 Standard_Real uFact = 1.;
418 if(isBRepMode && Surf->IsKind(STANDARD_TYPE(Geom_Plane))) {
419 trans.SetScale(gp_Pnt2d(0,0),1./GetUnit());
420 }
421 if(Surf->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) {
422 Standard_Real aDiv = myLen;
423 if(aDiv < gp::Resolution())
424 aDiv = 1.;
425 //emv: changed for bug OCC22126 17.12.2010
426 trans.SetScale(gp_Pnt2d(0,0), 1. / (Vlast - Vfirst));
427 //uFact = myLen;
428
429 //added by skl 18.07.2005 for OCC9490
430// trans.SetScale(gp_Pnt2d(0,0),1./Vlast);
431
432 Standard_Real du = 1.;
433 Handle(Geom_SurfaceOfLinearExtrusion) LE =
434 Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(Surf);
435 if(LE->BasisCurve()->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
436 Handle(Geom_TrimmedCurve) tc =
437 Handle(Geom_TrimmedCurve)::DownCast(LE->BasisCurve());
438 if(tc->BasisCurve()->IsKind(STANDARD_TYPE(Geom_Line))) {
439 Standard_Real us1,us2,vs1,vs2;
440 Surf->Bounds(us1,us2,vs1,vs2);
441 du = us2-us1;
442 }
443 }
444 //emv: changed for bug OCC22126 17.12.2010
445 uFact = (Vlast - Vfirst)/du;
446 //uFact = aDiv/du;
447 }
448 if (Surf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ||
449 Surf->IsKind(STANDARD_TYPE(Geom_ConicalSurface)) ||
450 Surf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) { //:q4
451 uFact = 1./myLen;
452 }
453
454 ShapeBuild_Edge sbe;
455 Curve2d = sbe.TransformPCurve(Curve2d,trans,uFact,First,Last);
456// (Curve2d, Surf, First, Last, myLen, isBRepMode);
457 // si l`edge est REVERSED, il faut "REVERSER" la courbe 2d.
458
459 // added by skl 18.07.2005 for OCC9490
460 if(Surf->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) {
461 //emv: changed for bug OCC22126 17.12.2010
462 gp_Trsf2d trans1;
463 trans1.SetTranslation(gp_Vec2d(0.,-Vfirst/(Vlast-Vfirst)));
464 Curve2d = sbe.TransformPCurve(Curve2d,trans1,1.,First,Last);
465 }
466
467 if (myedge.Orientation() == TopAbs_REVERSED) {
468 Standard_Real tmpFirst = Curve2d->ReversedParameter(Last),
469 tmpLast = Curve2d->ReversedParameter(First);
470 Curve2d->Reverse();
471 First = tmpFirst;
472 Last = tmpLast;
473 }
474 Geom2dToIGES_Geom2dCurve GC;
475 GC.SetModel(GetModel());
476 ICurve2d = GC.Transfer2dCurve(Curve2d, First, Last);
477 }
478
479 //#31 rln 19.10.98
480 //Vertices are not translated into IGES anymore since they are not put into
481 //the model
482
483 if (!ICurve2d.IsNull()) res = ICurve2d;
484
485 SetShapeResult ( myedge, res );
486
487 return res;
488}
489
490
491//=============================================================================
492// TransferWire
493//=============================================================================
494
495Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferWire
496(const TopoDS_Wire& mywire)
497{
498 Handle(IGESData_IGESEntity) res;
499 if ( mywire.IsNull()) return res;
500
501 //A composite curve is defined as an ordered list of entities
502 //consisting of a point, connect point and parametrised curve
503 //entities (excluding the CompositeCurve entity).
504
505 Handle(IGESData_IGESEntity) ent ;
506 Handle(TColStd_HSequenceOfTransient) Seq = new TColStd_HSequenceOfTransient();
507
508 TopExp_Explorer TE(mywire, TopAbs_VERTEX);
509 if ( TE.More()) {
510 BRepTools_WireExplorer WE;
511 for ( WE.Init(mywire); WE.More(); WE.Next()) {
512 TopoDS_Edge E = WE.Current();
513 if (E.IsNull()) {
514 AddWarning(mywire, "an Edge is a null entity");
515 }
516 else {
517 ent = TransferEdge(E, Standard_False);
518 if (!ent.IsNull()) Seq->Append(ent);
519 }
520 }
521 }
522 else
523 AddWarning(mywire, " no Vertex associated to the Wire");
524
525
526 Standard_Integer nbedges = Seq->Length();
527 Handle(IGESData_HArray1OfIGESEntity) Tab;
528 if ( nbedges == 1 ) {
529 res = ent;
530 }
531 else if ( nbedges >= 2) {
532 Tab = new IGESData_HArray1OfIGESEntity(1,nbedges);
533 for (Standard_Integer itab = 1; itab <= nbedges; itab++) {
534 Handle(IGESData_IGESEntity) item = GetCasted(IGESData_IGESEntity, Seq->Value(itab));
535 Tab->SetValue(itab,item);
536 }
537 Handle(IGESGeom_CompositeCurve) Comp = new IGESGeom_CompositeCurve;
538 Comp->Init(Tab);
539 res = Comp;
540 }
541
542 SetShapeResult ( mywire, res );
543
544 return res;
545}
546
547
548//=============================================================================
549// TransferWire
550//=============================================================================
551
552Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferWire
553(const TopoDS_Wire & mywire,
554 const TopoDS_Face & myface,
555 Handle(IGESData_IGESEntity)& mycurve2d,
556 const Standard_Real length)
557{
558 Handle(IGESData_IGESEntity) res;
559 if ( mywire.IsNull()) return res;
560
561 Handle(IGESData_IGESEntity) ent3d ;
562 Handle(IGESData_IGESEntity) ent2d ;
563 Handle(TColStd_HSequenceOfTransient) Seq3d = new TColStd_HSequenceOfTransient();
564 Handle(TColStd_HSequenceOfTransient) Seq2d = new TColStd_HSequenceOfTransient();
565
566
567 // on cree une 3d CompositeCurve et une 2d CompositeCurve
568 TopExp_Explorer TE(mywire, TopAbs_VERTEX);
569 if ( TE.More()) {
570 // PTV OCC908 workaround for KAS:dev version
571 /*
572 BRepTools_WireExplorer WE;
573 for ( WE.Init(mywire,myface); WE.More(); WE.Next()) {
574 TopoDS_Edge E = WE.Current();
575 if (E.IsNull()) {
576 AddWarning(mywire, "an Edge is a null entity");
577 }
578 else {
579 ent3d = TransferEdge(E, Standard_False);
580 if (!ent3d.IsNull()) Seq3d->Append(ent3d);
581 ent2d = TransferEdge(E, myface, length, Standard_False);
582 if (!ent2d.IsNull()) Seq2d->Append(ent2d);
583 }
584 }
585 */
586 Handle(ShapeFix_Wire) aSFW =
587 new ShapeFix_Wire( mywire, myface, Precision::Confusion() );
588 aSFW->FixReorder();
589 Handle(ShapeExtend_WireData) aSEWD = aSFW->WireData();
590 Standard_Integer nbE = aSEWD->NbEdges();
591 for (Standard_Integer windex = 1; windex <= nbE; windex++) {
592 TopoDS_Edge E = aSEWD->Edge( windex );
593 if (E.IsNull()) {
594 AddWarning(mywire, "an Edge is a null entity");
595 }
596 else {
597 ent3d = TransferEdge(E, Standard_False);
598 if (!ent3d.IsNull()) Seq3d->Append(ent3d);
599 ent2d = TransferEdge(E, myface, length, Standard_False);
600 if (!ent2d.IsNull()) Seq2d->Append(ent2d);
601 }
602 }
603 // OCC908 end of workaround
604 }
605 else
606 AddWarning(mywire, " no Vertex associated to the Wire");
607
608 // Composite Curve 3D
609 Standard_Integer nb3d = Seq3d->Length();
610 Handle(IGESData_HArray1OfIGESEntity) Tab3d;
611 if ( nb3d == 1 ) {
612 res = ent3d;
613 }
614 else if (nb3d >= 2) {
615 Tab3d = new IGESData_HArray1OfIGESEntity(1,nb3d);
616 //Standard_Integer tabval = nb3d; //szv#4:S4163:12Mar99 unused
617 for (Standard_Integer itab = 1; itab <= nb3d; itab++) {
618 Handle(IGESData_IGESEntity) item =
619 GetCasted(IGESData_IGESEntity, Seq3d->Value(itab));
620 Tab3d->SetValue(itab,item);
621 }
622 Handle(IGESGeom_CompositeCurve) Comp = new IGESGeom_CompositeCurve;
623 Comp->Init(Tab3d);
624 res = Comp;
625 }
626
627 // Composite Curve 2D
628 Standard_Integer nb2d = Seq2d->Length();
629 Handle(IGESData_HArray1OfIGESEntity) Tab2d;
630 if ( nb2d == 1 ) {
631 mycurve2d = ent2d;
632 }
633 else if (nb2d >= 2) {
634 Tab2d = new IGESData_HArray1OfIGESEntity(1,nb2d);
635 //Standard_Integer tabval = nb2d; //szv#4:S4163:12Mar99 unused
636 for ( Standard_Integer itab = 1; itab <= nb2d; itab++) {
637 Handle(IGESData_IGESEntity) item =
638 GetCasted(IGESData_IGESEntity, Seq2d->Value(itab));
639 Tab2d->SetValue(itab,item);
640 }
641 Handle(IGESGeom_CompositeCurve) Comp = new IGESGeom_CompositeCurve;
642 Comp->Init(Tab2d);
643 mycurve2d = Comp;
644 }
645
646 SetShapeResult ( mywire, res );
647
648 return res;
649}