1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
19 // modif du 22/10/96 mjm
20 // ajout du champ TheLength
21 //:l6 abv 15.01.99: CTS22022: writing full tori
23 //S4181 pdn 20.04.99 implementing of writing IGES elementary surfaces.
24 //szv#10:PRO19566:05Oct99 workaround against weights array loss
26 #include <GeomToIGES_GeomSurface.ixx>
27 #include <GeomToIGES_GeomCurve.hxx>
28 #include <GeomToIGES_GeomPoint.hxx>
29 #include <GeomToIGES_GeomVector.hxx>
31 #include <Geom_BSplineSurface.hxx>
32 #include <Geom_BezierSurface.hxx>
33 #include <Geom_BoundedSurface.hxx>
34 #include <Geom_CartesianPoint.hxx>
35 #include <Geom_ConicalSurface.hxx>
36 #include <Geom_Circle.hxx>
37 #include <Geom_Curve.hxx>
38 #include <Geom_CylindricalSurface.hxx>
39 #include <Geom_Curve.hxx>
40 #include <Geom_Direction.hxx>
41 #include <Geom_Geometry.hxx>
42 #include <Geom_Line.hxx>
43 #include <Geom_OffsetSurface.hxx>
44 #include <Geom_Plane.hxx>
45 #include <Geom_Point.hxx>
46 #include <Geom_RectangularTrimmedSurface.hxx>
47 #include <Geom_SphericalSurface.hxx>
48 #include <Geom_Surface.hxx>
49 #include <Geom_SurfaceOfLinearExtrusion.hxx>
50 #include <Geom_SurfaceOfRevolution.hxx>
51 #include <Geom_SweptSurface.hxx>
52 #include <Geom_ToroidalSurface.hxx>
54 #include <GeomConvert.hxx>
56 #include <GeomLProp_SLProps.hxx>
58 #include <IGESConvGeom_GeomBuilder.hxx>
60 #include <IGESData_IGESEntity.hxx>
62 #include <IGESGeom_BoundedSurface.hxx>
63 #include <IGESGeom_BSplineSurface.hxx>
64 #include <IGESGeom_CircularArc.hxx>
65 #include <IGESGeom_CurveOnSurface.hxx>
66 #include <IGESGeom_Direction.hxx>
67 #include <IGESGeom_Line.hxx>
68 #include <IGESGeom_OffsetSurface.hxx>
69 #include <IGESGeom_Plane.hxx>
70 #include <IGESGeom_Point.hxx>
71 #include <IGESGeom_RuledSurface.hxx>
72 #include <IGESGeom_SurfaceOfRevolution.hxx>
73 #include <IGESGeom_TabulatedCylinder.hxx>
74 #include <IGESGeom_TransformationMatrix.hxx>
76 #include <IGESSolid_PlaneSurface.hxx>
77 #include <Interface_Macros.hxx>
78 #include <Interface_Static.hxx>
80 #include <gce_MakeLin.hxx>
85 #include <gp_Cone.hxx>
86 #include <gp_Cylinder.hxx>
90 #include <gp_Sphere.hxx>
91 #include <gp_Torus.hxx>
92 #include <gp_Trsf.hxx>
96 #include <Precision.hxx>
98 #include <TColgp_HArray2OfXYZ.hxx>
99 #include <TColStd_HArray1OfReal.hxx>
100 #include <TColStd_HArray2OfReal.hxx>
101 #include <IGESSolid_CylindricalSurface.hxx>
102 #include <IGESSolid_ConicalSurface.hxx>
103 #include <IGESSolid_SphericalSurface.hxx>
104 #include <IGESSolid_ToroidalSurface.hxx>
105 #include <Geom_TrimmedCurve.hxx>
108 //=============================================================================
109 // GeomToIGES_GeomSurface
110 //=============================================================================
112 GeomToIGES_GeomSurface::GeomToIGES_GeomSurface()
113 :GeomToIGES_GeomEntity()
115 myBRepMode = Standard_False;
116 myAnalytic = Standard_False;
120 //=============================================================================
121 // GeomToIGES_GeomSurface
122 //=============================================================================
124 GeomToIGES_GeomSurface::GeomToIGES_GeomSurface(const GeomToIGES_GeomEntity& GE)
125 :GeomToIGES_GeomEntity(GE)
127 myBRepMode = Standard_False;
128 myAnalytic = Standard_False;
132 //=============================================================================
133 // Transfer des Entites Surface de Geom vers IGES
135 //=============================================================================
137 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_Surface)& start,
138 const Standard_Real Udeb,
139 const Standard_Real Ufin,
140 const Standard_Real Vdeb,
141 const Standard_Real Vfin)
143 Handle(IGESData_IGESEntity) res;
144 if (start.IsNull()) {
148 if (start->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) {
149 DeclareAndCast(Geom_BoundedSurface, Bounded, start);
150 res = TransferSurface(Bounded, Udeb, Ufin, Vdeb, Vfin);
152 else if (start->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) {
153 DeclareAndCast(Geom_ElementarySurface, Elementary, start);
154 res = TransferSurface(Elementary, Udeb, Ufin, Vdeb, Vfin);
156 else if ( start->IsKind(STANDARD_TYPE(Geom_SweptSurface))) {
157 DeclareAndCast(Geom_SweptSurface, Swept, start);
158 res = TransferSurface(Swept, Udeb, Ufin, Vdeb, Vfin);
160 else if ( start->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
161 DeclareAndCast(Geom_OffsetSurface, OffsetS, start);
162 res = TransferSurface(OffsetS, Udeb, Ufin, Vdeb, Vfin);
169 //=============================================================================
170 // Transfer des Entites BoundedSurface de Geom vers IGES
172 //=============================================================================
174 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_BoundedSurface)& start,
175 const Standard_Real Udeb,
176 const Standard_Real Ufin,
177 const Standard_Real Vdeb,
178 const Standard_Real Vfin)
180 Handle(IGESData_IGESEntity) res;
181 if (start.IsNull()) {
185 if (start->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) {
186 DeclareAndCast(Geom_BSplineSurface, BSpline, start);
187 res = TransferSurface(BSpline, Udeb, Ufin, Vdeb, Vfin);
189 else if (start->IsKind(STANDARD_TYPE(Geom_BezierSurface))) {
190 DeclareAndCast(Geom_BezierSurface, Bezier, start);
191 res = TransferSurface(Bezier, Udeb, Ufin, Vdeb, Vfin);
193 else if ( start->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
194 DeclareAndCast(Geom_RectangularTrimmedSurface, Trimmed, start);
195 res = TransferSurface(Trimmed,Udeb, Ufin, Vdeb, Vfin);
202 //=============================================================================
203 // Transfer des Entites BSplineSurface de Geom vers IGES
205 //=============================================================================
207 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_BSplineSurface)& start,
208 const Standard_Real Udeb,
209 const Standard_Real Ufin,
210 const Standard_Real Vdeb,
211 const Standard_Real Vfin)
213 // a b-spline surface is defined by :
214 // The U and V Degree (up to 25)
215 // The Poles (and the weights if it is rational)
216 // The U and V Knots and Multiplicities
218 // The knot vector is an increasing sequence of reals without repetition.
219 // The multiplicities are the repetition of the knots.
221 // If the knots are regularly spaced (the difference of two consecutive knots
223 // the knots repartition (in U or V) is :
224 // - Uniform if all multiplicities are 1.
225 // - Quasi-uniform if all multiplicities are 1
226 // but the first and the last which are Degree+1.
227 // - PiecewiseBezier if all multiplicites are
228 // Degree but the first and the last which are
231 // The surface may be periodic in U and in V.
232 // On a U periodic surface if there are k U knots
233 // and the poles table has p rows. the U period
234 // is uknot(k) - uknot(1)
236 // the poles and knots are infinite vectors with :
237 // uknot(i+k) = uknot(i) + period
238 // pole(i+p,j) = pole(i,j)
241 Handle(IGESData_IGESEntity) res;
243 if (start.IsNull()) {
247 Handle(IGESGeom_BSplineSurface) BSpline = new IGESGeom_BSplineSurface;
248 Handle(Geom_BSplineSurface) mysurface;
250 Standard_Boolean PeriodU = start->IsUPeriodic();
251 Standard_Boolean PeriodV = start->IsVPeriodic();
252 if (PeriodU || PeriodV) {
253 mysurface = Handle(Geom_BSplineSurface)::DownCast(start->Copy());
255 //szv#10:PRO19566:05Oct99
256 Standard_Boolean workaround = !(mysurface->IsURational() || mysurface->IsVRational());
257 if (workaround) mysurface->SetWeight(1,1,0.3);
259 if ( PeriodU ) mysurface->SetUNotPeriodic();
260 if ( PeriodV ) mysurface->SetVNotPeriodic();
262 //szv#10:PRO19566:05Oct99
263 if (workaround) mysurface->SetWeight(1,1,1.);
269 Standard_Integer DegU = mysurface->UDegree();
270 Standard_Integer DegV = mysurface->VDegree();
271 Standard_Boolean CloseU = mysurface->IsUClosed();
272 Standard_Boolean CloseV = mysurface->IsVClosed();
273 //Standard_Boolean PeriodU = start->IsUPeriodic();
274 //Standard_Boolean PeriodV = start->IsVPeriodic();
275 Standard_Boolean RationU = mysurface->IsURational();
276 Standard_Boolean RationV = mysurface->IsVRational();
277 Standard_Integer NbUPoles = mysurface->NbUPoles();
278 Standard_Integer NbVPoles = mysurface->NbVPoles();
279 Standard_Integer IndexU = NbUPoles -1;
280 Standard_Integer IndexV = NbVPoles -1;
281 Standard_Boolean Polynom = !(RationU || RationV); //szv#10:PRO19566:05Oct99 && was wrong
283 // filling knots array for U :
284 // Sequence des Knots de [-DegU, IndexU+1] dans IGESGeom.
285 Standard_Integer Knotindex;
286 Standard_Real rtampon;
287 Standard_Integer itampon;
288 TColStd_Array1OfReal KU(1, NbUPoles+ DegU+ 1);
289 mysurface->UKnotSequence(KU);
291 Handle(TColStd_HArray1OfReal) KnotsU =
292 new TColStd_HArray1OfReal(-DegU,IndexU+1 );
293 for ( Knotindex=KU.Lower(); Knotindex<=KU.Upper(); Knotindex++) {
294 rtampon = KU.Value(Knotindex);
295 KnotsU->SetValue(itampon, rtampon);
299 // filling knots array for V :
300 // Sequence des Knots de [-DegV, IndexV+1] dans IGESGeom.
301 TColStd_Array1OfReal KV(1, NbVPoles+ DegV+ 1);
302 mysurface->VKnotSequence(KV);
304 Handle(TColStd_HArray1OfReal) KnotsV =
305 new TColStd_HArray1OfReal(-DegV, IndexV+1);
306 for ( Knotindex=KV.Lower(); Knotindex<=KV.Upper(); Knotindex++) {
307 rtampon = KV.Value(Knotindex);
308 KnotsV->SetValue(itampon, rtampon);
312 // filling Weights array de [0, IndexU, 0, IndexV]
313 // ----------------------------------------------
314 Handle(TColStd_HArray2OfReal) Weights =
315 new TColStd_HArray2OfReal(0 , IndexU, 0, IndexV);
316 Standard_Integer WeightRow = Weights->LowerRow();
317 Standard_Integer WeightCol = Weights->LowerCol();
318 Standard_Integer iw, jw;
320 if(RationU || RationV) {
321 for ( iw = 1; iw<= IndexU+1; iw++) {
322 for ( jw = 1; jw<= IndexV+1; jw++)
323 Weights->SetValue(WeightRow, WeightCol++, mysurface->Weight(iw,jw));
325 WeightCol = Weights->LowerCol();
328 for ( iw = 1; iw<= IndexU+1; iw++) {
329 for ( jw = 1; jw<= IndexV+1; jw++)
330 Weights->SetValue(WeightRow, WeightCol++, 1.0);
332 WeightCol = Weights->LowerCol();
337 // filling Poles array de [0, IndexU, 0, IndexV]
338 // ---------------------------------------------
339 Handle(TColgp_HArray2OfXYZ) Poles =
340 new TColgp_HArray2OfXYZ(0, IndexU, 0, IndexV);
341 Standard_Integer UIndex = Poles->LowerRow();
342 Standard_Integer VIndex = Poles->LowerCol();
343 Standard_Integer ipole, jpole;
344 Standard_Real Xd, Yd, Zd;
346 for ( ipole = 1; ipole<= IndexU+1; ipole++) {
347 for ( jpole = 1; jpole<= IndexV+1; jpole++) {
348 gp_Pnt tempPnt = mysurface-> Pole(ipole, jpole);
349 tempPnt.Coord(Xd, Yd, Zd);
350 gp_XYZ PXYZ = gp_XYZ( Xd/GetUnit(), Yd/GetUnit(), Zd/GetUnit());
351 Poles->SetValue(UIndex, VIndex++, PXYZ);
354 VIndex = Poles->LowerCol();
357 // mjm le 9/10/97 mise en place d`une protection
358 Standard_Real U1,U2,V1,V2;
359 Standard_Real Umin = Udeb;
360 Standard_Real Umax = Ufin;
361 Standard_Real Vmin = Vdeb;
362 Standard_Real Vmax = Vfin;
363 mysurface->Bounds(U1,U2,V1,V2);
364 if ( U1 > Umin ) Umin = U1;
365 if ( V1 > Vmin ) Vmin = V1;
366 if ( U2 < Umax ) Umax = U2;
367 if ( V2 < Vmax ) Vmax = V2;
369 BSpline-> Init (IndexU, IndexV, DegU, DegV, CloseU, CloseV, Polynom, PeriodU,
370 PeriodV, KnotsU, KnotsV, Weights, Poles, Umin, Umax, Vmin, Vmax);
376 //=============================================================================
377 // Transfer des Entites BezierSurface de Geom vers IGES
379 //=============================================================================
381 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_BezierSurface)& start,
382 const Standard_Real /*Udeb*/,
383 const Standard_Real /*Ufin*/,
384 const Standard_Real /*Vdeb*/,
385 const Standard_Real /*Vfin*/)
387 Handle(IGESData_IGESEntity) res;
388 if (start.IsNull()) {
392 Handle(Geom_BSplineSurface) Bspline =
393 GeomConvert::SurfaceToBSplineSurface(start);
394 Standard_Real U1,U2,V1,V2;
395 Bspline->Bounds(U1,U2,V1,V2);
396 res = TransferSurface(Bspline, U1, U2, V1, V2);
401 //=============================================================================
402 // Transfer des Entites RectangularTrimmedSurface de Geom vers IGES
404 //=============================================================================
406 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_RectangularTrimmedSurface)& start,
407 const Standard_Real Udeb,
408 const Standard_Real Ufin,
409 const Standard_Real Vdeb,
410 const Standard_Real Vfin)
412 Handle(IGESData_IGESEntity) res;
413 if (start.IsNull()) {
417 Handle(Geom_Surface) st = start->BasisSurface();
418 if (st->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
419 //message d'erreur pas de trimmed a partir d'une trimmed ,
420 //on peut eventuellement ecrire la surface de base : st.
424 res = TransferSurface(st, Udeb, Ufin, Vdeb, Vfin);
430 //=============================================================================
431 // Transfer des Entites ElementarySurface de Geom vers IGES
433 //=============================================================================
435 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_ElementarySurface)& start,
436 const Standard_Real Udeb,
437 const Standard_Real Ufin,
438 const Standard_Real Vdeb,
439 const Standard_Real Vfin)
441 Handle(IGESData_IGESEntity) res;
442 // All these entities are located in 3D space with an axis
443 // placement (Location point, XAxis, YAxis, ZAxis). It is
444 // their local coordinate system.
446 //S4181 pdn 16.04.99 Hereunder, the implementation of translation of CAS.CADE
447 // elementary surfaces into different types of IGES surfaces according to boolean flags
448 if (start.IsNull()) {
451 if (start->IsKind(STANDARD_TYPE(Geom_Plane))) {
452 DeclareAndCast(Geom_Plane, Plane, start);
454 res = TransferPlaneSurface(Plane, Udeb, Ufin, Vdeb, Vfin);
456 res = TransferSurface(Plane, Udeb, Ufin, Vdeb, Vfin);
458 else if (start->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
459 DeclareAndCast(Geom_CylindricalSurface, Cylindrical, start);
460 if(myBRepMode&&myAnalytic)
461 res = TransferCylindricalSurface(Cylindrical, Udeb, Ufin, Vdeb, Vfin);
463 res = TransferSurface(Cylindrical, Udeb, Ufin, Vdeb, Vfin);
465 else if ( start->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) {
466 DeclareAndCast(Geom_ConicalSurface, Conical, start);
467 if(myBRepMode&&myAnalytic)
468 res = TransferConicalSurface(Conical, Udeb, Ufin, Vdeb, Vfin);
470 res = TransferSurface(Conical, Udeb, Ufin, Vdeb, Vfin);
472 else if (start->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
473 DeclareAndCast(Geom_SphericalSurface, Spherical, start);
474 if(myBRepMode&&myAnalytic)
475 res = TransferSphericalSurface(Spherical, Udeb, Ufin, Vdeb, Vfin);
477 res = TransferSurface(Spherical, Udeb, Ufin, Vdeb, Vfin);
479 else if ( start->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
480 DeclareAndCast(Geom_ToroidalSurface, Toroidal, start);
481 if(myBRepMode&&myAnalytic)
482 res = TransferToroidalSurface(Toroidal, Udeb, Ufin, Vdeb, Vfin);
484 res = TransferSurface(Toroidal, Udeb, Ufin, Vdeb, Vfin);
492 //=============================================================================
493 // Transfer des Entites Plane de Geom vers IGES
495 //=============================================================================
497 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle(Geom_Plane)& start,
498 const Standard_Real Udeb,
499 const Standard_Real Ufin,
500 const Standard_Real Vdeb,
501 const Standard_Real Vfin)
503 // on va ecrire une BSplineSurface pour pouvoir etre coherent avec les courbes 2d
504 Handle(IGESData_IGESEntity) res;
506 if (start.IsNull()) {
509 if (Interface_Static::IVal("write.iges.plane.mode") == 0){
510 Handle(IGESGeom_Plane) aPlane = new IGESGeom_Plane;
511 Standard_Real A,B,C,D;
512 start->Coefficients(A,B,C,D);
513 D = -D;// because of difference in Geom_Plane class and Type 108
514 gp_XYZ anAttach = start->Location().XYZ();
515 aPlane->Init(A,B,C,D,0,anAttach,0);
520 Handle(IGESGeom_BSplineSurface) BSpline = new IGESGeom_BSplineSurface;
521 gp_Pnt P1 ,P2, P3, P4;
522 start->D0(Udeb, Vdeb, P1);
523 start->D0(Udeb, Vfin, P2);
524 start->D0(Ufin, Vdeb, P3);
525 start->D0(Ufin, Vfin, P4);
526 Handle(TColgp_HArray2OfXYZ) Poles = new TColgp_HArray2OfXYZ(0, 1, 0, 1);
529 Poles->SetValue (0, 0, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()));
531 Poles->SetValue (0, 1, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()));
533 Poles->SetValue (1, 0, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()));
535 Poles->SetValue (1, 1, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()));
537 Handle(TColStd_HArray1OfReal) KnotsU = new TColStd_HArray1OfReal(-1,2);
538 KnotsU->SetValue(-1, Udeb);
539 KnotsU->SetValue(0, Udeb);
540 KnotsU->SetValue(1, Ufin);
541 KnotsU->SetValue(2, Ufin);
543 Handle(TColStd_HArray1OfReal) KnotsV = new TColStd_HArray1OfReal(-1,2);
544 KnotsV->SetValue(-1, Vdeb);
545 KnotsV->SetValue(0, Vdeb);
546 KnotsV->SetValue(1, Vfin);
547 KnotsV->SetValue(2, Vfin);
549 Handle(TColStd_HArray2OfReal) Weights =
550 new TColStd_HArray2OfReal(0, 1, 0, 1, 1.);
553 BSpline-> Init ( 1, 1, 1, 1, Standard_False , Standard_False, Standard_True,
554 Standard_False, Standard_False,
555 KnotsU, KnotsV, Weights, Poles, Udeb, Ufin, Vdeb, Vfin);
563 //=============================================================================
564 // Transfer des Entites CylindricalSurface de Geom vers IGES
566 //=============================================================================
568 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
569 ( const Handle(Geom_CylindricalSurface)& start, const Standard_Real Udeb,
570 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
572 // The "ZAxis" is the symmetry axis of the CylindricalSurface,
573 // it gives the direction of increasing parametric value V.
574 // The parametrization range is :
575 // U [0, 2*PI], V ]- infinite, + infinite[
576 // The "XAxis" and the "YAxis" define the placement plane of the
577 // surface (Z = 0, and parametric value V = 0) perpendicular to
578 // the symmetry axis. The "XAxis" defines the origin of the
579 // parameter U = 0. The trigonometric sense gives the positive
580 // orientation for the parameter U.
582 Handle(IGESData_IGESEntity) res;
584 if (start.IsNull()) {
588 Handle(IGESGeom_SurfaceOfRevolution) Surf = new IGESGeom_SurfaceOfRevolution;
589 Standard_Real U1 = Udeb;
590 Standard_Real U2 = Ufin;
591 Standard_Real V1 = Vdeb;
592 Standard_Real V2 = Vfin;
593 if (Precision::IsNegativeInfinite(Vdeb)) V1 = -Precision::Infinite();
594 if (Precision::IsPositiveInfinite(Vfin)) V2 = Precision::Infinite();
596 // creation de la generatrice : Generatrix
597 Handle(Geom_Line) Ligne =
598 new Geom_Line (gp_Pnt(start->Cylinder().Radius(), 0.0, 0.0),
599 gp_Dir(0.0, 0.0, 1.0));
600 GeomToIGES_GeomCurve GC(*this);
601 Handle(IGESData_IGESEntity) Generatrix = GC.TransferCurve( Ligne, V1, V2);
602 gp_Pnt gen1 = Ligne->Value(V1);
603 gp_Pnt gen2 = Ligne->Value(V2);
604 TheLength = gen1.Distance(gen2);
607 // creation de l`axe : Axis .
608 Handle(IGESGeom_Line) Axis = new IGESGeom_Line;
609 //#30 rln 19.10.98 IGES axis = reversed CAS.CADE axis
610 //Axis->Init(gp_XYZ(0.0, 0.0, 0.0), gp_XYZ(0.0, 0.0, 1.0/GetUnit()));
611 //Surf->Init (Axis, Generatrix, U1, U2);
612 Axis->Init(gp_XYZ (0, 0, 1. / GetUnit()), gp_XYZ (0, 0, 0));
613 Surf->Init (Axis, Generatrix, 2 * M_PI - U2, 2 * M_PI - U1);
616 // creation de la Trsf (#124)
617 // il faut tenir compte de l`unite pour la matrice de transformation
618 // (partie translation).
619 IGESConvGeom_GeomBuilder Build;
620 Standard_Real xloc,yloc,zloc;
621 start->Cylinder().Location().Coord(xloc,yloc,zloc);
623 Loc.SetCoord(xloc, yloc, zloc);
624 gp_Ax3 Pos = start->Cylinder().Position();
625 Pos.SetLocation(Loc);
626 Build.SetPosition(Pos);
627 if (!Build.IsIdentity()){
628 Handle(IGESGeom_TransformationMatrix) TMat =
629 new IGESGeom_TransformationMatrix;
630 TMat = Build.MakeTransformation(GetUnit());
631 Surf->InitTransf(TMat);
639 //=============================================================================
640 // Transfer des Entites ConicalSurface de Geom vers IGES
642 //=============================================================================
644 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
645 ( const Handle(Geom_ConicalSurface)& start, const Standard_Real Udeb,
646 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
648 // The "ZAxis" is the symmetry axis of the ConicalSurface,
649 // it gives the direction of increasing parametric value V.
650 // The apex of the surface is on the negative side of this axis.
651 // The parametrization range is :
652 // U [0, 2*PI], V ]-infinite, + infinite[
653 // The "XAxis" and the "YAxis" define the placement plane of the
654 // surface (Z = 0, and parametric value V = 0) perpendicular to
655 // the symmetry axis. The "XAxis" defines the origin of the
656 // parameter U = 0. The trigonometric sense gives the positive
657 // orientation for the parameter U.
660 Handle(IGESData_IGESEntity) res;
662 if (start.IsNull()) {
665 Handle(IGESGeom_SurfaceOfRevolution) Surf = new IGESGeom_SurfaceOfRevolution;
666 Standard_Real U1 = Udeb;
667 Standard_Real U2 = Ufin;
668 Standard_Real V1 = Vdeb;
669 Standard_Real V2 = Vfin;
670 if (Precision::IsNegativeInfinite(Vdeb)) V1 = -Precision::Infinite();
671 if (Precision::IsPositiveInfinite(Vfin)) V2 = Precision::Infinite();
673 // creation de la generatrice : Generatrix
674 Handle(Geom_Line) Ligne =
675 new Geom_Line( gp_Pnt(start->Cone().RefRadius(), 0.0, 0.0),
676 gp_Dir(sin(start->Cone().SemiAngle()), 0.,
677 cos(start->Cone().SemiAngle())));
678 GeomToIGES_GeomCurve GC(*this);
679 Handle(IGESData_IGESEntity) Generatrix = GC.TransferCurve( Ligne, V1, V2);
680 gp_Pnt gen1 = Ligne->Value(V1);
681 gp_Pnt gen2 = Ligne->Value(V2);
682 // TheLength = gen1.Distance(gen2)*Cos(start->Cone().SemiAngle());
683 TheLength = gen1.Distance(gen2);
685 // creation de l`axe : Axis .
686 Handle(IGESGeom_Line) Axis = new IGESGeom_Line;
687 //#30 rln 19.10.98 IGES axis = reversed CAS.CADE axis
688 //Axis->Init(gp_XYZ(0.0, 0.0, 0.0), gp_XYZ(0.0, 0.0, 1.0/GetUnit()));
689 //Surf->Init (Axis, Generatrix, U1, U2);
690 Axis->Init(gp_XYZ (0, 0, 1. / GetUnit()), gp_XYZ (0, 0, 0));
691 Surf->Init (Axis, Generatrix, 2 * M_PI - U2, 2 * M_PI - U1);
694 // creation de la Trsf (#124)
695 // il faut tenir compte de l`unite pour la matrice de transformation
696 // (partie translation).
697 IGESConvGeom_GeomBuilder Build;
698 Standard_Real xloc,yloc,zloc;
699 start->Cone().Location().Coord(xloc,yloc,zloc);
701 Loc.SetCoord(xloc, yloc, zloc);
702 gp_Ax3 Pos = start->Cone().Position();
703 Pos.SetLocation(Loc);
704 Build.SetPosition(Pos);
705 if (!Build.IsIdentity()){
706 Handle(IGESGeom_TransformationMatrix) TMat =
707 new IGESGeom_TransformationMatrix;
708 TMat = Build.MakeTransformation(GetUnit());
709 Surf->InitTransf(TMat);
717 //=============================================================================
718 // Transfer des Entites SphericalSurface de Geom vers IGES
720 //=============================================================================
722 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
723 ( const Handle(Geom_SphericalSurface)& start, const Standard_Real Udeb,
724 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
726 // The center of the sphere is the "Location" point of the local
727 // coordinate system.
728 // The V isoparametric curves of the surface are defined by
729 // the section of the spherical surface with plane parallel to the
730 // plane (Location, XAxis, YAxis). This plane defines the origin of
731 // parametrization V.
732 // The U isoparametric curves of the surface are defined by the
733 // section of the spherical surface with plane obtained by rotation
734 // of the plane (Location, XAxis, ZAxis) around ZAxis. This plane
735 // defines the origin of parametrization u.
736 // The parametrization range is U [0, 2*PI], V [- PI/2, + PI/2]
738 Handle(IGESData_IGESEntity) res;
740 if (start.IsNull()) {
744 Handle(IGESGeom_SurfaceOfRevolution) Surf = new IGESGeom_SurfaceOfRevolution;
746 Standard_Real U1 = Udeb;
747 Standard_Real U2 = Ufin;
748 Standard_Real V1 = Vdeb;
749 Standard_Real V2 = Vfin;
751 // creation de la generatrice : Generatrix (1/2 cercle)
752 gp_Ax2 Axe(gp::Origin(), -gp::DY(), gp::DX());
753 Handle(Geom_Circle) Cercle =
754 new Geom_Circle(Axe, start->Sphere().Radius());
755 GeomToIGES_GeomCurve GC(*this);
756 Handle(IGESData_IGESEntity) Gen = GC.TransferCurve( Cercle, V1, V2);
758 // creation de l`axe : Axis .
759 Handle(IGESGeom_Line) Axis = new IGESGeom_Line;
760 //#30 rln 19.10.98 IGES axis = reversed CAS.CADE axis
761 //Axis->Init(gp_XYZ(0.0, 0.0, 0.0), gp_XYZ(0.0, 0.0, 1.0/GetUnit()));
762 Axis->Init(gp_XYZ (0, 0, 1. / GetUnit()), gp_XYZ (0, 0, 0));
764 if ( Gen->IsKind(STANDARD_TYPE(IGESGeom_CircularArc))) {
765 //#30 rln 19.10.98 Surf->Init (Axis, Gen, U1, U2);
766 Surf->Init (Axis, Gen, 2 * M_PI - U2, 2 * M_PI - U1);
767 IGESConvGeom_GeomBuilder Build;
768 Standard_Real xloc,yloc,zloc;
769 start->Sphere().Location().Coord(xloc,yloc,zloc);
771 Loc.SetCoord(xloc, yloc, zloc);
772 gp_Ax3 Pos = start->Sphere().Position();
773 Pos.SetLocation(Loc);
774 Build.SetPosition(Pos);
775 if (!Build.IsIdentity()){
776 Handle(IGESGeom_TransformationMatrix) TMat =
777 new IGESGeom_TransformationMatrix;
778 TMat = Build.MakeTransformation(GetUnit());
779 Surf->InitTransf(TMat);
787 //=============================================================================
788 // Transfer des Entites ToroidalSurface de Geom vers IGES
790 //=============================================================================
792 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
793 ( const Handle(Geom_ToroidalSurface)& start, const Standard_Real Udeb,
794 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
796 // The "Location point" of the axis placement is the center
798 // The plane (Location, XAxis, ZAxis) defines the origin of the
799 // parametrization U. The plane (Location, XAxis, YAxis)
800 // defines the origin of the parametrization V.
801 // The parametrization range is U [0, 2*PI], V [0, 2*PI]
804 Handle(IGESData_IGESEntity) res;
806 if (start.IsNull()) {
810 Handle(IGESGeom_SurfaceOfRevolution) Surf = new IGESGeom_SurfaceOfRevolution;
811 Standard_Real U1 = Udeb;
812 Standard_Real U2 = Ufin;
813 Standard_Real V1 = Vdeb;
814 Standard_Real V2 = Vfin;
816 // creation de la generatrice : Generatrix (cercle)
817 gp_Ax2 Axe = gp_Ax2(gp_Pnt((start->Torus().MajorRadius()), 0., 0.),
818 -gp::DY(), gp::DX());
819 Handle(Geom_Circle) Cercle =
820 new Geom_Circle(Axe, start->Torus().MinorRadius());
821 GeomToIGES_GeomCurve GC(*this);
822 Handle(IGESData_IGESEntity) Gen = GC.TransferCurve( Cercle, V1, V2);
824 // creation de l`axe : Axis .
825 Handle(IGESGeom_Line) Axis = new IGESGeom_Line;
826 //#30 rln 19.10.98 IGES axis = reversed CAS.CADE axis
827 //Axis->Init(gp_XYZ(0.0, 0.0, 0.0), gp_XYZ(0.0, 0.0, 1.0/GetUnit()));
828 Axis->Init(gp_XYZ (0, 0, 1. / GetUnit()), gp_XYZ (0, 0, 0));
830 //:l6 abv: CTS22022: writing full tori: if ( Gen->IsKind(STANDARD_TYPE(IGESGeom_CircularArc))) {
831 //#30 rln 19.10.98 Surf->Init (Axis, Gen, U1, U2);
832 Surf->Init (Axis, Gen, 2 * M_PI - U2, 2 * M_PI - U1);
833 IGESConvGeom_GeomBuilder Build;
835 Standard_Real xloc,yloc,zloc;
836 start->Torus().Location().Coord(xloc,yloc,zloc);
838 Loc.SetCoord(xloc, yloc, zloc);
840 gp_Ax3 Pos = start->Torus().Position();
841 //:l6 Pos.SetLocation(Loc);
842 Build.SetPosition(Pos);
843 if (!Build.IsIdentity()){
844 Handle(IGESGeom_TransformationMatrix) TMat =
845 new IGESGeom_TransformationMatrix;
846 TMat = Build.MakeTransformation(GetUnit());
847 Surf->InitTransf(TMat);
855 //=============================================================================
856 // Transfer des Entites SweptSurface de Geom vers IGES
858 //=============================================================================
860 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
861 ( const Handle(Geom_SweptSurface)& start, const Standard_Real Udeb,
862 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
864 Handle(IGESData_IGESEntity) res;
865 if (start.IsNull()) {
869 if (start->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) {
870 DeclareAndCast(Geom_SurfaceOfLinearExtrusion, Extrusion, start);
871 res = TransferSurface(Extrusion, Udeb, Ufin, Vdeb, Vfin);
873 else if (start->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
874 DeclareAndCast(Geom_SurfaceOfRevolution, Revolution, start);
875 res = TransferSurface(Revolution, Udeb, Ufin, Vdeb, Vfin);
882 //=============================================================================
883 // Transfer des Entites SurfaceOfLinearExtrusion de Geom vers IGES
885 //=============================================================================
887 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
888 ( const Handle(Geom_SurfaceOfLinearExtrusion)& start, const Standard_Real Udeb,
889 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
891 // This surface is obtained by sweeping a curve in a given direction.
892 // The parametrization range for the parameter U is defined with the
894 // The parametrization range for the parameter V is
895 // ]-infinite, + infinite[
896 // The position of the curve gives the origin for the parameter V.
899 Handle(IGESData_IGESEntity) res;
901 if (start.IsNull()) {
905 Handle(IGESGeom_TabulatedCylinder) Surf = new IGESGeom_TabulatedCylinder;
906 Standard_Real U1 = Udeb;
907 Standard_Real U2 = Ufin;
908 Standard_Real V1 = Vdeb;
909 Standard_Real V2 = Vfin;
910 if (Precision::IsNegativeInfinite(Vdeb)) V1 = -Precision::Infinite();
911 if (Precision::IsPositiveInfinite(Vfin)) V2 = Precision::Infinite();
913 // added by skl 18.07.2005 for OCC9490
914 Standard_Real UF,UL,VF,VL;
915 start->Bounds(UF,UL,VF,VL);
919 Handle(Geom_Curve) TheCurve = start->BasisCurve();
921 //dans IGES l'origine de la generatrice est identique a l'origine
922 //de la directrice , il faut translater la courbe si les deux
923 //points ne sont pas confondus dans Geom et donc la copier !!!!!!!
924 gp_Pnt TheEnd = start->Value(U1,V2);
925 Standard_Real Xe, Ye, Ze;
926 TheEnd.Coord(Xe, Ye, Ze);
927 gp_XYZ End = gp_XYZ (Xe/GetUnit(), Ye/GetUnit(), Ze/GetUnit());
929 GeomToIGES_GeomCurve GC(*this);
930 // commented by skl 18.07.2005 for OCC9490
931 Handle(Geom_Curve) CopyCurve;
932 if ( Abs(V1) > Precision::Confusion()) {
933 CopyCurve = Handle(Geom_Curve)::DownCast
934 (TheCurve->Translated (start->Value(U1,0.), start->Value(U1,V1)));
937 CopyCurve = TheCurve;
939 //Handle(IGESData_IGESEntity) Directrix = GC.TransferCurve( CopyCurve, V1, V2);
940 Handle(IGESData_IGESEntity) Directrix = GC.TransferCurve( CopyCurve, U1, U2);
941 //Handle(IGESData_IGESEntity) Directrix = GC.TransferCurve( TheCurve, U1, U2);
942 //gp_Pnt gen1 = start->Value(U1,V1);
943 //TheLength = gen1.Distance(TheEnd);
945 Surf->Init (Directrix, End);
951 //=============================================================================
952 // Transfer des Entites SurfaceOfRevolution de Geom vers IGES
954 //=============================================================================
956 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
957 ( const Handle(Geom_SurfaceOfRevolution)& start, const Standard_Real Udeb,
958 const Standard_Real Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
960 // The surface is obtained by rotating a curve a complete revolution
961 // about an axis. The curve and the axis must be in the same plane.
962 // For a complete surface of revolution the parametric range is
964 // The parametric range for V is defined with the revolved curve.
965 // The origin of the U parametrization is given by the position
966 // of the revolved curve (reference). The direction of the revolution
967 // axis defines the positive sense of rotation (trigonometric sense)
968 // corresponding to the increasing of the parametric value U.
969 // The derivatives are always defined for the u direction.
970 // For the v direction the definition of the derivatives depends on
971 // the degree of continuity of the referenced curve.
973 Handle(IGESData_IGESEntity) res;
975 if (start.IsNull()) {
979 Handle(IGESGeom_SurfaceOfRevolution) Surf = new IGESGeom_SurfaceOfRevolution;
980 Standard_Real U1 = Udeb;
981 Standard_Real U2 = Ufin;
982 Standard_Real V1 = Vdeb;
983 Standard_Real V2 = Vfin;
984 if (Precision::IsNegativeInfinite(Vdeb)) V1 = -Precision::Infinite();
985 if (Precision::IsPositiveInfinite(Vfin)) V2 = Precision::Infinite();
987 // creation de la generatrice : Generatrix
988 Handle(Geom_Curve) Curve = start->BasisCurve();
989 GeomToIGES_GeomCurve GC(*this);
990 Handle(IGESData_IGESEntity) Generatrix = GC.TransferCurve( Curve, V1, V2);
991 //pdn BUC184: decoding a trimmed curve
992 while( Curve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
993 Handle(Geom_TrimmedCurve) aTrCurve = Handle(Geom_TrimmedCurve)::
995 Curve = aTrCurve->BasisCurve();
998 if ( Curve->IsKind(STANDARD_TYPE(Geom_Line))) {
999 DeclareAndCast(Geom_Line, Line, Curve);
1000 gp_Pnt gen1 = Line->Value(V1);
1001 gp_Pnt gen2 = Line->Value(V2);
1002 TheLength = gen1.Distance(gen2);
1005 // creation de l`axe : Axis .
1006 Handle(IGESGeom_Line) Axis = new IGESGeom_Line;
1007 gp_Ax1 Axe = start->Axis();
1008 Standard_Real X1,Y1,Z1,X2,Y2,Z2;
1009 Axe.Location().Coord(X1,Y1,Z1);
1010 Axe.Direction().Coord(X2,Y2,Z2);
1012 //#30 rln 19.10.98 IGES axis = reversed CAS.CADE axis
1013 //Axis->Init(gp_XYZ(X1/GetUnit(),Y1/GetUnit(),Z1/GetUnit()),
1014 // gp_XYZ(X2/GetUnit(),Y2/GetUnit(),Z2/GetUnit()));
1015 //#36 rln 27.10.98 BUC60328 face 7
1016 Axis->Init(gp_XYZ(X1/GetUnit(),Y1/GetUnit(),Z1/GetUnit()),
1017 gp_XYZ( (X1 - X2) / GetUnit(), (Y1 - Y2) / GetUnit(), (Z1 - Z2) / GetUnit()));
1019 Surf->Init (Axis, Generatrix, 2 * M_PI - U2, 2 * M_PI - U1);
1026 //=============================================================================
1027 // Transfer des Entites OffsetSurface de Geom vers IGES
1029 //=============================================================================
1031 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface
1032 ( const Handle(Geom_OffsetSurface)& start, const Standard_Real Udeb, const Standard_Real
1033 Ufin, const Standard_Real Vdeb, const Standard_Real Vfin)
1035 // An offset surface is a surface at constant distance
1036 // (Offset) from a basis surface. The distance may be positive
1037 // or negative to the preferred side of the surface.
1038 // The positive side is defined by the cross product D1u ^ D1v
1039 // where D1u and D1v are the tangent vectors of the basis
1040 // surface in the U and V parametric directions. The previous
1041 // cross product defines the normal direction to the basis
1044 Handle(IGESData_IGESEntity) res;
1045 if (start.IsNull()) {
1049 Handle(IGESGeom_OffsetSurface) Surf = new IGESGeom_OffsetSurface;
1050 Handle(Geom_Surface) TheSurf = start->BasisSurface();
1051 Standard_Real U1, U2, V1, V2 , Um, Vm;
1052 start->Bounds (U1, U2, V1, V2);
1053 Um = (U1 + U2 ) /2.;
1054 Vm = (V1 + V2 ) /2.;
1055 Handle(IGESData_IGESEntity) Surface = TransferSurface
1056 (TheSurf, Udeb, Ufin, Vdeb, Vfin);
1057 Standard_Real Distance = start->Offset()/GetUnit();
1058 GeomLProp_SLProps Prop = GeomLProp_SLProps
1059 (TheSurf, Um, Vm, 1, Precision::Confusion());
1060 gp_Dir Dir = Prop.Normal();
1061 Standard_Real Xd, Yd, Zd;
1062 Dir.Coord(Xd, Yd, Zd);
1063 gp_XYZ Indicator = gp_XYZ(Xd/GetUnit(), Yd/GetUnit(), Zd/GetUnit());
1065 Surf-> Init (Indicator, Distance, Surface);
1072 //=============================================================================
1073 // Transfer des Entites Plane de Geom vers IGESSolid
1074 // TransferPlaneSurface
1075 //=============================================================================
1077 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferPlaneSurface(const Handle(Geom_Plane)& start,
1078 const Standard_Real /*Udeb*/,
1079 const Standard_Real /*Ufin*/,
1080 const Standard_Real /*Vdeb*/,
1081 const Standard_Real /*Vfin*/)
1083 // The parametrization range is U, V ]- infinite, + infinite[
1084 // The local coordinate system of the plane is defined with
1085 // an axis placement two axis.
1087 Handle(IGESData_IGESEntity) res;
1089 if (start.IsNull()) {
1093 Handle(IGESSolid_PlaneSurface) Plsurf = new IGESSolid_PlaneSurface;
1094 GeomToIGES_GeomPoint GP(*this);
1095 GeomToIGES_GeomVector GV(*this);
1097 gp_Pln Pln = start->Pln();
1099 Handle(Geom_CartesianPoint) mypoint = new Geom_CartesianPoint(Pln.Location());
1100 Handle(IGESGeom_Point) aLocation = GP.TransferPoint(mypoint);
1102 gp_Ax1 Axe = Pln.Axis();
1103 Handle(Geom_Direction) mydir = new Geom_Direction(Axe.Direction());
1104 Handle(IGESGeom_Direction) aNormal = GV.TransferVector(mydir);
1106 gp_Ax1 XAxe = Pln.XAxis();
1107 Handle(Geom_Direction) rdir = new Geom_Direction(XAxe.Direction());
1108 Handle(IGESGeom_Direction) refdir = GV.TransferVector(rdir);
1110 Plsurf->Init (aLocation, aNormal, refdir);
1116 //=======================================================================
1117 //function : TransferCylindricaSurface
1119 //=======================================================================
1121 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferCylindricalSurface(const Handle(Geom_CylindricalSurface)& start,
1122 const Standard_Real /*Udeb*/,
1123 const Standard_Real /*Ufin*/,
1124 const Standard_Real /*Vdeb*/,
1125 const Standard_Real /*Vfin*/)
1128 Handle(IGESData_IGESEntity) res;
1130 if (start.IsNull()) {
1134 Handle(IGESSolid_CylindricalSurface) CylSurf = new IGESSolid_CylindricalSurface;
1135 GeomToIGES_GeomPoint GP(*this);
1136 GeomToIGES_GeomVector GV(*this);
1138 gp_Cylinder Cyl = start->Cylinder();
1140 Handle(Geom_CartesianPoint) mypoint = new Geom_CartesianPoint(Cyl.Location());
1141 Handle(IGESGeom_Point) aLocation = GP.TransferPoint(mypoint);
1143 gp_Ax1 Axe = Cyl.Axis();
1144 Handle(Geom_Direction) mydir = new Geom_Direction(Axe.Direction());
1145 Handle(IGESGeom_Direction) Axis = GV.TransferVector(mydir);
1147 gp_Ax1 XAxe = Cyl.XAxis();
1148 Handle(Geom_Direction) rdir = new Geom_Direction(XAxe.Direction());
1149 Handle(IGESGeom_Direction) refdir = GV.TransferVector(rdir);
1151 Standard_Real radius = Cyl.Radius();
1153 CylSurf->Init (aLocation, Axis, radius, refdir);
1159 //=======================================================================
1160 //function : TransferConicalSurface
1162 //=======================================================================
1164 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferConicalSurface(const Handle(Geom_ConicalSurface)& start,
1165 const Standard_Real /*Udeb*/,
1166 const Standard_Real /*Ufin*/,
1167 const Standard_Real /*Vdeb*/,
1168 const Standard_Real /*Vfin*/)
1171 Handle(IGESData_IGESEntity) res;
1173 if (start.IsNull()) {
1177 Handle(IGESSolid_ConicalSurface) ConSurf = new IGESSolid_ConicalSurface;
1178 GeomToIGES_GeomPoint GP(*this);
1179 GeomToIGES_GeomVector GV(*this);
1181 gp_Cone Con = start->Cone();
1182 Standard_Real radius = Con.RefRadius();
1183 Standard_Real angle = Con.SemiAngle();
1184 gp_Ax1 Axe = Con.Axis();
1185 gp_Ax1 XAxe = Con.XAxis();
1186 gp_Dir XDir = XAxe.Direction();
1188 Handle(Geom_CartesianPoint) mypoint = new Geom_CartesianPoint(Con.Location());
1190 gp_Pnt pnt = mypoint->Pnt();
1191 mypoint->SetPnt(Con.Apex().XYZ()*2-pnt.XYZ());
1195 Handle(IGESGeom_Point) aLocation = GP.TransferPoint(mypoint);
1197 Handle(Geom_Direction) mydir = new Geom_Direction(Axe.Direction());
1198 Handle(IGESGeom_Direction) Axis = GV.TransferVector(mydir);
1200 Handle(Geom_Direction) rdir = new Geom_Direction(XDir);//XAxe.Direction());
1201 Handle(IGESGeom_Direction) refdir = GV.TransferVector(rdir);
1203 ConSurf->Init (aLocation, Axis, radius, angle*180./M_PI, refdir);
1209 //=======================================================================
1210 //function : TransferSphericalSurface
1212 //=======================================================================
1214 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSphericalSurface(const Handle(Geom_SphericalSurface)& start,
1215 const Standard_Real /*Udeb*/,
1216 const Standard_Real /*Ufin*/,
1217 const Standard_Real /*Vdeb*/,
1218 const Standard_Real /*Vfin*/)
1221 Handle(IGESData_IGESEntity) res;
1223 if (start.IsNull()) {
1227 Handle(IGESSolid_SphericalSurface) SphSurf = new IGESSolid_SphericalSurface;
1228 GeomToIGES_GeomPoint GP(*this);
1229 GeomToIGES_GeomVector GV(*this);
1231 gp_Sphere Sph = start->Sphere();
1233 Handle(Geom_CartesianPoint) mypoint = new Geom_CartesianPoint(Sph.Location());
1234 Handle(IGESGeom_Point) aLocation = GP.TransferPoint(mypoint);
1236 gp_Ax1 Axe = Sph.Position().Axis();
1237 Handle(Geom_Direction) mydir = new Geom_Direction(Axe.Direction());
1238 Handle(IGESGeom_Direction) Axis = GV.TransferVector(mydir);
1240 gp_Ax1 XAxe = Sph.XAxis();
1241 Handle(Geom_Direction) rdir = new Geom_Direction(XAxe.Direction());
1242 Handle(IGESGeom_Direction) refdir = GV.TransferVector(rdir);
1244 Standard_Real radius = Sph.Radius();
1246 SphSurf->Init (aLocation, radius, Axis, refdir);
1251 Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferToroidalSurface(const Handle(Geom_ToroidalSurface)& start,
1252 const Standard_Real /*Udeb*/,
1253 const Standard_Real /*Ufin*/,
1254 const Standard_Real /*Vdeb*/,
1255 const Standard_Real /*Vfin*/)
1258 Handle(IGESData_IGESEntity) res;
1260 if (start.IsNull()) {
1264 Handle(IGESSolid_ToroidalSurface) TorSurf = new IGESSolid_ToroidalSurface;
1265 GeomToIGES_GeomPoint GP(*this);
1266 GeomToIGES_GeomVector GV(*this);
1268 gp_Torus Tor = start->Torus();
1270 Handle(Geom_CartesianPoint) mypoint = new Geom_CartesianPoint(Tor.Location());
1271 Handle(IGESGeom_Point) aLocation = GP.TransferPoint(mypoint);
1273 gp_Ax1 Axe = Tor.Axis();
1274 Handle(Geom_Direction) mydir = new Geom_Direction(Axe.Direction());
1275 Handle(IGESGeom_Direction) Axis = GV.TransferVector(mydir);
1277 gp_Ax1 XAxe = Tor.XAxis();
1278 Handle(Geom_Direction) rdir = new Geom_Direction(XAxe.Direction());
1279 Handle(IGESGeom_Direction) refdir = GV.TransferVector(rdir);
1281 Standard_Real major = Tor.MajorRadius();
1282 Standard_Real minor = Tor.MinorRadius();
1284 TorSurf->Init (aLocation, Axis, major, minor, refdir);
1290 //=======================================================================
1293 //=======================================================================
1294 Standard_Real GeomToIGES_GeomSurface::Length() const
1295 { return TheLength; }
1297 //=======================================================================
1298 //function : GetBRepMode
1300 //=======================================================================
1302 Standard_Boolean GeomToIGES_GeomSurface::GetBRepMode() const
1307 //=======================================================================
1308 //function : SetBRepMode
1310 //=======================================================================
1312 void GeomToIGES_GeomSurface::SetBRepMode(const Standard_Boolean flag)
1317 //=======================================================================
1318 //function : GetAnalyticMode
1320 //=======================================================================
1322 Standard_Boolean GeomToIGES_GeomSurface::GetAnalyticMode() const
1327 void GeomToIGES_GeomSurface::SetAnalyticMode(const Standard_Boolean flag)