1 // File: GeomToIGES_GeomSurface.cxx
3 // modif du 22/10/96 mjm
4 // ajout du champ TheLength
5 //:l6 abv 15.01.99: CTS22022: writing full tori
7 //S4181 pdn 20.04.99 implementing of writing IGES elementary surfaces.
8 //szv#10:PRO19566:05Oct99 workaround against weights array loss
10 #include <GeomToIGES_GeomSurface.ixx>
11 #include <GeomToIGES_GeomCurve.hxx>
12 #include <GeomToIGES_GeomPoint.hxx>
13 #include <GeomToIGES_GeomVector.hxx>
15 #include <Geom_BSplineSurface.hxx>
16 #include <Geom_BezierSurface.hxx>
17 #include <Geom_BoundedSurface.hxx>
18 #include <Geom_CartesianPoint.hxx>
19 #include <Geom_ConicalSurface.hxx>
20 #include <Geom_Circle.hxx>
21 #include <Geom_Curve.hxx>
22 #include <Geom_CylindricalSurface.hxx>
23 #include <Geom_Curve.hxx>
24 #include <Geom_Direction.hxx>
25 #include <Geom_Geometry.hxx>
26 #include <Geom_Line.hxx>
27 #include <Geom_OffsetSurface.hxx>
28 #include <Geom_Plane.hxx>
29 #include <Geom_Point.hxx>
30 #include <Geom_RectangularTrimmedSurface.hxx>
31 #include <Geom_SphericalSurface.hxx>
32 #include <Geom_Surface.hxx>
33 #include <Geom_SurfaceOfLinearExtrusion.hxx>
34 #include <Geom_SurfaceOfRevolution.hxx>
35 #include <Geom_SweptSurface.hxx>
36 #include <Geom_ToroidalSurface.hxx>
38 #include <GeomConvert.hxx>
40 #include <GeomLProp_SLProps.hxx>
42 #include <IGESConvGeom_GeomBuilder.hxx>
44 #include <IGESData_IGESEntity.hxx>
46 #include <IGESGeom_BoundedSurface.hxx>
47 #include <IGESGeom_BSplineSurface.hxx>
48 #include <IGESGeom_CircularArc.hxx>
49 #include <IGESGeom_CurveOnSurface.hxx>
50 #include <IGESGeom_Direction.hxx>
51 #include <IGESGeom_Line.hxx>
52 #include <IGESGeom_OffsetSurface.hxx>
53 #include <IGESGeom_Plane.hxx>
54 #include <IGESGeom_Point.hxx>
55 #include <IGESGeom_RuledSurface.hxx>
56 #include <IGESGeom_SurfaceOfRevolution.hxx>
57 #include <IGESGeom_TabulatedCylinder.hxx>
58 #include <IGESGeom_TransformationMatrix.hxx>
60 #include <IGESSolid_PlaneSurface.hxx>
61 #include <Interface_Macros.hxx>
63 #include <gce_MakeLin.hxx>
68 #include <gp_Cone.hxx>
69 #include <gp_Cylinder.hxx>
73 #include <gp_Sphere.hxx>
74 #include <gp_Torus.hxx>
75 #include <gp_Trsf.hxx>
79 #include <Precision.hxx>
81 #include <TColgp_HArray2OfXYZ.hxx>
82 #include <TColStd_HArray1OfReal.hxx>
83 #include <TColStd_HArray2OfReal.hxx>
84 #include <IGESSolid_CylindricalSurface.hxx>
85 #include <IGESSolid_ConicalSurface.hxx>
86 #include <IGESSolid_SphericalSurface.hxx>
87 #include <IGESSolid_ToroidalSurface.hxx>
88 #include <Geom_TrimmedCurve.hxx>
91 //=============================================================================
92 // GeomToIGES_GeomSurface
93 //=============================================================================
95 GeomToIGES_GeomSurface::GeomToIGES_GeomSurface()
96 :GeomToIGES_GeomEntity()
98 myBRepMode = Standard_False;
99 myAnalytic = Standard_False;
103 //=============================================================================
104 // GeomToIGES_GeomSurface
105 //=============================================================================
107 GeomToIGES_GeomSurface::GeomToIGES_GeomSurface(const GeomToIGES_GeomEntity& GE)
108 :GeomToIGES_GeomEntity(GE)
110 myBRepMode = Standard_False;
111 myAnalytic = Standard_False;
115 //=============================================================================
116 // Transfer des Entites Surface de Geom vers IGES
118 //=============================================================================
120 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_Surface)& start,
121 const Standard_Real Udeb,
122 const Standard_Real Ufin,
123 const Standard_Real Vdeb,
124 const Standard_Real Vfin)
126 Handle(IGESData_IGESEntity) res;
127 if (start.IsNull()) {
131 if (start->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) {
132 DeclareAndCast(Geom_BoundedSurface, Bounded, start);
133 res = TransferSurface(Bounded, Udeb, Ufin, Vdeb, Vfin);
135 else if (start->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) {
136 DeclareAndCast(Geom_ElementarySurface, Elementary, start);
137 res = TransferSurface(Elementary, Udeb, Ufin, Vdeb, Vfin);
139 else if ( start->IsKind(STANDARD_TYPE(Geom_SweptSurface))) {
140 DeclareAndCast(Geom_SweptSurface, Swept, start);
141 res = TransferSurface(Swept, Udeb, Ufin, Vdeb, Vfin);
143 else if ( start->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
144 DeclareAndCast(Geom_OffsetSurface, OffsetS, start);
145 res = TransferSurface(OffsetS, Udeb, Ufin, Vdeb, Vfin);
152 //=============================================================================
153 // Transfer des Entites BoundedSurface de Geom vers IGES
155 //=============================================================================
157 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_BoundedSurface)& start,
158 const Standard_Real Udeb,
159 const Standard_Real Ufin,
160 const Standard_Real Vdeb,
161 const Standard_Real Vfin)
163 Handle(IGESData_IGESEntity) res;
164 if (start.IsNull()) {
168 if (start->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) {
169 DeclareAndCast(Geom_BSplineSurface, BSpline, start);
170 res = TransferSurface(BSpline, Udeb, Ufin, Vdeb, Vfin);
172 else if (start->IsKind(STANDARD_TYPE(Geom_BezierSurface))) {
173 DeclareAndCast(Geom_BezierSurface, Bezier, start);
174 res = TransferSurface(Bezier, Udeb, Ufin, Vdeb, Vfin);
176 else if ( start->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
177 DeclareAndCast(Geom_RectangularTrimmedSurface, Trimmed, start);
178 res = TransferSurface(Trimmed,Udeb, Ufin, Vdeb, Vfin);
185 //=============================================================================
186 // Transfer des Entites BSplineSurface de Geom vers IGES
188 //=============================================================================
190 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_BSplineSurface)& start,
191 const Standard_Real Udeb,
192 const Standard_Real Ufin,
193 const Standard_Real Vdeb,
194 const Standard_Real Vfin)
196 // a b-spline surface is defined by :
197 // The U and V Degree (up to 25)
198 // The Poles (and the weights if it is rational)
199 // The U and V Knots and Multiplicities
201 // The knot vector is an increasing sequence of reals without repetition.
202 // The multiplicities are the repetition of the knots.
204 // If the knots are regularly spaced (the difference of two consecutive knots
206 // the knots repartition (in U or V) is :
207 // - Uniform if all multiplicities are 1.
208 // - Quasi-uniform if all multiplicities are 1
209 // but the first and the last which are Degree+1.
210 // - PiecewiseBezier if all multiplicites are
211 // Degree but the first and the last which are
214 // The surface may be periodic in U and in V.
215 // On a U periodic surface if there are k U knots
216 // and the poles table has p rows. the U period
217 // is uknot(k) - uknot(1)
219 // the poles and knots are infinite vectors with :
220 // uknot(i+k) = uknot(i) + period
221 // pole(i+p,j) = pole(i,j)
224 Handle(IGESData_IGESEntity) res;
226 if (start.IsNull()) {
230 Handle(IGESGeom_BSplineSurface) BSpline = new IGESGeom_BSplineSurface;
231 Handle(Geom_BSplineSurface) mysurface;
233 Standard_Boolean PeriodU = start->IsUPeriodic();
234 Standard_Boolean PeriodV = start->IsVPeriodic();
235 if (PeriodU || PeriodV) {
236 mysurface = Handle(Geom_BSplineSurface)::DownCast(start->Copy());
238 //szv#10:PRO19566:05Oct99
239 Standard_Boolean workaround = !(mysurface->IsURational() || mysurface->IsVRational());
240 if (workaround) mysurface->SetWeight(1,1,0.3);
242 if ( PeriodU ) mysurface->SetUNotPeriodic();
243 if ( PeriodV ) mysurface->SetVNotPeriodic();
245 //szv#10:PRO19566:05Oct99
246 if (workaround) mysurface->SetWeight(1,1,1.);
252 Standard_Integer DegU = mysurface->UDegree();
253 Standard_Integer DegV = mysurface->VDegree();
254 Standard_Boolean CloseU = mysurface->IsUClosed();
255 Standard_Boolean CloseV = mysurface->IsVClosed();
256 //Standard_Boolean PeriodU = start->IsUPeriodic();
257 //Standard_Boolean PeriodV = start->IsVPeriodic();
258 Standard_Boolean RationU = mysurface->IsURational();
259 Standard_Boolean RationV = mysurface->IsVRational();
260 Standard_Integer NbUPoles = mysurface->NbUPoles();
261 Standard_Integer NbVPoles = mysurface->NbVPoles();
262 Standard_Integer IndexU = NbUPoles -1;
263 Standard_Integer IndexV = NbVPoles -1;
264 Standard_Boolean Polynom = !(RationU || RationV); //szv#10:PRO19566:05Oct99 && was wrong
266 // filling knots array for U :
267 // Sequence des Knots de [-DegU, IndexU+1] dans IGESGeom.
268 Standard_Integer Knotindex;
269 Standard_Real rtampon;
270 Standard_Integer itampon;
271 TColStd_Array1OfReal KU(1, NbUPoles+ DegU+ 1);
272 mysurface->UKnotSequence(KU);
274 Handle(TColStd_HArray1OfReal) KnotsU =
275 new TColStd_HArray1OfReal(-DegU,IndexU+1 );
276 for ( Knotindex=KU.Lower(); Knotindex<=KU.Upper(); Knotindex++) {
277 rtampon = KU.Value(Knotindex);
278 KnotsU->SetValue(itampon, rtampon);
282 // filling knots array for V :
283 // Sequence des Knots de [-DegV, IndexV+1] dans IGESGeom.
284 TColStd_Array1OfReal KV(1, NbVPoles+ DegV+ 1);
285 mysurface->VKnotSequence(KV);
287 Handle(TColStd_HArray1OfReal) KnotsV =
288 new TColStd_HArray1OfReal(-DegV, IndexV+1);
289 for ( Knotindex=KV.Lower(); Knotindex<=KV.Upper(); Knotindex++) {
290 rtampon = KV.Value(Knotindex);
291 KnotsV->SetValue(itampon, rtampon);
295 // filling Weights array de [0, IndexU, 0, IndexV]
296 // ----------------------------------------------
297 Handle(TColStd_HArray2OfReal) Weights =
298 new TColStd_HArray2OfReal(0 , IndexU, 0, IndexV);
299 Standard_Integer WeightRow = Weights->LowerRow();
300 Standard_Integer WeightCol = Weights->LowerCol();
301 Standard_Integer iw, jw;
303 if(RationU || RationV) {
304 for ( iw = 1; iw<= IndexU+1; iw++) {
305 for ( jw = 1; jw<= IndexV+1; jw++)
306 Weights->SetValue(WeightRow, WeightCol++, mysurface->Weight(iw,jw));
308 WeightCol = Weights->LowerCol();
311 for ( iw = 1; iw<= IndexU+1; iw++) {
312 for ( jw = 1; jw<= IndexV+1; jw++)
313 Weights->SetValue(WeightRow, WeightCol++, 1.0);
315 WeightCol = Weights->LowerCol();
320 // filling Poles array de [0, IndexU, 0, IndexV]
321 // ---------------------------------------------
322 Handle(TColgp_HArray2OfXYZ) Poles =
323 new TColgp_HArray2OfXYZ(0, IndexU, 0, IndexV);
324 Standard_Integer UIndex = Poles->LowerRow();
325 Standard_Integer VIndex = Poles->LowerCol();
326 Standard_Integer ipole, jpole;
327 Standard_Real Xd, Yd, Zd;
329 for ( ipole = 1; ipole<= IndexU+1; ipole++) {
330 for ( jpole = 1; jpole<= IndexV+1; jpole++) {
331 gp_Pnt tempPnt = mysurface-> Pole(ipole, jpole);
332 tempPnt.Coord(Xd, Yd, Zd);
333 gp_XYZ PXYZ = gp_XYZ( Xd/GetUnit(), Yd/GetUnit(), Zd/GetUnit());
334 Poles->SetValue(UIndex, VIndex++, PXYZ);
337 VIndex = Poles->LowerCol();
340 // mjm le 9/10/97 mise en place d`une protection
341 Standard_Real U1,U2,V1,V2;
342 Standard_Real Umin = Udeb;
343 Standard_Real Umax = Ufin;
344 Standard_Real Vmin = Vdeb;
345 Standard_Real Vmax = Vfin;
346 mysurface->Bounds(U1,U2,V1,V2);
347 if ( U1 > Umin ) Umin = U1;
348 if ( V1 > Vmin ) Vmin = V1;
349 if ( U2 < Umax ) Umax = U2;
350 if ( V2 < Vmax ) Vmax = V2;
352 BSpline-> Init (IndexU, IndexV, DegU, DegV, CloseU, CloseV, Polynom, PeriodU,
353 PeriodV, KnotsU, KnotsV, Weights, Poles, Umin, Umax, Vmin, Vmax);
359 //=============================================================================
360 // Transfer des Entites BezierSurface de Geom vers IGES
362 //=============================================================================
364 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_BezierSurface)& start,
365 const Standard_Real /*Udeb*/,
366 const Standard_Real /*Ufin*/,
367 const Standard_Real /*Vdeb*/,
368 const Standard_Real /*Vfin*/)
370 Handle(IGESData_IGESEntity) res;
371 if (start.IsNull()) {
375 Handle(Geom_BSplineSurface) Bspline =
376 GeomConvert::SurfaceToBSplineSurface(start);
377 Standard_Real U1,U2,V1,V2;
378 Bspline->Bounds(U1,U2,V1,V2);
379 res = TransferSurface(Bspline, U1, U2, V1, V2);
384 //=============================================================================
385 // Transfer des Entites RectangularTrimmedSurface de Geom vers IGES
387 //=============================================================================
389 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_RectangularTrimmedSurface)& start,
390 const Standard_Real Udeb,
391 const Standard_Real Ufin,
392 const Standard_Real Vdeb,
393 const Standard_Real Vfin)
395 Handle(IGESData_IGESEntity) res;
396 if (start.IsNull()) {
400 Handle(Geom_Surface) st = start->BasisSurface();
401 if (st->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
402 //message d'erreur pas de trimmed a partir d'une trimmed ,
403 //on peut eventuellement ecrire la surface de base : st.
407 res = TransferSurface(st, Udeb, Ufin, Vdeb, Vfin);
413 //=============================================================================
414 // Transfer des Entites ElementarySurface de Geom vers IGES
416 //=============================================================================
418 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_ElementarySurface)& start,
419 const Standard_Real Udeb,
420 const Standard_Real Ufin,
421 const Standard_Real Vdeb,
422 const Standard_Real Vfin)
424 Handle(IGESData_IGESEntity) res;
425 // All these entities are located in 3D space with an axis
426 // placement (Location point, XAxis, YAxis, ZAxis). It is
427 // their local coordinate system.
429 //S4181 pdn 16.04.99 Hereunder, the implementation of translation of CAS.CADE
430 // elementary surfaces into different types of IGES surfaces according to boolean flags
431 if (start.IsNull()) {
434 if (start->IsKind(STANDARD_TYPE(Geom_Plane))) {
435 DeclareAndCast(Geom_Plane, Plane, start);
437 res = TransferPlaneSurface(Plane, Udeb, Ufin, Vdeb, Vfin);
439 res = TransferSurface(Plane, Udeb, Ufin, Vdeb, Vfin);
441 else if (start->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
442 DeclareAndCast(Geom_CylindricalSurface, Cylindrical, start);
443 if(myBRepMode&&myAnalytic)
444 res = TransferCylindricalSurface(Cylindrical, Udeb, Ufin, Vdeb, Vfin);
446 res = TransferSurface(Cylindrical, Udeb, Ufin, Vdeb, Vfin);
448 else if ( start->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) {
449 DeclareAndCast(Geom_ConicalSurface, Conical, start);
450 if(myBRepMode&&myAnalytic)
451 res = TransferConicalSurface(Conical, Udeb, Ufin, Vdeb, Vfin);
453 res = TransferSurface(Conical, Udeb, Ufin, Vdeb, Vfin);
455 else if (start->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
456 DeclareAndCast(Geom_SphericalSurface, Spherical, start);
457 if(myBRepMode&&myAnalytic)
458 res = TransferSphericalSurface(Spherical, Udeb, Ufin, Vdeb, Vfin);
460 res = TransferSurface(Spherical, Udeb, Ufin, Vdeb, Vfin);
462 else if ( start->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
463 DeclareAndCast(Geom_ToroidalSurface, Toroidal, start);
464 if(myBRepMode&&myAnalytic)
465 res = TransferToroidalSurface(Toroidal, Udeb, Ufin, Vdeb, Vfin);
467 res = TransferSurface(Toroidal, Udeb, Ufin, Vdeb, Vfin);
475 //=============================================================================
476 // Transfer des Entites Plane de Geom vers IGES
478 //=============================================================================
480 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_Plane)& start,
481 const Standard_Real Udeb,
482 const Standard_Real Ufin,
483 const Standard_Real Vdeb,
484 const Standard_Real Vfin)
486 // on va ecrire une BSplineSurface pour pouvoir etre coherent avec les courbes 2d
487 Handle(IGESData_IGESEntity) res;
489 if (start.IsNull()) {
493 Handle(IGESGeom_BSplineSurface) BSpline = new IGESGeom_BSplineSurface;
494 gp_Pnt P1 ,P2, P3, P4;
495 start->D0(Udeb, Vdeb, P1);
496 start->D0(Udeb, Vfin, P2);
497 start->D0(Ufin, Vdeb, P3);
498 start->D0(Ufin, Vfin, P4);
499 Handle(TColgp_HArray2OfXYZ) Poles = new TColgp_HArray2OfXYZ(0, 1, 0, 1);
502 Poles->SetValue (0, 0, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()));
504 Poles->SetValue (0, 1, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()));
506 Poles->SetValue (1, 0, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()));
508 Poles->SetValue (1, 1, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()));
510 Handle(TColStd_HArray1OfReal) KnotsU = new TColStd_HArray1OfReal(-1,2);
511 KnotsU->SetValue(-1, Udeb);
512 KnotsU->SetValue(0, Udeb);
513 KnotsU->SetValue(1, Ufin);
514 KnotsU->SetValue(2, Ufin);
516 Handle(TColStd_HArray1OfReal) KnotsV = new TColStd_HArray1OfReal(-1,2);
517 KnotsV->SetValue(-1, Vdeb);
518 KnotsV->SetValue(0, Vdeb);
519 KnotsV->SetValue(1, Vfin);
520 KnotsV->SetValue(2, Vfin);
522 Handle(TColStd_HArray2OfReal) Weights =
523 new TColStd_HArray2OfReal(0, 1, 0, 1, 1.);
526 BSpline-> Init ( 1, 1, 1, 1, Standard_False , Standard_False, Standard_True,
527 Standard_False, Standard_False,
528 KnotsU, KnotsV, Weights, Poles, Udeb, Ufin, Vdeb, Vfin);
535 //=============================================================================
536 // Transfer des Entites CylindricalSurface de Geom vers IGES
538 //=============================================================================
540 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
541 ( const Handle(Geom_CylindricalSurface)& start, const Standard_Real Udeb,
542 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
544 // The "ZAxis" is the symmetry axis of the CylindricalSurface,
545 // it gives the direction of increasing parametric value V.
546 // The parametrization range is :
547 // U [0, 2*PI], V ]- infinite, + infinite[
548 // The "XAxis" and the "YAxis" define the placement plane of the
549 // surface (Z = 0, and parametric value V = 0) perpendicular to
550 // the symmetry axis. The "XAxis" defines the origin of the
551 // parameter U = 0. The trigonometric sense gives the positive
552 // orientation for the parameter U.
554 Handle(IGESData_IGESEntity) res;
556 if (start.IsNull()) {
560 Handle(IGESGeom_SurfaceOfRevolution) Surf = new IGESGeom_SurfaceOfRevolution;
561 Standard_Real U1 = Udeb;
562 Standard_Real U2 = Ufin;
563 Standard_Real V1 = Vdeb;
564 Standard_Real V2 = Vfin;
565 if (Precision::IsNegativeInfinite(Vdeb)) V1 = -Precision::Infinite();
566 if (Precision::IsPositiveInfinite(Vfin)) V2 = Precision::Infinite();
568 // creation de la generatrice : Generatrix
569 Handle(Geom_Line) Ligne =
570 new Geom_Line (gp_Pnt(start->Cylinder().Radius(), 0.0, 0.0),
571 gp_Dir(0.0, 0.0, 1.0));
572 GeomToIGES_GeomCurve GC(*this);
573 Handle(IGESData_IGESEntity) Generatrix = GC.TransferCurve( Ligne, V1, V2);
574 gp_Pnt gen1 = Ligne->Value(V1);
575 gp_Pnt gen2 = Ligne->Value(V2);
576 TheLength = gen1.Distance(gen2);
579 // creation de l`axe : Axis .
580 Handle(IGESGeom_Line) Axis = new IGESGeom_Line;
581 //#30 rln 19.10.98 IGES axis = reversed CAS.CADE axis
582 //Axis->Init(gp_XYZ(0.0, 0.0, 0.0), gp_XYZ(0.0, 0.0, 1.0/GetUnit()));
583 //Surf->Init (Axis, Generatrix, U1, U2);
584 Axis->Init(gp_XYZ (0, 0, 1. / GetUnit()), gp_XYZ (0, 0, 0));
585 Surf->Init (Axis, Generatrix, 2 * M_PI - U2, 2 * M_PI - U1);
588 // creation de la Trsf (#124)
589 // il faut tenir compte de l`unite pour la matrice de transformation
590 // (partie translation).
591 IGESConvGeom_GeomBuilder Build;
592 Standard_Real xloc,yloc,zloc;
593 start->Cylinder().Location().Coord(xloc,yloc,zloc);
595 Loc.SetCoord(xloc, yloc, zloc);
596 gp_Ax3 Pos = start->Cylinder().Position();
597 Pos.SetLocation(Loc);
598 Build.SetPosition(Pos);
599 if (!Build.IsIdentity()){
600 Handle(IGESGeom_TransformationMatrix) TMat =
601 new IGESGeom_TransformationMatrix;
602 TMat = Build.MakeTransformation(GetUnit());
603 Surf->InitTransf(TMat);
611 //=============================================================================
612 // Transfer des Entites ConicalSurface de Geom vers IGES
614 //=============================================================================
616 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
617 ( const Handle(Geom_ConicalSurface)& start, const Standard_Real Udeb,
618 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
620 // The "ZAxis" is the symmetry axis of the ConicalSurface,
621 // it gives the direction of increasing parametric value V.
622 // The apex of the surface is on the negative side of this axis.
623 // The parametrization range is :
624 // U [0, 2*PI], V ]-infinite, + infinite[
625 // The "XAxis" and the "YAxis" define the placement plane of the
626 // surface (Z = 0, and parametric value V = 0) perpendicular to
627 // the symmetry axis. The "XAxis" defines the origin of the
628 // parameter U = 0. The trigonometric sense gives the positive
629 // orientation for the parameter U.
632 Handle(IGESData_IGESEntity) res;
634 if (start.IsNull()) {
637 Handle(IGESGeom_SurfaceOfRevolution) Surf = new IGESGeom_SurfaceOfRevolution;
638 Standard_Real U1 = Udeb;
639 Standard_Real U2 = Ufin;
640 Standard_Real V1 = Vdeb;
641 Standard_Real V2 = Vfin;
642 if (Precision::IsNegativeInfinite(Vdeb)) V1 = -Precision::Infinite();
643 if (Precision::IsPositiveInfinite(Vfin)) V2 = Precision::Infinite();
645 // creation de la generatrice : Generatrix
646 Handle(Geom_Line) Ligne =
647 new Geom_Line( gp_Pnt(start->Cone().RefRadius(), 0.0, 0.0),
648 gp_Dir(sin(start->Cone().SemiAngle()), 0.,
649 cos(start->Cone().SemiAngle())));
650 GeomToIGES_GeomCurve GC(*this);
651 Handle(IGESData_IGESEntity) Generatrix = GC.TransferCurve( Ligne, V1, V2);
652 gp_Pnt gen1 = Ligne->Value(V1);
653 gp_Pnt gen2 = Ligne->Value(V2);
654 // TheLength = gen1.Distance(gen2)*Cos(start->Cone().SemiAngle());
655 TheLength = gen1.Distance(gen2);
657 // creation de l`axe : Axis .
658 Handle(IGESGeom_Line) Axis = new IGESGeom_Line;
659 //#30 rln 19.10.98 IGES axis = reversed CAS.CADE axis
660 //Axis->Init(gp_XYZ(0.0, 0.0, 0.0), gp_XYZ(0.0, 0.0, 1.0/GetUnit()));
661 //Surf->Init (Axis, Generatrix, U1, U2);
662 Axis->Init(gp_XYZ (0, 0, 1. / GetUnit()), gp_XYZ (0, 0, 0));
663 Surf->Init (Axis, Generatrix, 2 * M_PI - U2, 2 * M_PI - U1);
666 // creation de la Trsf (#124)
667 // il faut tenir compte de l`unite pour la matrice de transformation
668 // (partie translation).
669 IGESConvGeom_GeomBuilder Build;
670 Standard_Real xloc,yloc,zloc;
671 start->Cone().Location().Coord(xloc,yloc,zloc);
673 Loc.SetCoord(xloc, yloc, zloc);
674 gp_Ax3 Pos = start->Cone().Position();
675 Pos.SetLocation(Loc);
676 Build.SetPosition(Pos);
677 if (!Build.IsIdentity()){
678 Handle(IGESGeom_TransformationMatrix) TMat =
679 new IGESGeom_TransformationMatrix;
680 TMat = Build.MakeTransformation(GetUnit());
681 Surf->InitTransf(TMat);
689 //=============================================================================
690 // Transfer des Entites SphericalSurface de Geom vers IGES
692 //=============================================================================
694 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
695 ( const Handle(Geom_SphericalSurface)& start, const Standard_Real Udeb,
696 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
698 // The center of the sphere is the "Location" point of the local
699 // coordinate system.
700 // The V isoparametric curves of the surface are defined by
701 // the section of the spherical surface with plane parallel to the
702 // plane (Location, XAxis, YAxis). This plane defines the origin of
703 // parametrization V.
704 // The U isoparametric curves of the surface are defined by the
705 // section of the spherical surface with plane obtained by rotation
706 // of the plane (Location, XAxis, ZAxis) around ZAxis. This plane
707 // defines the origin of parametrization u.
708 // The parametrization range is U [0, 2*PI], V [- PI/2, + PI/2]
710 Handle(IGESData_IGESEntity) res;
712 if (start.IsNull()) {
716 Handle(IGESGeom_SurfaceOfRevolution) Surf = new IGESGeom_SurfaceOfRevolution;
718 Standard_Real U1 = Udeb;
719 Standard_Real U2 = Ufin;
720 Standard_Real V1 = Vdeb;
721 Standard_Real V2 = Vfin;
723 // creation de la generatrice : Generatrix (1/2 cercle)
724 gp_Ax2 Axe(gp::Origin(), -gp::DY(), gp::DX());
725 Handle(Geom_Circle) Cercle =
726 new Geom_Circle(Axe, start->Sphere().Radius());
727 GeomToIGES_GeomCurve GC(*this);
728 Handle(IGESData_IGESEntity) Gen = GC.TransferCurve( Cercle, V1, V2);
730 // creation de l`axe : Axis .
731 Handle(IGESGeom_Line) Axis = new IGESGeom_Line;
732 //#30 rln 19.10.98 IGES axis = reversed CAS.CADE axis
733 //Axis->Init(gp_XYZ(0.0, 0.0, 0.0), gp_XYZ(0.0, 0.0, 1.0/GetUnit()));
734 Axis->Init(gp_XYZ (0, 0, 1. / GetUnit()), gp_XYZ (0, 0, 0));
736 if ( Gen->IsKind(STANDARD_TYPE(IGESGeom_CircularArc))) {
737 //#30 rln 19.10.98 Surf->Init (Axis, Gen, U1, U2);
738 Surf->Init (Axis, Gen, 2 * M_PI - U2, 2 * M_PI - U1);
739 IGESConvGeom_GeomBuilder Build;
740 Standard_Real xloc,yloc,zloc;
741 start->Sphere().Location().Coord(xloc,yloc,zloc);
743 Loc.SetCoord(xloc, yloc, zloc);
744 gp_Ax3 Pos = start->Sphere().Position();
745 Pos.SetLocation(Loc);
746 Build.SetPosition(Pos);
747 if (!Build.IsIdentity()){
748 Handle(IGESGeom_TransformationMatrix) TMat =
749 new IGESGeom_TransformationMatrix;
750 TMat = Build.MakeTransformation(GetUnit());
751 Surf->InitTransf(TMat);
759 //=============================================================================
760 // Transfer des Entites ToroidalSurface de Geom vers IGES
762 //=============================================================================
764 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
765 ( const Handle(Geom_ToroidalSurface)& start, const Standard_Real Udeb,
766 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
768 // The "Location point" of the axis placement is the center
770 // The plane (Location, XAxis, ZAxis) defines the origin of the
771 // parametrization U. The plane (Location, XAxis, YAxis)
772 // defines the origin of the parametrization V.
773 // The parametrization range is U [0, 2*PI], V [0, 2*PI]
776 Handle(IGESData_IGESEntity) res;
778 if (start.IsNull()) {
782 Handle(IGESGeom_SurfaceOfRevolution) Surf = new IGESGeom_SurfaceOfRevolution;
783 Standard_Real U1 = Udeb;
784 Standard_Real U2 = Ufin;
785 Standard_Real V1 = Vdeb;
786 Standard_Real V2 = Vfin;
788 // debug mjm du 28/03/96
790 Standard_Boolean IsDirect =
792 start->Torus().Direct();
794 // creation de la generatrice : Generatrix (cercle)
795 gp_Ax2 Axe = gp_Ax2(gp_Pnt((start->Torus().MajorRadius()), 0., 0.),
796 -gp::DY(), gp::DX());
797 Handle(Geom_Circle) Cercle =
798 new Geom_Circle(Axe, start->Torus().MinorRadius());
799 GeomToIGES_GeomCurve GC(*this);
800 Handle(IGESData_IGESEntity) Gen = GC.TransferCurve( Cercle, V1, V2);
802 // creation de l`axe : Axis .
803 Handle(IGESGeom_Line) Axis = new IGESGeom_Line;
804 //#30 rln 19.10.98 IGES axis = reversed CAS.CADE axis
805 //Axis->Init(gp_XYZ(0.0, 0.0, 0.0), gp_XYZ(0.0, 0.0, 1.0/GetUnit()));
806 Axis->Init(gp_XYZ (0, 0, 1. / GetUnit()), gp_XYZ (0, 0, 0));
808 //:l6 abv: CTS22022: writing full tori: if ( Gen->IsKind(STANDARD_TYPE(IGESGeom_CircularArc))) {
809 //#30 rln 19.10.98 Surf->Init (Axis, Gen, U1, U2);
810 Surf->Init (Axis, Gen, 2 * M_PI - U2, 2 * M_PI - U1);
811 IGESConvGeom_GeomBuilder Build;
813 Standard_Real xloc,yloc,zloc;
814 start->Torus().Location().Coord(xloc,yloc,zloc);
816 Loc.SetCoord(xloc, yloc, zloc);
818 gp_Ax3 Pos = start->Torus().Position();
819 //:l6 Pos.SetLocation(Loc);
820 Build.SetPosition(Pos);
821 if (!Build.IsIdentity()){
822 Handle(IGESGeom_TransformationMatrix) TMat =
823 new IGESGeom_TransformationMatrix;
824 TMat = Build.MakeTransformation(GetUnit());
825 Surf->InitTransf(TMat);
833 //=============================================================================
834 // Transfer des Entites SweptSurface de Geom vers IGES
836 //=============================================================================
838 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
839 ( const Handle(Geom_SweptSurface)& start, const Standard_Real Udeb,
840 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
842 Handle(IGESData_IGESEntity) res;
843 if (start.IsNull()) {
847 if (start->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) {
848 DeclareAndCast(Geom_SurfaceOfLinearExtrusion, Extrusion, start);
849 res = TransferSurface(Extrusion, Udeb, Ufin, Vdeb, Vfin);
851 else if (start->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
852 DeclareAndCast(Geom_SurfaceOfRevolution, Revolution, start);
853 res = TransferSurface(Revolution, Udeb, Ufin, Vdeb, Vfin);
860 //=============================================================================
861 // Transfer des Entites SurfaceOfLinearExtrusion de Geom vers IGES
863 //=============================================================================
865 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
866 ( const Handle(Geom_SurfaceOfLinearExtrusion)& start, const Standard_Real Udeb,
867 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
869 // This surface is obtained by sweeping a curve in a given direction.
870 // The parametrization range for the parameter U is defined with the
872 // The parametrization range for the parameter V is
873 // ]-infinite, + infinite[
874 // The position of the curve gives the origin for the parameter V.
877 Handle(IGESData_IGESEntity) res;
879 if (start.IsNull()) {
883 Handle(IGESGeom_TabulatedCylinder) Surf = new IGESGeom_TabulatedCylinder;
884 Standard_Real U1 = Udeb;
885 Standard_Real U2 = Ufin;
886 Standard_Real V1 = Vdeb;
887 Standard_Real V2 = Vfin;
888 if (Precision::IsNegativeInfinite(Vdeb)) V1 = -Precision::Infinite();
889 if (Precision::IsPositiveInfinite(Vfin)) V2 = Precision::Infinite();
891 // added by skl 18.07.2005 for OCC9490
892 Standard_Real UF,UL,VF,VL;
893 start->Bounds(UF,UL,VF,VL);
897 Handle(Geom_Curve) TheCurve = start->BasisCurve();
899 //dans IGES l'origine de la generatrice est identique a l'origine
900 //de la directrice , il faut translater la courbe si les deux
901 //points ne sont pas confondus dans Geom et donc la copier !!!!!!!
902 gp_Pnt TheEnd = start->Value(U1,V2);
903 Standard_Real Xe, Ye, Ze;
904 TheEnd.Coord(Xe, Ye, Ze);
905 gp_XYZ End = gp_XYZ (Xe/GetUnit(), Ye/GetUnit(), Ze/GetUnit());
907 GeomToIGES_GeomCurve GC(*this);
908 // commented by skl 18.07.2005 for OCC9490
909 Handle(Geom_Curve) CopyCurve;
910 if ( Abs(V1) > Precision::Confusion()) {
911 CopyCurve = Handle(Geom_Curve)::DownCast
912 (TheCurve->Translated (start->Value(U1,0.), start->Value(U1,V1)));
915 CopyCurve = TheCurve;
917 //Handle(IGESData_IGESEntity) Directrix = GC.TransferCurve( CopyCurve, V1, V2);
918 Handle(IGESData_IGESEntity) Directrix = GC.TransferCurve( CopyCurve, U1, U2);
919 //Handle(IGESData_IGESEntity) Directrix = GC.TransferCurve( TheCurve, U1, U2);
920 //gp_Pnt gen1 = start->Value(U1,V1);
921 //TheLength = gen1.Distance(TheEnd);
923 Surf->Init (Directrix, End);
929 //=============================================================================
930 // Transfer des Entites SurfaceOfRevolution de Geom vers IGES
932 //=============================================================================
934 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
935 ( const Handle(Geom_SurfaceOfRevolution)& start, const Standard_Real Udeb,
936 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
938 // The surface is obtained by rotating a curve a complete revolution
939 // about an axis. The curve and the axis must be in the same plane.
940 // For a complete surface of revolution the parametric range is
942 // The parametric range for V is defined with the revolved curve.
943 // The origin of the U parametrization is given by the position
944 // of the revolved curve (reference). The direction of the revolution
945 // axis defines the positive sense of rotation (trigonometric sense)
946 // corresponding to the increasing of the parametric value U.
947 // The derivatives are always defined for the u direction.
948 // For the v direction the definition of the derivatives depends on
949 // the degree of continuity of the referenced curve.
951 Handle(IGESData_IGESEntity) res;
953 if (start.IsNull()) {
957 Handle(IGESGeom_SurfaceOfRevolution) Surf = new IGESGeom_SurfaceOfRevolution;
958 Standard_Real U1 = Udeb;
959 Standard_Real U2 = Ufin;
960 Standard_Real V1 = Vdeb;
961 Standard_Real V2 = Vfin;
962 if (Precision::IsNegativeInfinite(Vdeb)) V1 = -Precision::Infinite();
963 if (Precision::IsPositiveInfinite(Vfin)) V2 = Precision::Infinite();
965 // creation de la generatrice : Generatrix
966 Handle(Geom_Curve) Curve = start->BasisCurve();
967 GeomToIGES_GeomCurve GC(*this);
968 Handle(IGESData_IGESEntity) Generatrix = GC.TransferCurve( Curve, V1, V2);
969 //pdn BUC184: decoding a trimmed curve
970 while( Curve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
971 Handle(Geom_TrimmedCurve) aTrCurve = Handle(Geom_TrimmedCurve)::
973 Curve = aTrCurve->BasisCurve();
976 if ( Curve->IsKind(STANDARD_TYPE(Geom_Line))) {
977 DeclareAndCast(Geom_Line, Line, Curve);
978 gp_Pnt gen1 = Line->Value(V1);
979 gp_Pnt gen2 = Line->Value(V2);
980 TheLength = gen1.Distance(gen2);
983 // creation de l`axe : Axis .
984 Handle(IGESGeom_Line) Axis = new IGESGeom_Line;
985 gp_Ax1 Axe = start->Axis();
986 Standard_Real X1,Y1,Z1,X2,Y2,Z2;
987 Axe.Location().Coord(X1,Y1,Z1);
988 Axe.Direction().Coord(X2,Y2,Z2);
990 //#30 rln 19.10.98 IGES axis = reversed CAS.CADE axis
991 //Axis->Init(gp_XYZ(X1/GetUnit(),Y1/GetUnit(),Z1/GetUnit()),
992 // gp_XYZ(X2/GetUnit(),Y2/GetUnit(),Z2/GetUnit()));
993 //#36 rln 27.10.98 BUC60328 face 7
994 Axis->Init(gp_XYZ(X1/GetUnit(),Y1/GetUnit(),Z1/GetUnit()),
995 gp_XYZ( (X1 - X2) / GetUnit(), (Y1 - Y2) / GetUnit(), (Z1 - Z2) / GetUnit()));
997 Surf->Init (Axis, Generatrix, 2 * M_PI - U2, 2 * M_PI - U1);
1004 //=============================================================================
1005 // Transfer des Entites OffsetSurface de Geom vers IGES
1007 //=============================================================================
1009 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
1010 ( const Handle(Geom_OffsetSurface)& start, const Standard_Real Udeb, const Standard_Real
1011 Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
1013 // An offset surface is a surface at constant distance
1014 // (Offset) from a basis surface. The distance may be positive
1015 // or negative to the preferred side of the surface.
1016 // The positive side is defined by the cross product D1u ^ D1v
1017 // where D1u and D1v are the tangent vectors of the basis
1018 // surface in the U and V parametric directions. The previous
1019 // cross product defines the normal direction to the basis
1022 Handle(IGESData_IGESEntity) res;
1023 if (start.IsNull()) {
1027 Handle(IGESGeom_OffsetSurface) Surf = new IGESGeom_OffsetSurface;
1028 Handle(Geom_Surface) TheSurf = start->BasisSurface();
1029 Standard_Real U1, U2, V1, V2 , Um, Vm;
1030 start->Bounds (U1, U2, V1, V2);
1031 Um = (U1 + U2 ) /2.;
1032 Vm = (V1 + V2 ) /2.;
1033 Handle(IGESData_IGESEntity) Surface = TransferSurface
1034 (TheSurf, Udeb, Ufin, Vdeb, Vfin);
1035 Standard_Real Distance = start->Offset()/GetUnit();
1036 GeomLProp_SLProps Prop = GeomLProp_SLProps
1037 (TheSurf, Um, Vm, 1, Precision::Confusion());
1038 gp_Dir Dir = Prop.Normal();
1039 Standard_Real Xd, Yd, Zd;
1040 Dir.Coord(Xd, Yd, Zd);
1041 gp_XYZ Indicator = gp_XYZ(Xd/GetUnit(), Yd/GetUnit(), Zd/GetUnit());
1043 Surf-> Init (Indicator, Distance, Surface);
1050 //=============================================================================
1051 // Transfer des Entites Plane de Geom vers IGESSolid
1052 // TransferPlaneSurface
1053 //=============================================================================
1055 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferPlaneSurface(const Handle(Geom_Plane)& start,
1056 const Standard_Real /*Udeb*/,
1057 const Standard_Real /*Ufin*/,
1058 const Standard_Real /*Vdeb*/,
1059 const Standard_Real /*Vfin*/)
1061 // The parametrization range is U, V ]- infinite, + infinite[
1062 // The local coordinate system of the plane is defined with
1063 // an axis placement two axis.
1065 Handle(IGESData_IGESEntity) res;
1067 if (start.IsNull()) {
1071 Handle(IGESSolid_PlaneSurface) Plsurf = new IGESSolid_PlaneSurface;
1072 GeomToIGES_GeomPoint GP(*this);
1073 GeomToIGES_GeomVector GV(*this);
1075 gp_Pln Pln = start->Pln();
1077 Handle(Geom_CartesianPoint) mypoint = new Geom_CartesianPoint(Pln.Location());
1078 Handle(IGESGeom_Point) aLocation = GP.TransferPoint(mypoint);
1080 gp_Ax1 Axe = Pln.Axis();
1081 Handle(Geom_Direction) mydir = new Geom_Direction(Axe.Direction());
1082 Handle(IGESGeom_Direction) aNormal = GV.TransferVector(mydir);
1084 gp_Ax1 XAxe = Pln.XAxis();
1085 Handle(Geom_Direction) rdir = new Geom_Direction(XAxe.Direction());
1086 Handle(IGESGeom_Direction) refdir = GV.TransferVector(rdir);
1088 Plsurf->Init (aLocation, aNormal, refdir);
1094 //=======================================================================
1095 //function : TransferCylindricaSurface
1097 //=======================================================================
1099 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferCylindricalSurface(const Handle(Geom_CylindricalSurface)& start,
1100 const Standard_Real /*Udeb*/,
1101 const Standard_Real /*Ufin*/,
1102 const Standard_Real /*Vdeb*/,
1103 const Standard_Real /*Vfin*/)
1106 Handle(IGESData_IGESEntity) res;
1108 if (start.IsNull()) {
1112 Handle(IGESSolid_CylindricalSurface) CylSurf = new IGESSolid_CylindricalSurface;
1113 GeomToIGES_GeomPoint GP(*this);
1114 GeomToIGES_GeomVector GV(*this);
1116 gp_Cylinder Cyl = start->Cylinder();
1118 Handle(Geom_CartesianPoint) mypoint = new Geom_CartesianPoint(Cyl.Location());
1119 Handle(IGESGeom_Point) aLocation = GP.TransferPoint(mypoint);
1121 gp_Ax1 Axe = Cyl.Axis();
1122 Handle(Geom_Direction) mydir = new Geom_Direction(Axe.Direction());
1123 Handle(IGESGeom_Direction) Axis = GV.TransferVector(mydir);
1125 gp_Ax1 XAxe = Cyl.XAxis();
1126 Handle(Geom_Direction) rdir = new Geom_Direction(XAxe.Direction());
1127 Handle(IGESGeom_Direction) refdir = GV.TransferVector(rdir);
1129 Standard_Real radius = Cyl.Radius();
1131 CylSurf->Init (aLocation, Axis, radius, refdir);
1137 //=======================================================================
1138 //function : TransferConicalSurface
1140 //=======================================================================
1142 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferConicalSurface(const Handle(Geom_ConicalSurface)& start,
1143 const Standard_Real /*Udeb*/,
1144 const Standard_Real /*Ufin*/,
1145 const Standard_Real /*Vdeb*/,
1146 const Standard_Real /*Vfin*/)
1149 Handle(IGESData_IGESEntity) res;
1151 if (start.IsNull()) {
1155 Handle(IGESSolid_ConicalSurface) ConSurf = new IGESSolid_ConicalSurface;
1156 GeomToIGES_GeomPoint GP(*this);
1157 GeomToIGES_GeomVector GV(*this);
1159 gp_Cone Con = start->Cone();
1160 Standard_Real radius = Con.RefRadius();
1161 Standard_Real angle = Con.SemiAngle();
1162 gp_Ax1 Axe = Con.Axis();
1163 gp_Ax1 XAxe = Con.XAxis();
1164 gp_Dir XDir = XAxe.Direction();
1166 Handle(Geom_CartesianPoint) mypoint = new Geom_CartesianPoint(Con.Location());
1168 gp_Pnt pnt = mypoint->Pnt();
1169 mypoint->SetPnt(Con.Apex().XYZ()*2-pnt.XYZ());
1173 Handle(IGESGeom_Point) aLocation = GP.TransferPoint(mypoint);
1175 Handle(Geom_Direction) mydir = new Geom_Direction(Axe.Direction());
1176 Handle(IGESGeom_Direction) Axis = GV.TransferVector(mydir);
1178 Handle(Geom_Direction) rdir = new Geom_Direction(XDir);//XAxe.Direction());
1179 Handle(IGESGeom_Direction) refdir = GV.TransferVector(rdir);
1181 ConSurf->Init (aLocation, Axis, radius, angle*180./M_PI, refdir);
1187 //=======================================================================
1188 //function : TransferSphericalSurface
1190 //=======================================================================
1192 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSphericalSurface(const Handle(Geom_SphericalSurface)& start,
1193 const Standard_Real /*Udeb*/,
1194 const Standard_Real /*Ufin*/,
1195 const Standard_Real /*Vdeb*/,
1196 const Standard_Real /*Vfin*/)
1199 Handle(IGESData_IGESEntity) res;
1201 if (start.IsNull()) {
1205 Handle(IGESSolid_SphericalSurface) SphSurf = new IGESSolid_SphericalSurface;
1206 GeomToIGES_GeomPoint GP(*this);
1207 GeomToIGES_GeomVector GV(*this);
1209 gp_Sphere Sph = start->Sphere();
1211 Handle(Geom_CartesianPoint) mypoint = new Geom_CartesianPoint(Sph.Location());
1212 Handle(IGESGeom_Point) aLocation = GP.TransferPoint(mypoint);
1214 gp_Ax1 Axe = Sph.Position().Axis();
1215 Handle(Geom_Direction) mydir = new Geom_Direction(Axe.Direction());
1216 Handle(IGESGeom_Direction) Axis = GV.TransferVector(mydir);
1218 gp_Ax1 XAxe = Sph.XAxis();
1219 Handle(Geom_Direction) rdir = new Geom_Direction(XAxe.Direction());
1220 Handle(IGESGeom_Direction) refdir = GV.TransferVector(rdir);
1222 Standard_Real radius = Sph.Radius();
1224 SphSurf->Init (aLocation, radius, Axis, refdir);
1229 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferToroidalSurface(const Handle(Geom_ToroidalSurface)& start,
1230 const Standard_Real /*Udeb*/,
1231 const Standard_Real /*Ufin*/,
1232 const Standard_Real /*Vdeb*/,
1233 const Standard_Real /*Vfin*/)
1236 Handle(IGESData_IGESEntity) res;
1238 if (start.IsNull()) {
1242 Handle(IGESSolid_ToroidalSurface) TorSurf = new IGESSolid_ToroidalSurface;
1243 GeomToIGES_GeomPoint GP(*this);
1244 GeomToIGES_GeomVector GV(*this);
1246 gp_Torus Tor = start->Torus();
1248 Handle(Geom_CartesianPoint) mypoint = new Geom_CartesianPoint(Tor.Location());
1249 Handle(IGESGeom_Point) aLocation = GP.TransferPoint(mypoint);
1251 gp_Ax1 Axe = Tor.Axis();
1252 Handle(Geom_Direction) mydir = new Geom_Direction(Axe.Direction());
1253 Handle(IGESGeom_Direction) Axis = GV.TransferVector(mydir);
1255 gp_Ax1 XAxe = Tor.XAxis();
1256 Handle(Geom_Direction) rdir = new Geom_Direction(XAxe.Direction());
1257 Handle(IGESGeom_Direction) refdir = GV.TransferVector(rdir);
1259 Standard_Real major = Tor.MajorRadius();
1260 Standard_Real minor = Tor.MinorRadius();
1262 TorSurf->Init (aLocation, Axis, major, minor, refdir);
1268 //=======================================================================
1271 //=======================================================================
1272 Standard_Real GeomToIGES_GeomSurface::Length() const
1273 { return TheLength; }
1275 //=======================================================================
1276 //function : GetBRepMode
1278 //=======================================================================
1280 Standard_Boolean GeomToIGES_GeomSurface::GetBRepMode() const
1285 //=======================================================================
1286 //function : SetBRepMode
1288 //=======================================================================
1290 void GeomToIGES_GeomSurface::SetBRepMode(const Standard_Boolean flag)
1295 //=======================================================================
1296 //function : GetAnalyticMode
1298 //=======================================================================
1300 Standard_Boolean GeomToIGES_GeomSurface::GetAnalyticMode() const
1305 void GeomToIGES_GeomSurface::SetAnalyticMode(const Standard_Boolean flag)