1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 // modif du 22/10/96 mjm
15 // ajout du champ TheLength
16 //:l6 abv 15.01.99: CTS22022: writing full tori
18 //S4181 pdn 20.04.99 implementing of writing IGES elementary surfaces.
19 //szv#10:PRO19566:05Oct99 workaround against weights array loss
21 #include <GeomToIGES_GeomSurface.ixx>
22 #include <GeomToIGES_GeomCurve.hxx>
23 #include <GeomToIGES_GeomPoint.hxx>
24 #include <GeomToIGES_GeomVector.hxx>
26 #include <Geom_BSplineSurface.hxx>
27 #include <Geom_BezierSurface.hxx>
28 #include <Geom_BoundedSurface.hxx>
29 #include <Geom_CartesianPoint.hxx>
30 #include <Geom_ConicalSurface.hxx>
31 #include <Geom_Circle.hxx>
32 #include <Geom_Curve.hxx>
33 #include <Geom_CylindricalSurface.hxx>
34 #include <Geom_Curve.hxx>
35 #include <Geom_Direction.hxx>
36 #include <Geom_Geometry.hxx>
37 #include <Geom_Line.hxx>
38 #include <Geom_OffsetSurface.hxx>
39 #include <Geom_Plane.hxx>
40 #include <Geom_Point.hxx>
41 #include <Geom_RectangularTrimmedSurface.hxx>
42 #include <Geom_SphericalSurface.hxx>
43 #include <Geom_Surface.hxx>
44 #include <Geom_SurfaceOfLinearExtrusion.hxx>
45 #include <Geom_SurfaceOfRevolution.hxx>
46 #include <Geom_SweptSurface.hxx>
47 #include <Geom_ToroidalSurface.hxx>
49 #include <GeomConvert.hxx>
51 #include <GeomLProp_SLProps.hxx>
53 #include <IGESConvGeom_GeomBuilder.hxx>
55 #include <IGESData_IGESEntity.hxx>
57 #include <IGESGeom_BoundedSurface.hxx>
58 #include <IGESGeom_BSplineSurface.hxx>
59 #include <IGESGeom_CircularArc.hxx>
60 #include <IGESGeom_CurveOnSurface.hxx>
61 #include <IGESGeom_Direction.hxx>
62 #include <IGESGeom_Line.hxx>
63 #include <IGESGeom_OffsetSurface.hxx>
64 #include <IGESGeom_Plane.hxx>
65 #include <IGESGeom_Point.hxx>
66 #include <IGESGeom_RuledSurface.hxx>
67 #include <IGESGeom_SurfaceOfRevolution.hxx>
68 #include <IGESGeom_TabulatedCylinder.hxx>
69 #include <IGESGeom_TransformationMatrix.hxx>
71 #include <IGESSolid_PlaneSurface.hxx>
72 #include <Interface_Macros.hxx>
73 #include <Interface_Static.hxx>
75 #include <gce_MakeLin.hxx>
80 #include <gp_Cone.hxx>
81 #include <gp_Cylinder.hxx>
85 #include <gp_Sphere.hxx>
86 #include <gp_Torus.hxx>
87 #include <gp_Trsf.hxx>
91 #include <Precision.hxx>
93 #include <TColgp_HArray2OfXYZ.hxx>
94 #include <TColStd_HArray1OfReal.hxx>
95 #include <TColStd_HArray2OfReal.hxx>
96 #include <IGESSolid_CylindricalSurface.hxx>
97 #include <IGESSolid_ConicalSurface.hxx>
98 #include <IGESSolid_SphericalSurface.hxx>
99 #include <IGESSolid_ToroidalSurface.hxx>
100 #include <Geom_TrimmedCurve.hxx>
103 //=============================================================================
104 // GeomToIGES_GeomSurface
105 //=============================================================================
107 GeomToIGES_GeomSurface::GeomToIGES_GeomSurface()
108 :GeomToIGES_GeomEntity()
110 myBRepMode = Standard_False;
111 myAnalytic = Standard_False;
115 //=============================================================================
116 // GeomToIGES_GeomSurface
117 //=============================================================================
119 GeomToIGES_GeomSurface::GeomToIGES_GeomSurface(const GeomToIGES_GeomEntity& GE)
120 :GeomToIGES_GeomEntity(GE)
122 myBRepMode = Standard_False;
123 myAnalytic = Standard_False;
127 //=============================================================================
128 // Transfer des Entites Surface de Geom vers IGES
130 //=============================================================================
132 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_Surface)& start,
133 const Standard_Real Udeb,
134 const Standard_Real Ufin,
135 const Standard_Real Vdeb,
136 const Standard_Real Vfin)
138 Handle(IGESData_IGESEntity) res;
139 if (start.IsNull()) {
143 if (start->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) {
144 DeclareAndCast(Geom_BoundedSurface, Bounded, start);
145 res = TransferSurface(Bounded, Udeb, Ufin, Vdeb, Vfin);
147 else if (start->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) {
148 DeclareAndCast(Geom_ElementarySurface, Elementary, start);
149 res = TransferSurface(Elementary, Udeb, Ufin, Vdeb, Vfin);
151 else if ( start->IsKind(STANDARD_TYPE(Geom_SweptSurface))) {
152 DeclareAndCast(Geom_SweptSurface, Swept, start);
153 res = TransferSurface(Swept, Udeb, Ufin, Vdeb, Vfin);
155 else if ( start->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
156 DeclareAndCast(Geom_OffsetSurface, OffsetS, start);
157 res = TransferSurface(OffsetS, Udeb, Ufin, Vdeb, Vfin);
164 //=============================================================================
165 // Transfer des Entites BoundedSurface de Geom vers IGES
167 //=============================================================================
169 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_BoundedSurface)& start,
170 const Standard_Real Udeb,
171 const Standard_Real Ufin,
172 const Standard_Real Vdeb,
173 const Standard_Real Vfin)
175 Handle(IGESData_IGESEntity) res;
176 if (start.IsNull()) {
180 if (start->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) {
181 DeclareAndCast(Geom_BSplineSurface, BSpline, start);
182 res = TransferSurface(BSpline, Udeb, Ufin, Vdeb, Vfin);
184 else if (start->IsKind(STANDARD_TYPE(Geom_BezierSurface))) {
185 DeclareAndCast(Geom_BezierSurface, Bezier, start);
186 res = TransferSurface(Bezier, Udeb, Ufin, Vdeb, Vfin);
188 else if ( start->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
189 DeclareAndCast(Geom_RectangularTrimmedSurface, Trimmed, start);
190 res = TransferSurface(Trimmed,Udeb, Ufin, Vdeb, Vfin);
197 //=============================================================================
198 // Transfer des Entites BSplineSurface de Geom vers IGES
200 //=============================================================================
202 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_BSplineSurface)& start,
203 const Standard_Real Udeb,
204 const Standard_Real Ufin,
205 const Standard_Real Vdeb,
206 const Standard_Real Vfin)
208 // a b-spline surface is defined by :
209 // The U and V Degree (up to 25)
210 // The Poles (and the weights if it is rational)
211 // The U and V Knots and Multiplicities
213 // The knot vector is an increasing sequence of reals without repetition.
214 // The multiplicities are the repetition of the knots.
216 // If the knots are regularly spaced (the difference of two consecutive knots
218 // the knots repartition (in U or V) is :
219 // - Uniform if all multiplicities are 1.
220 // - Quasi-uniform if all multiplicities are 1
221 // but the first and the last which are Degree+1.
222 // - PiecewiseBezier if all multiplicites are
223 // Degree but the first and the last which are
226 // The surface may be periodic in U and in V.
227 // On a U periodic surface if there are k U knots
228 // and the poles table has p rows. the U period
229 // is uknot(k) - uknot(1)
231 // the poles and knots are infinite vectors with :
232 // uknot(i+k) = uknot(i) + period
233 // pole(i+p,j) = pole(i,j)
236 Handle(IGESData_IGESEntity) res;
238 if (start.IsNull()) {
242 Handle(IGESGeom_BSplineSurface) BSpline = new IGESGeom_BSplineSurface;
243 Handle(Geom_BSplineSurface) mysurface;
245 Standard_Boolean PeriodU = start->IsUPeriodic();
246 Standard_Boolean PeriodV = start->IsVPeriodic();
247 if (PeriodU || PeriodV) {
248 mysurface = Handle(Geom_BSplineSurface)::DownCast(start->Copy());
250 //szv#10:PRO19566:05Oct99
251 Standard_Boolean workaround = !(mysurface->IsURational() || mysurface->IsVRational());
252 if (workaround) mysurface->SetWeight(1,1,0.3);
254 if ( PeriodU ) mysurface->SetUNotPeriodic();
255 if ( PeriodV ) mysurface->SetVNotPeriodic();
257 //szv#10:PRO19566:05Oct99
258 if (workaround) mysurface->SetWeight(1,1,1.);
264 Standard_Integer DegU = mysurface->UDegree();
265 Standard_Integer DegV = mysurface->VDegree();
266 Standard_Boolean CloseU = mysurface->IsUClosed();
267 Standard_Boolean CloseV = mysurface->IsVClosed();
268 //Standard_Boolean PeriodU = start->IsUPeriodic();
269 //Standard_Boolean PeriodV = start->IsVPeriodic();
270 Standard_Boolean RationU = mysurface->IsURational();
271 Standard_Boolean RationV = mysurface->IsVRational();
272 Standard_Integer NbUPoles = mysurface->NbUPoles();
273 Standard_Integer NbVPoles = mysurface->NbVPoles();
274 Standard_Integer IndexU = NbUPoles -1;
275 Standard_Integer IndexV = NbVPoles -1;
276 Standard_Boolean Polynom = !(RationU || RationV); //szv#10:PRO19566:05Oct99 && was wrong
278 // filling knots array for U :
279 // Sequence des Knots de [-DegU, IndexU+1] dans IGESGeom.
280 Standard_Integer Knotindex;
281 Standard_Real rtampon;
282 Standard_Integer itampon;
283 TColStd_Array1OfReal KU(1, NbUPoles+ DegU+ 1);
284 mysurface->UKnotSequence(KU);
286 Handle(TColStd_HArray1OfReal) KnotsU =
287 new TColStd_HArray1OfReal(-DegU,IndexU+1 );
288 for ( Knotindex=KU.Lower(); Knotindex<=KU.Upper(); Knotindex++) {
289 rtampon = KU.Value(Knotindex);
290 KnotsU->SetValue(itampon, rtampon);
294 // filling knots array for V :
295 // Sequence des Knots de [-DegV, IndexV+1] dans IGESGeom.
296 TColStd_Array1OfReal KV(1, NbVPoles+ DegV+ 1);
297 mysurface->VKnotSequence(KV);
299 Handle(TColStd_HArray1OfReal) KnotsV =
300 new TColStd_HArray1OfReal(-DegV, IndexV+1);
301 for ( Knotindex=KV.Lower(); Knotindex<=KV.Upper(); Knotindex++) {
302 rtampon = KV.Value(Knotindex);
303 KnotsV->SetValue(itampon, rtampon);
307 // filling Weights array de [0, IndexU, 0, IndexV]
308 // ----------------------------------------------
309 Handle(TColStd_HArray2OfReal) Weights =
310 new TColStd_HArray2OfReal(0 , IndexU, 0, IndexV);
311 Standard_Integer WeightRow = Weights->LowerRow();
312 Standard_Integer WeightCol = Weights->LowerCol();
313 Standard_Integer iw, jw;
315 if(RationU || RationV) {
316 for ( iw = 1; iw<= IndexU+1; iw++) {
317 for ( jw = 1; jw<= IndexV+1; jw++)
318 Weights->SetValue(WeightRow, WeightCol++, mysurface->Weight(iw,jw));
320 WeightCol = Weights->LowerCol();
323 for ( iw = 1; iw<= IndexU+1; iw++) {
324 for ( jw = 1; jw<= IndexV+1; jw++)
325 Weights->SetValue(WeightRow, WeightCol++, 1.0);
327 WeightCol = Weights->LowerCol();
332 // filling Poles array de [0, IndexU, 0, IndexV]
333 // ---------------------------------------------
334 Handle(TColgp_HArray2OfXYZ) Poles =
335 new TColgp_HArray2OfXYZ(0, IndexU, 0, IndexV);
336 Standard_Integer UIndex = Poles->LowerRow();
337 Standard_Integer VIndex = Poles->LowerCol();
338 Standard_Integer ipole, jpole;
339 Standard_Real Xd, Yd, Zd;
341 for ( ipole = 1; ipole<= IndexU+1; ipole++) {
342 for ( jpole = 1; jpole<= IndexV+1; jpole++) {
343 gp_Pnt tempPnt = mysurface-> Pole(ipole, jpole);
344 tempPnt.Coord(Xd, Yd, Zd);
345 gp_XYZ PXYZ = gp_XYZ( Xd/GetUnit(), Yd/GetUnit(), Zd/GetUnit());
346 Poles->SetValue(UIndex, VIndex++, PXYZ);
349 VIndex = Poles->LowerCol();
352 // mjm le 9/10/97 mise en place d`une protection
353 Standard_Real U1,U2,V1,V2;
354 Standard_Real Umin = Udeb;
355 Standard_Real Umax = Ufin;
356 Standard_Real Vmin = Vdeb;
357 Standard_Real Vmax = Vfin;
358 mysurface->Bounds(U1,U2,V1,V2);
359 if ( U1 > Umin ) Umin = U1;
360 if ( V1 > Vmin ) Vmin = V1;
361 if ( U2 < Umax ) Umax = U2;
362 if ( V2 < Vmax ) Vmax = V2;
364 BSpline-> Init (IndexU, IndexV, DegU, DegV, CloseU, CloseV, Polynom, PeriodU,
365 PeriodV, KnotsU, KnotsV, Weights, Poles, Umin, Umax, Vmin, Vmax);
371 //=============================================================================
372 // Transfer des Entites BezierSurface de Geom vers IGES
374 //=============================================================================
376 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_BezierSurface)& start,
377 const Standard_Real /*Udeb*/,
378 const Standard_Real /*Ufin*/,
379 const Standard_Real /*Vdeb*/,
380 const Standard_Real /*Vfin*/)
382 Handle(IGESData_IGESEntity) res;
383 if (start.IsNull()) {
387 Handle(Geom_BSplineSurface) Bspline =
388 GeomConvert::SurfaceToBSplineSurface(start);
389 Standard_Real U1,U2,V1,V2;
390 Bspline->Bounds(U1,U2,V1,V2);
391 res = TransferSurface(Bspline, U1, U2, V1, V2);
396 //=============================================================================
397 // Transfer des Entites RectangularTrimmedSurface de Geom vers IGES
399 //=============================================================================
401 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_RectangularTrimmedSurface)& start,
402 const Standard_Real Udeb,
403 const Standard_Real Ufin,
404 const Standard_Real Vdeb,
405 const Standard_Real Vfin)
407 Handle(IGESData_IGESEntity) res;
408 if (start.IsNull()) {
412 Handle(Geom_Surface) st = start->BasisSurface();
413 if (st->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
414 //message d'erreur pas de trimmed a partir d'une trimmed ,
415 //on peut eventuellement ecrire la surface de base : st.
419 res = TransferSurface(st, Udeb, Ufin, Vdeb, Vfin);
425 //=============================================================================
426 // Transfer des Entites ElementarySurface de Geom vers IGES
428 //=============================================================================
430 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_ElementarySurface)& start,
431 const Standard_Real Udeb,
432 const Standard_Real Ufin,
433 const Standard_Real Vdeb,
434 const Standard_Real Vfin)
436 Handle(IGESData_IGESEntity) res;
437 // All these entities are located in 3D space with an axis
438 // placement (Location point, XAxis, YAxis, ZAxis). It is
439 // their local coordinate system.
441 //S4181 pdn 16.04.99 Hereunder, the implementation of translation of CAS.CADE
442 // elementary surfaces into different types of IGES surfaces according to boolean flags
443 if (start.IsNull()) {
446 if (start->IsKind(STANDARD_TYPE(Geom_Plane))) {
447 DeclareAndCast(Geom_Plane, Plane, start);
449 res = TransferPlaneSurface(Plane, Udeb, Ufin, Vdeb, Vfin);
451 res = TransferSurface(Plane, Udeb, Ufin, Vdeb, Vfin);
453 else if (start->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
454 DeclareAndCast(Geom_CylindricalSurface, Cylindrical, start);
455 if(myBRepMode&&myAnalytic)
456 res = TransferCylindricalSurface(Cylindrical, Udeb, Ufin, Vdeb, Vfin);
458 res = TransferSurface(Cylindrical, Udeb, Ufin, Vdeb, Vfin);
460 else if ( start->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) {
461 DeclareAndCast(Geom_ConicalSurface, Conical, start);
462 if(myBRepMode&&myAnalytic)
463 res = TransferConicalSurface(Conical, Udeb, Ufin, Vdeb, Vfin);
465 res = TransferSurface(Conical, Udeb, Ufin, Vdeb, Vfin);
467 else if (start->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
468 DeclareAndCast(Geom_SphericalSurface, Spherical, start);
469 if(myBRepMode&&myAnalytic)
470 res = TransferSphericalSurface(Spherical, Udeb, Ufin, Vdeb, Vfin);
472 res = TransferSurface(Spherical, Udeb, Ufin, Vdeb, Vfin);
474 else if ( start->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
475 DeclareAndCast(Geom_ToroidalSurface, Toroidal, start);
476 if(myBRepMode&&myAnalytic)
477 res = TransferToroidalSurface(Toroidal, Udeb, Ufin, Vdeb, Vfin);
479 res = TransferSurface(Toroidal, Udeb, Ufin, Vdeb, Vfin);
487 //=============================================================================
488 // Transfer des Entites Plane de Geom vers IGES
490 //=============================================================================
492 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_Plane)& start,
493 const Standard_Real Udeb,
494 const Standard_Real Ufin,
495 const Standard_Real Vdeb,
496 const Standard_Real Vfin)
498 // on va ecrire une BSplineSurface pour pouvoir etre coherent avec les courbes 2d
499 Handle(IGESData_IGESEntity) res;
501 if (start.IsNull()) {
504 if (Interface_Static::IVal("write.iges.plane.mode") == 0){
505 Handle(IGESGeom_Plane) aPlane = new IGESGeom_Plane;
506 Standard_Real A,B,C,D;
507 start->Coefficients(A,B,C,D);
508 D = -D;// because of difference in Geom_Plane class and Type 108
509 gp_XYZ anAttach = start->Location().XYZ();
510 aPlane->Init(A,B,C,D,0,anAttach,0);
515 Handle(IGESGeom_BSplineSurface) BSpline = new IGESGeom_BSplineSurface;
516 gp_Pnt P1 ,P2, P3, P4;
517 start->D0(Udeb, Vdeb, P1);
518 start->D0(Udeb, Vfin, P2);
519 start->D0(Ufin, Vdeb, P3);
520 start->D0(Ufin, Vfin, P4);
521 Handle(TColgp_HArray2OfXYZ) Poles = new TColgp_HArray2OfXYZ(0, 1, 0, 1);
524 Poles->SetValue (0, 0, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()));
526 Poles->SetValue (0, 1, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()));
528 Poles->SetValue (1, 0, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()));
530 Poles->SetValue (1, 1, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()));
532 Handle(TColStd_HArray1OfReal) KnotsU = new TColStd_HArray1OfReal(-1,2);
533 KnotsU->SetValue(-1, Udeb);
534 KnotsU->SetValue(0, Udeb);
535 KnotsU->SetValue(1, Ufin);
536 KnotsU->SetValue(2, Ufin);
538 Handle(TColStd_HArray1OfReal) KnotsV = new TColStd_HArray1OfReal(-1,2);
539 KnotsV->SetValue(-1, Vdeb);
540 KnotsV->SetValue(0, Vdeb);
541 KnotsV->SetValue(1, Vfin);
542 KnotsV->SetValue(2, Vfin);
544 Handle(TColStd_HArray2OfReal) Weights =
545 new TColStd_HArray2OfReal(0, 1, 0, 1, 1.);
548 BSpline-> Init ( 1, 1, 1, 1, Standard_False , Standard_False, Standard_True,
549 Standard_False, Standard_False,
550 KnotsU, KnotsV, Weights, Poles, Udeb, Ufin, Vdeb, Vfin);
558 //=============================================================================
559 // Transfer des Entites CylindricalSurface de Geom vers IGES
561 //=============================================================================
563 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
564 ( const Handle(Geom_CylindricalSurface)& start, const Standard_Real Udeb,
565 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
567 // The "ZAxis" is the symmetry axis of the CylindricalSurface,
568 // it gives the direction of increasing parametric value V.
569 // The parametrization range is :
570 // U [0, 2*PI], V ]- infinite, + infinite[
571 // The "XAxis" and the "YAxis" define the placement plane of the
572 // surface (Z = 0, and parametric value V = 0) perpendicular to
573 // the symmetry axis. The "XAxis" defines the origin of the
574 // parameter U = 0. The trigonometric sense gives the positive
575 // orientation for the parameter U.
577 Handle(IGESData_IGESEntity) res;
579 if (start.IsNull()) {
583 Handle(IGESGeom_SurfaceOfRevolution) Surf = new IGESGeom_SurfaceOfRevolution;
584 Standard_Real U1 = Udeb;
585 Standard_Real U2 = Ufin;
586 Standard_Real V1 = Vdeb;
587 Standard_Real V2 = Vfin;
588 if (Precision::IsNegativeInfinite(Vdeb)) V1 = -Precision::Infinite();
589 if (Precision::IsPositiveInfinite(Vfin)) V2 = Precision::Infinite();
591 // creation de la generatrice : Generatrix
592 Handle(Geom_Line) Ligne =
593 new Geom_Line (gp_Pnt(start->Cylinder().Radius(), 0.0, 0.0),
594 gp_Dir(0.0, 0.0, 1.0));
595 GeomToIGES_GeomCurve GC(*this);
596 Handle(IGESData_IGESEntity) Generatrix = GC.TransferCurve( Ligne, V1, V2);
597 gp_Pnt gen1 = Ligne->Value(V1);
598 gp_Pnt gen2 = Ligne->Value(V2);
599 TheLength = gen1.Distance(gen2);
602 // creation de l`axe : Axis .
603 Handle(IGESGeom_Line) Axis = new IGESGeom_Line;
604 //#30 rln 19.10.98 IGES axis = reversed CAS.CADE axis
605 //Axis->Init(gp_XYZ(0.0, 0.0, 0.0), gp_XYZ(0.0, 0.0, 1.0/GetUnit()));
606 //Surf->Init (Axis, Generatrix, U1, U2);
607 Axis->Init(gp_XYZ (0, 0, 1. / GetUnit()), gp_XYZ (0, 0, 0));
608 Surf->Init (Axis, Generatrix, 2 * M_PI - U2, 2 * M_PI - U1);
611 // creation de la Trsf (#124)
612 // il faut tenir compte de l`unite pour la matrice de transformation
613 // (partie translation).
614 IGESConvGeom_GeomBuilder Build;
615 Standard_Real xloc,yloc,zloc;
616 start->Cylinder().Location().Coord(xloc,yloc,zloc);
618 Loc.SetCoord(xloc, yloc, zloc);
619 gp_Ax3 Pos = start->Cylinder().Position();
620 Pos.SetLocation(Loc);
621 Build.SetPosition(Pos);
622 if (!Build.IsIdentity()){
623 Handle(IGESGeom_TransformationMatrix) TMat =
624 new IGESGeom_TransformationMatrix;
625 TMat = Build.MakeTransformation(GetUnit());
626 Surf->InitTransf(TMat);
634 //=============================================================================
635 // Transfer des Entites ConicalSurface de Geom vers IGES
637 //=============================================================================
639 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
640 ( const Handle(Geom_ConicalSurface)& start, const Standard_Real Udeb,
641 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
643 // The "ZAxis" is the symmetry axis of the ConicalSurface,
644 // it gives the direction of increasing parametric value V.
645 // The apex of the surface is on the negative side of this axis.
646 // The parametrization range is :
647 // U [0, 2*PI], V ]-infinite, + infinite[
648 // The "XAxis" and the "YAxis" define the placement plane of the
649 // surface (Z = 0, and parametric value V = 0) perpendicular to
650 // the symmetry axis. The "XAxis" defines the origin of the
651 // parameter U = 0. The trigonometric sense gives the positive
652 // orientation for the parameter U.
655 Handle(IGESData_IGESEntity) res;
657 if (start.IsNull()) {
660 Handle(IGESGeom_SurfaceOfRevolution) Surf = new IGESGeom_SurfaceOfRevolution;
661 Standard_Real U1 = Udeb;
662 Standard_Real U2 = Ufin;
663 Standard_Real V1 = Vdeb;
664 Standard_Real V2 = Vfin;
665 if (Precision::IsNegativeInfinite(Vdeb)) V1 = -Precision::Infinite();
666 if (Precision::IsPositiveInfinite(Vfin)) V2 = Precision::Infinite();
668 // creation de la generatrice : Generatrix
669 Handle(Geom_Line) Ligne =
670 new Geom_Line( gp_Pnt(start->Cone().RefRadius(), 0.0, 0.0),
671 gp_Dir(sin(start->Cone().SemiAngle()), 0.,
672 cos(start->Cone().SemiAngle())));
673 GeomToIGES_GeomCurve GC(*this);
674 Handle(IGESData_IGESEntity) Generatrix = GC.TransferCurve( Ligne, V1, V2);
675 gp_Pnt gen1 = Ligne->Value(V1);
676 gp_Pnt gen2 = Ligne->Value(V2);
677 // TheLength = gen1.Distance(gen2)*Cos(start->Cone().SemiAngle());
678 TheLength = gen1.Distance(gen2);
680 // creation de l`axe : Axis .
681 Handle(IGESGeom_Line) Axis = new IGESGeom_Line;
682 //#30 rln 19.10.98 IGES axis = reversed CAS.CADE axis
683 //Axis->Init(gp_XYZ(0.0, 0.0, 0.0), gp_XYZ(0.0, 0.0, 1.0/GetUnit()));
684 //Surf->Init (Axis, Generatrix, U1, U2);
685 Axis->Init(gp_XYZ (0, 0, 1. / GetUnit()), gp_XYZ (0, 0, 0));
686 Surf->Init (Axis, Generatrix, 2 * M_PI - U2, 2 * M_PI - U1);
689 // creation de la Trsf (#124)
690 // il faut tenir compte de l`unite pour la matrice de transformation
691 // (partie translation).
692 IGESConvGeom_GeomBuilder Build;
693 Standard_Real xloc,yloc,zloc;
694 start->Cone().Location().Coord(xloc,yloc,zloc);
696 Loc.SetCoord(xloc, yloc, zloc);
697 gp_Ax3 Pos = start->Cone().Position();
698 Pos.SetLocation(Loc);
699 Build.SetPosition(Pos);
700 if (!Build.IsIdentity()){
701 Handle(IGESGeom_TransformationMatrix) TMat =
702 new IGESGeom_TransformationMatrix;
703 TMat = Build.MakeTransformation(GetUnit());
704 Surf->InitTransf(TMat);
712 //=============================================================================
713 // Transfer des Entites SphericalSurface de Geom vers IGES
715 //=============================================================================
717 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
718 ( const Handle(Geom_SphericalSurface)& start, const Standard_Real Udeb,
719 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
721 // The center of the sphere is the "Location" point of the local
722 // coordinate system.
723 // The V isoparametric curves of the surface are defined by
724 // the section of the spherical surface with plane parallel to the
725 // plane (Location, XAxis, YAxis). This plane defines the origin of
726 // parametrization V.
727 // The U isoparametric curves of the surface are defined by the
728 // section of the spherical surface with plane obtained by rotation
729 // of the plane (Location, XAxis, ZAxis) around ZAxis. This plane
730 // defines the origin of parametrization u.
731 // The parametrization range is U [0, 2*PI], V [- PI/2, + PI/2]
733 Handle(IGESData_IGESEntity) res;
735 if (start.IsNull()) {
739 Handle(IGESGeom_SurfaceOfRevolution) Surf = new IGESGeom_SurfaceOfRevolution;
741 Standard_Real U1 = Udeb;
742 Standard_Real U2 = Ufin;
743 Standard_Real V1 = Vdeb;
744 Standard_Real V2 = Vfin;
746 // creation de la generatrice : Generatrix (1/2 cercle)
747 gp_Ax2 Axe(gp::Origin(), -gp::DY(), gp::DX());
748 Handle(Geom_Circle) Cercle =
749 new Geom_Circle(Axe, start->Sphere().Radius());
750 GeomToIGES_GeomCurve GC(*this);
751 Handle(IGESData_IGESEntity) Gen = GC.TransferCurve( Cercle, V1, V2);
753 // creation de l`axe : Axis .
754 Handle(IGESGeom_Line) Axis = new IGESGeom_Line;
755 //#30 rln 19.10.98 IGES axis = reversed CAS.CADE axis
756 //Axis->Init(gp_XYZ(0.0, 0.0, 0.0), gp_XYZ(0.0, 0.0, 1.0/GetUnit()));
757 Axis->Init(gp_XYZ (0, 0, 1. / GetUnit()), gp_XYZ (0, 0, 0));
759 if ( Gen->IsKind(STANDARD_TYPE(IGESGeom_CircularArc))) {
760 //#30 rln 19.10.98 Surf->Init (Axis, Gen, U1, U2);
761 Surf->Init (Axis, Gen, 2 * M_PI - U2, 2 * M_PI - U1);
762 IGESConvGeom_GeomBuilder Build;
763 Standard_Real xloc,yloc,zloc;
764 start->Sphere().Location().Coord(xloc,yloc,zloc);
766 Loc.SetCoord(xloc, yloc, zloc);
767 gp_Ax3 Pos = start->Sphere().Position();
768 Pos.SetLocation(Loc);
769 Build.SetPosition(Pos);
770 if (!Build.IsIdentity()){
771 Handle(IGESGeom_TransformationMatrix) TMat =
772 new IGESGeom_TransformationMatrix;
773 TMat = Build.MakeTransformation(GetUnit());
774 Surf->InitTransf(TMat);
782 //=============================================================================
783 // Transfer des Entites ToroidalSurface de Geom vers IGES
785 //=============================================================================
787 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
788 ( const Handle(Geom_ToroidalSurface)& start, const Standard_Real Udeb,
789 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
791 // The "Location point" of the axis placement is the center
793 // The plane (Location, XAxis, ZAxis) defines the origin of the
794 // parametrization U. The plane (Location, XAxis, YAxis)
795 // defines the origin of the parametrization V.
796 // The parametrization range is U [0, 2*PI], V [0, 2*PI]
799 Handle(IGESData_IGESEntity) res;
801 if (start.IsNull()) {
805 Handle(IGESGeom_SurfaceOfRevolution) Surf = new IGESGeom_SurfaceOfRevolution;
806 Standard_Real U1 = Udeb;
807 Standard_Real U2 = Ufin;
808 Standard_Real V1 = Vdeb;
809 Standard_Real V2 = Vfin;
811 // creation de la generatrice : Generatrix (cercle)
812 gp_Ax2 Axe = gp_Ax2(gp_Pnt((start->Torus().MajorRadius()), 0., 0.),
813 -gp::DY(), gp::DX());
814 Handle(Geom_Circle) Cercle =
815 new Geom_Circle(Axe, start->Torus().MinorRadius());
816 GeomToIGES_GeomCurve GC(*this);
817 Handle(IGESData_IGESEntity) Gen = GC.TransferCurve( Cercle, V1, V2);
819 // creation de l`axe : Axis .
820 Handle(IGESGeom_Line) Axis = new IGESGeom_Line;
821 //#30 rln 19.10.98 IGES axis = reversed CAS.CADE axis
822 //Axis->Init(gp_XYZ(0.0, 0.0, 0.0), gp_XYZ(0.0, 0.0, 1.0/GetUnit()));
823 Axis->Init(gp_XYZ (0, 0, 1. / GetUnit()), gp_XYZ (0, 0, 0));
825 //:l6 abv: CTS22022: writing full tori: if ( Gen->IsKind(STANDARD_TYPE(IGESGeom_CircularArc))) {
826 //#30 rln 19.10.98 Surf->Init (Axis, Gen, U1, U2);
827 Surf->Init (Axis, Gen, 2 * M_PI - U2, 2 * M_PI - U1);
828 IGESConvGeom_GeomBuilder Build;
830 Standard_Real xloc,yloc,zloc;
831 start->Torus().Location().Coord(xloc,yloc,zloc);
833 Loc.SetCoord(xloc, yloc, zloc);
835 gp_Ax3 Pos = start->Torus().Position();
836 //:l6 Pos.SetLocation(Loc);
837 Build.SetPosition(Pos);
838 if (!Build.IsIdentity()){
839 Handle(IGESGeom_TransformationMatrix) TMat =
840 new IGESGeom_TransformationMatrix;
841 TMat = Build.MakeTransformation(GetUnit());
842 Surf->InitTransf(TMat);
850 //=============================================================================
851 // Transfer des Entites SweptSurface de Geom vers IGES
853 //=============================================================================
855 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
856 ( const Handle(Geom_SweptSurface)& start, const Standard_Real Udeb,
857 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
859 Handle(IGESData_IGESEntity) res;
860 if (start.IsNull()) {
864 if (start->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) {
865 DeclareAndCast(Geom_SurfaceOfLinearExtrusion, Extrusion, start);
866 res = TransferSurface(Extrusion, Udeb, Ufin, Vdeb, Vfin);
868 else if (start->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
869 DeclareAndCast(Geom_SurfaceOfRevolution, Revolution, start);
870 res = TransferSurface(Revolution, Udeb, Ufin, Vdeb, Vfin);
877 //=============================================================================
878 // Transfer des Entites SurfaceOfLinearExtrusion de Geom vers IGES
880 //=============================================================================
882 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
883 ( const Handle(Geom_SurfaceOfLinearExtrusion)& start, const Standard_Real Udeb,
884 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
886 // This surface is obtained by sweeping a curve in a given direction.
887 // The parametrization range for the parameter U is defined with the
889 // The parametrization range for the parameter V is
890 // ]-infinite, + infinite[
891 // The position of the curve gives the origin for the parameter V.
894 Handle(IGESData_IGESEntity) res;
896 if (start.IsNull()) {
900 Handle(IGESGeom_TabulatedCylinder) Surf = new IGESGeom_TabulatedCylinder;
901 Standard_Real U1 = Udeb;
902 Standard_Real U2 = Ufin;
903 Standard_Real V1 = Vdeb;
904 Standard_Real V2 = Vfin;
905 if (Precision::IsNegativeInfinite(Vdeb)) V1 = -Precision::Infinite();
906 if (Precision::IsPositiveInfinite(Vfin)) V2 = Precision::Infinite();
908 // added by skl 18.07.2005 for OCC9490
909 Standard_Real UF,UL,VF,VL;
910 start->Bounds(UF,UL,VF,VL);
914 Handle(Geom_Curve) TheCurve = start->BasisCurve();
916 //dans IGES l'origine de la generatrice est identique a l'origine
917 //de la directrice , il faut translater la courbe si les deux
918 //points ne sont pas confondus dans Geom et donc la copier !!!!!!!
919 gp_Pnt TheEnd = start->Value(U1,V2);
920 Standard_Real Xe, Ye, Ze;
921 TheEnd.Coord(Xe, Ye, Ze);
922 gp_XYZ End = gp_XYZ (Xe/GetUnit(), Ye/GetUnit(), Ze/GetUnit());
924 GeomToIGES_GeomCurve GC(*this);
925 // commented by skl 18.07.2005 for OCC9490
926 Handle(Geom_Curve) CopyCurve;
927 if ( Abs(V1) > Precision::Confusion()) {
928 CopyCurve = Handle(Geom_Curve)::DownCast
929 (TheCurve->Translated (start->Value(U1,0.), start->Value(U1,V1)));
932 CopyCurve = TheCurve;
934 //Handle(IGESData_IGESEntity) Directrix = GC.TransferCurve( CopyCurve, V1, V2);
935 Handle(IGESData_IGESEntity) Directrix = GC.TransferCurve( CopyCurve, U1, U2);
936 //Handle(IGESData_IGESEntity) Directrix = GC.TransferCurve( TheCurve, U1, U2);
937 //gp_Pnt gen1 = start->Value(U1,V1);
938 //TheLength = gen1.Distance(TheEnd);
940 Surf->Init (Directrix, End);
946 //=============================================================================
947 // Transfer des Entites SurfaceOfRevolution de Geom vers IGES
949 //=============================================================================
951 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
952 ( const Handle(Geom_SurfaceOfRevolution)& start, const Standard_Real Udeb,
953 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
955 // The surface is obtained by rotating a curve a complete revolution
956 // about an axis. The curve and the axis must be in the same plane.
957 // For a complete surface of revolution the parametric range is
959 // The parametric range for V is defined with the revolved curve.
960 // The origin of the U parametrization is given by the position
961 // of the revolved curve (reference). The direction of the revolution
962 // axis defines the positive sense of rotation (trigonometric sense)
963 // corresponding to the increasing of the parametric value U.
964 // The derivatives are always defined for the u direction.
965 // For the v direction the definition of the derivatives depends on
966 // the degree of continuity of the referenced curve.
968 Handle(IGESData_IGESEntity) res;
970 if (start.IsNull()) {
974 Handle(IGESGeom_SurfaceOfRevolution) Surf = new IGESGeom_SurfaceOfRevolution;
975 Standard_Real U1 = Udeb;
976 Standard_Real U2 = Ufin;
977 Standard_Real V1 = Vdeb;
978 Standard_Real V2 = Vfin;
979 if (Precision::IsNegativeInfinite(Vdeb)) V1 = -Precision::Infinite();
980 if (Precision::IsPositiveInfinite(Vfin)) V2 = Precision::Infinite();
982 // creation de la generatrice : Generatrix
983 Handle(Geom_Curve) Curve = start->BasisCurve();
984 GeomToIGES_GeomCurve GC(*this);
985 Handle(IGESData_IGESEntity) Generatrix = GC.TransferCurve( Curve, V1, V2);
986 //pdn BUC184: decoding a trimmed curve
987 while( Curve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
988 Handle(Geom_TrimmedCurve) aTrCurve = Handle(Geom_TrimmedCurve)::
990 Curve = aTrCurve->BasisCurve();
993 if ( Curve->IsKind(STANDARD_TYPE(Geom_Line))) {
994 DeclareAndCast(Geom_Line, Line, Curve);
995 gp_Pnt gen1 = Line->Value(V1);
996 gp_Pnt gen2 = Line->Value(V2);
997 TheLength = gen1.Distance(gen2);
1000 // creation de l`axe : Axis .
1001 Handle(IGESGeom_Line) Axis = new IGESGeom_Line;
1002 gp_Ax1 Axe = start->Axis();
1003 Standard_Real X1,Y1,Z1,X2,Y2,Z2;
1004 Axe.Location().Coord(X1,Y1,Z1);
1005 Axe.Direction().Coord(X2,Y2,Z2);
1007 //#30 rln 19.10.98 IGES axis = reversed CAS.CADE axis
1008 //Axis->Init(gp_XYZ(X1/GetUnit(),Y1/GetUnit(),Z1/GetUnit()),
1009 // gp_XYZ(X2/GetUnit(),Y2/GetUnit(),Z2/GetUnit()));
1010 //#36 rln 27.10.98 BUC60328 face 7
1011 Axis->Init(gp_XYZ(X1/GetUnit(),Y1/GetUnit(),Z1/GetUnit()),
1012 gp_XYZ( (X1 - X2) / GetUnit(), (Y1 - Y2) / GetUnit(), (Z1 - Z2) / GetUnit()));
1014 Surf->Init (Axis, Generatrix, 2 * M_PI - U2, 2 * M_PI - U1);
1021 //=============================================================================
1022 // Transfer des Entites OffsetSurface de Geom vers IGES
1024 //=============================================================================
1026 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
1027 ( const Handle(Geom_OffsetSurface)& start, const Standard_Real Udeb, const Standard_Real
1028 Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
1030 // An offset surface is a surface at constant distance
1031 // (Offset) from a basis surface. The distance may be positive
1032 // or negative to the preferred side of the surface.
1033 // The positive side is defined by the cross product D1u ^ D1v
1034 // where D1u and D1v are the tangent vectors of the basis
1035 // surface in the U and V parametric directions. The previous
1036 // cross product defines the normal direction to the basis
1039 Handle(IGESData_IGESEntity) res;
1040 if (start.IsNull()) {
1044 Handle(IGESGeom_OffsetSurface) Surf = new IGESGeom_OffsetSurface;
1045 Handle(Geom_Surface) TheSurf = start->BasisSurface();
1046 Standard_Real U1, U2, V1, V2 , Um, Vm;
1047 start->Bounds (U1, U2, V1, V2);
1048 Um = (U1 + U2 ) /2.;
1049 Vm = (V1 + V2 ) /2.;
1050 Handle(IGESData_IGESEntity) Surface = TransferSurface
1051 (TheSurf, Udeb, Ufin, Vdeb, Vfin);
1052 Standard_Real Distance = start->Offset()/GetUnit();
1053 GeomLProp_SLProps Prop = GeomLProp_SLProps
1054 (TheSurf, Um, Vm, 1, Precision::Confusion());
1055 gp_Dir Dir = Prop.Normal();
1056 Standard_Real Xd, Yd, Zd;
1057 Dir.Coord(Xd, Yd, Zd);
1058 gp_XYZ Indicator = gp_XYZ(Xd/GetUnit(), Yd/GetUnit(), Zd/GetUnit());
1060 Surf-> Init (Indicator, Distance, Surface);
1067 //=============================================================================
1068 // Transfer des Entites Plane de Geom vers IGESSolid
1069 // TransferPlaneSurface
1070 //=============================================================================
1072 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferPlaneSurface(const Handle(Geom_Plane)& start,
1073 const Standard_Real /*Udeb*/,
1074 const Standard_Real /*Ufin*/,
1075 const Standard_Real /*Vdeb*/,
1076 const Standard_Real /*Vfin*/)
1078 // The parametrization range is U, V ]- infinite, + infinite[
1079 // The local coordinate system of the plane is defined with
1080 // an axis placement two axis.
1082 Handle(IGESData_IGESEntity) res;
1084 if (start.IsNull()) {
1088 Handle(IGESSolid_PlaneSurface) Plsurf = new IGESSolid_PlaneSurface;
1089 GeomToIGES_GeomPoint GP(*this);
1090 GeomToIGES_GeomVector GV(*this);
1092 gp_Pln Pln = start->Pln();
1094 Handle(Geom_CartesianPoint) mypoint = new Geom_CartesianPoint(Pln.Location());
1095 Handle(IGESGeom_Point) aLocation = GP.TransferPoint(mypoint);
1097 gp_Ax1 Axe = Pln.Axis();
1098 Handle(Geom_Direction) mydir = new Geom_Direction(Axe.Direction());
1099 Handle(IGESGeom_Direction) aNormal = GV.TransferVector(mydir);
1101 gp_Ax1 XAxe = Pln.XAxis();
1102 Handle(Geom_Direction) rdir = new Geom_Direction(XAxe.Direction());
1103 Handle(IGESGeom_Direction) refdir = GV.TransferVector(rdir);
1105 Plsurf->Init (aLocation, aNormal, refdir);
1111 //=======================================================================
1112 //function : TransferCylindricaSurface
1114 //=======================================================================
1116 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferCylindricalSurface(const Handle(Geom_CylindricalSurface)& start,
1117 const Standard_Real /*Udeb*/,
1118 const Standard_Real /*Ufin*/,
1119 const Standard_Real /*Vdeb*/,
1120 const Standard_Real /*Vfin*/)
1123 Handle(IGESData_IGESEntity) res;
1125 if (start.IsNull()) {
1129 Handle(IGESSolid_CylindricalSurface) CylSurf = new IGESSolid_CylindricalSurface;
1130 GeomToIGES_GeomPoint GP(*this);
1131 GeomToIGES_GeomVector GV(*this);
1133 gp_Cylinder Cyl = start->Cylinder();
1135 Handle(Geom_CartesianPoint) mypoint = new Geom_CartesianPoint(Cyl.Location());
1136 Handle(IGESGeom_Point) aLocation = GP.TransferPoint(mypoint);
1138 gp_Ax1 Axe = Cyl.Axis();
1139 Handle(Geom_Direction) mydir = new Geom_Direction(Axe.Direction());
1140 Handle(IGESGeom_Direction) Axis = GV.TransferVector(mydir);
1142 gp_Ax1 XAxe = Cyl.XAxis();
1143 Handle(Geom_Direction) rdir = new Geom_Direction(XAxe.Direction());
1144 Handle(IGESGeom_Direction) refdir = GV.TransferVector(rdir);
1146 Standard_Real radius = Cyl.Radius();
1148 CylSurf->Init (aLocation, Axis, radius, refdir);
1154 //=======================================================================
1155 //function : TransferConicalSurface
1157 //=======================================================================
1159 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferConicalSurface(const Handle(Geom_ConicalSurface)& start,
1160 const Standard_Real /*Udeb*/,
1161 const Standard_Real /*Ufin*/,
1162 const Standard_Real /*Vdeb*/,
1163 const Standard_Real /*Vfin*/)
1166 Handle(IGESData_IGESEntity) res;
1168 if (start.IsNull()) {
1172 Handle(IGESSolid_ConicalSurface) ConSurf = new IGESSolid_ConicalSurface;
1173 GeomToIGES_GeomPoint GP(*this);
1174 GeomToIGES_GeomVector GV(*this);
1176 gp_Cone Con = start->Cone();
1177 Standard_Real radius = Con.RefRadius();
1178 Standard_Real angle = Con.SemiAngle();
1179 gp_Ax1 Axe = Con.Axis();
1180 gp_Ax1 XAxe = Con.XAxis();
1181 gp_Dir XDir = XAxe.Direction();
1183 Handle(Geom_CartesianPoint) mypoint = new Geom_CartesianPoint(Con.Location());
1185 gp_Pnt pnt = mypoint->Pnt();
1186 mypoint->SetPnt(Con.Apex().XYZ()*2-pnt.XYZ());
1190 Handle(IGESGeom_Point) aLocation = GP.TransferPoint(mypoint);
1192 Handle(Geom_Direction) mydir = new Geom_Direction(Axe.Direction());
1193 Handle(IGESGeom_Direction) Axis = GV.TransferVector(mydir);
1195 Handle(Geom_Direction) rdir = new Geom_Direction(XDir);//XAxe.Direction());
1196 Handle(IGESGeom_Direction) refdir = GV.TransferVector(rdir);
1198 ConSurf->Init (aLocation, Axis, radius, angle*180./M_PI, refdir);
1204 //=======================================================================
1205 //function : TransferSphericalSurface
1207 //=======================================================================
1209 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSphericalSurface(const Handle(Geom_SphericalSurface)& start,
1210 const Standard_Real /*Udeb*/,
1211 const Standard_Real /*Ufin*/,
1212 const Standard_Real /*Vdeb*/,
1213 const Standard_Real /*Vfin*/)
1216 Handle(IGESData_IGESEntity) res;
1218 if (start.IsNull()) {
1222 Handle(IGESSolid_SphericalSurface) SphSurf = new IGESSolid_SphericalSurface;
1223 GeomToIGES_GeomPoint GP(*this);
1224 GeomToIGES_GeomVector GV(*this);
1226 gp_Sphere Sph = start->Sphere();
1228 Handle(Geom_CartesianPoint) mypoint = new Geom_CartesianPoint(Sph.Location());
1229 Handle(IGESGeom_Point) aLocation = GP.TransferPoint(mypoint);
1231 gp_Ax1 Axe = Sph.Position().Axis();
1232 Handle(Geom_Direction) mydir = new Geom_Direction(Axe.Direction());
1233 Handle(IGESGeom_Direction) Axis = GV.TransferVector(mydir);
1235 gp_Ax1 XAxe = Sph.XAxis();
1236 Handle(Geom_Direction) rdir = new Geom_Direction(XAxe.Direction());
1237 Handle(IGESGeom_Direction) refdir = GV.TransferVector(rdir);
1239 Standard_Real radius = Sph.Radius();
1241 SphSurf->Init (aLocation, radius, Axis, refdir);
1246 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferToroidalSurface(const Handle(Geom_ToroidalSurface)& start,
1247 const Standard_Real /*Udeb*/,
1248 const Standard_Real /*Ufin*/,
1249 const Standard_Real /*Vdeb*/,
1250 const Standard_Real /*Vfin*/)
1253 Handle(IGESData_IGESEntity) res;
1255 if (start.IsNull()) {
1259 Handle(IGESSolid_ToroidalSurface) TorSurf = new IGESSolid_ToroidalSurface;
1260 GeomToIGES_GeomPoint GP(*this);
1261 GeomToIGES_GeomVector GV(*this);
1263 gp_Torus Tor = start->Torus();
1265 Handle(Geom_CartesianPoint) mypoint = new Geom_CartesianPoint(Tor.Location());
1266 Handle(IGESGeom_Point) aLocation = GP.TransferPoint(mypoint);
1268 gp_Ax1 Axe = Tor.Axis();
1269 Handle(Geom_Direction) mydir = new Geom_Direction(Axe.Direction());
1270 Handle(IGESGeom_Direction) Axis = GV.TransferVector(mydir);
1272 gp_Ax1 XAxe = Tor.XAxis();
1273 Handle(Geom_Direction) rdir = new Geom_Direction(XAxe.Direction());
1274 Handle(IGESGeom_Direction) refdir = GV.TransferVector(rdir);
1276 Standard_Real major = Tor.MajorRadius();
1277 Standard_Real minor = Tor.MinorRadius();
1279 TorSurf->Init (aLocation, Axis, major, minor, refdir);
1285 //=======================================================================
1288 //=======================================================================
1289 Standard_Real GeomToIGES_GeomSurface::Length() const
1290 { return TheLength; }
1292 //=======================================================================
1293 //function : GetBRepMode
1295 //=======================================================================
1297 Standard_Boolean GeomToIGES_GeomSurface::GetBRepMode() const
1302 //=======================================================================
1303 //function : SetBRepMode
1305 //=======================================================================
1307 void GeomToIGES_GeomSurface::SetBRepMode(const Standard_Boolean flag)
1312 //=======================================================================
1313 //function : GetAnalyticMode
1315 //=======================================================================
1317 Standard_Boolean GeomToIGES_GeomSurface::GetAnalyticMode() const
1322 void GeomToIGES_GeomSurface::SetAnalyticMode(const Standard_Boolean flag)