mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
26
src/GeomToIGES/GeomToIGES.cdl
Executable file
26
src/GeomToIGES/GeomToIGES.cdl
Executable file
@@ -0,0 +1,26 @@
|
||||
-- File: GeomToIGES.cdl
|
||||
-- Created: Wed Nov 16 11:35:32 1994
|
||||
-- Author: Marie Jose MARTZ
|
||||
-- <mjm@minox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
package GeomToIGES
|
||||
|
||||
--- Purpose: Creation des entites geometriques de IGES
|
||||
-- a partir des entites de Geom .
|
||||
|
||||
uses Interface, IGESData, IGESBasic, IGESConvGeom, IGESGeom, IGESSolid, IGESToBRep,
|
||||
gp, Geom, Geom2d, GeomConvert, GeomLProp, TColStd, TopoDS, TopTools,
|
||||
Transfer, TransferBRep, BRep, TCollection, ElCLib
|
||||
|
||||
is
|
||||
|
||||
-- classes du package
|
||||
|
||||
class GeomCurve;
|
||||
class GeomEntity;
|
||||
class GeomPoint;
|
||||
class GeomSurface;
|
||||
class GeomVector;
|
||||
|
||||
end GeomToIGES;
|
142
src/GeomToIGES/GeomToIGES_GeomCurve.cdl
Executable file
142
src/GeomToIGES/GeomToIGES_GeomCurve.cdl
Executable file
@@ -0,0 +1,142 @@
|
||||
-- File: GeomToIGES_GeomCurve.cdl
|
||||
-- Created: Thu Nov 17 10:48:37 1994
|
||||
-- Author: Marie Jose MARTZ
|
||||
-- <mjm@minox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
class GeomCurve from GeomToIGES inherits GeomEntity from GeomToIGES
|
||||
|
||||
---Purpose: This class implements the transfer of the Curve Entity from Geom
|
||||
-- To IGES. These can be :
|
||||
-- Curve
|
||||
-- . BoundedCurve
|
||||
-- * BSplineCurve
|
||||
-- * BezierCurve
|
||||
-- * TrimmedCurve
|
||||
-- . Conic
|
||||
-- * Circle
|
||||
-- * Ellipse
|
||||
-- * Hyperbloa
|
||||
-- * Line
|
||||
-- * Parabola
|
||||
-- . OffsetCurve
|
||||
|
||||
|
||||
uses
|
||||
|
||||
Curve from Geom,
|
||||
BoundedCurve from Geom,
|
||||
BSplineCurve from Geom,
|
||||
BezierCurve from Geom,
|
||||
TrimmedCurve from Geom,
|
||||
Conic from Geom,
|
||||
Circle from Geom,
|
||||
Ellipse from Geom,
|
||||
Hyperbola from Geom,
|
||||
Line from Geom,
|
||||
Parabola from Geom,
|
||||
OffsetCurve from Geom,
|
||||
IGESEntity from IGESData,
|
||||
GeomEntity from GeomToIGES
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create returns GeomCurve from GeomToIGES;
|
||||
|
||||
|
||||
Create(GE : GeomEntity from GeomToIGES)
|
||||
returns GeomCurve from GeomToIGES;
|
||||
---Purpose : Creates a tool GeomCurve ready to run and sets its
|
||||
-- fields as GE's.
|
||||
|
||||
TransferCurve (me : in out;
|
||||
start : Curve from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
---Purpose : Transfert a GeometryEntity which answer True to the
|
||||
-- member : BRepToIGES::IsGeomCurve(Geometry). If this
|
||||
-- Entity could not be converted, this member returns a NullEntity.
|
||||
|
||||
|
||||
TransferCurve (me : in out;
|
||||
start : BoundedCurve from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferCurve (me : in out;
|
||||
start : BSplineCurve from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferCurve (me : in out;
|
||||
start : BezierCurve from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferCurve (me : in out;
|
||||
start : TrimmedCurve from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferCurve (me : in out;
|
||||
start : Conic from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferCurve (me : in out;
|
||||
start : Circle from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferCurve (me : in out;
|
||||
start : Ellipse from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferCurve (me : in out;
|
||||
start : Hyperbola from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferCurve (me : in out;
|
||||
start : Line from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferCurve (me : in out;
|
||||
start : Parabola from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferCurve (me : in out;
|
||||
start : OffsetCurve from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
end GeomCurve;
|
||||
|
||||
|
844
src/GeomToIGES/GeomToIGES_GeomCurve.cxx
Executable file
844
src/GeomToIGES/GeomToIGES_GeomCurve.cxx
Executable file
@@ -0,0 +1,844 @@
|
||||
// File: GeomToIGES_GeomCurve.cxx
|
||||
|
||||
// modif du 04/03/96 mjm
|
||||
// modif dans IGESConvGeom_GeomBuilder
|
||||
//#53 rln 24.12.98 CCI60005
|
||||
//#59 rln 29.12.98 PRO17015
|
||||
//%11 pdn 12.01.99 CTS22023: writing offset curves and detecting planar curves
|
||||
//%12 pdn 13.01.99: CTS22023: cutting bspline curves (for Euclid3)
|
||||
//:l7 abv 13.01.99: CTS22021: using QuasiAngular parametrisation for circles (more precise)
|
||||
//:l5 abv 14.01.99: CTS22022-1: protection against exceptions in Segment()
|
||||
//:q3 abv 17.03.99: PRO17828: using GeomConvert_ApproxCurve for converting circle to bspline
|
||||
|
||||
#include <GeomToIGES_GeomCurve.ixx>
|
||||
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_BoundedCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <Geom_OffsetCurve.hxx>
|
||||
#include <Geom_Conic.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_Ellipse.hxx>
|
||||
#include <Geom_Hyperbola.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_Parabola.hxx>
|
||||
|
||||
#include <GeomConvert.hxx>
|
||||
|
||||
#include <gp.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Ax22d.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Elips.hxx>
|
||||
#include <gp_Elips2d.hxx>
|
||||
#include <gp_Hypr.hxx>
|
||||
#include <gp_Hypr2d.hxx>
|
||||
#include <gp_Parab.hxx>
|
||||
#include <gp_Parab2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_XY.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
|
||||
#include <IGESConvGeom_GeomBuilder.hxx>
|
||||
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESData_ToolLocation.hxx>
|
||||
|
||||
#include <IGESGeom_BSplineCurve.hxx>
|
||||
#include <IGESGeom_CircularArc.hxx>
|
||||
#include <IGESGeom_CompositeCurve.hxx>
|
||||
#include <IGESGeom_ConicArc.hxx>
|
||||
#include <IGESGeom_CopiousData.hxx>
|
||||
#include <IGESGeom_CurveOnSurface.hxx>
|
||||
#include <IGESGeom_Line.hxx>
|
||||
#include <IGESGeom_Point.hxx>
|
||||
#include <IGESGeom_OffsetCurve.hxx>
|
||||
#include <IGESGeom_TransformationMatrix.hxx>
|
||||
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <TColgp_HArray1OfXYZ.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <BSplCLib.hxx>
|
||||
#include <GeomConvert_ApproxCurve.hxx>
|
||||
|
||||
// Pour toutes les courbes infinies soit
|
||||
// Udeb <= -Precision::Infinite() et/ou Ufin >= Precision::Infinite()
|
||||
// on choisit arbitrairement de les construire entre
|
||||
// Udeb = -Precision::Infinite() et Ufin = Precision::Infinite()
|
||||
|
||||
//=============================================================================
|
||||
// GeomToIGES_GeomCurve
|
||||
//=============================================================================
|
||||
|
||||
GeomToIGES_GeomCurve::GeomToIGES_GeomCurve()
|
||||
:GeomToIGES_GeomEntity()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// GeomToIGES_GeomCurve
|
||||
//=============================================================================
|
||||
|
||||
GeomToIGES_GeomCurve::GeomToIGES_GeomCurve
|
||||
(const GeomToIGES_GeomEntity& GE)
|
||||
:GeomToIGES_GeomEntity(GE)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Transfer des Entites Curve de Geom vers IGES
|
||||
// TransferCurve
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
|
||||
(const Handle(Geom_Curve)& start, const Standard_Real Udeb,
|
||||
const Standard_Real Ufin)
|
||||
{
|
||||
Handle(IGESData_IGESEntity) res;
|
||||
if (start.IsNull()) {
|
||||
return res;
|
||||
}
|
||||
|
||||
if (start->IsKind(STANDARD_TYPE(Geom_BoundedCurve))) {
|
||||
DeclareAndCast(Geom_BoundedCurve, Bounded, start);
|
||||
res = TransferCurve(Bounded, Udeb, Ufin);
|
||||
}
|
||||
else if (start->IsKind(STANDARD_TYPE(Geom_Conic))) {
|
||||
DeclareAndCast(Geom_Conic, Conic, start);
|
||||
res = TransferCurve(Conic, Udeb, Ufin);
|
||||
}
|
||||
else if ( start->IsKind(STANDARD_TYPE(Geom_OffsetCurve))) {
|
||||
DeclareAndCast(Geom_OffsetCurve, OffsetC, start);
|
||||
res = TransferCurve(OffsetC, Udeb, Ufin);
|
||||
}
|
||||
else if ( start->IsKind(STANDARD_TYPE(Geom_Line))) {
|
||||
DeclareAndCast(Geom_Line, Line, start);
|
||||
res = TransferCurve(Line, Udeb, Ufin);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Transfer des Entites BoundedCurve de Geom vers IGES
|
||||
// TransferCurve
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
|
||||
(const Handle(Geom_BoundedCurve)& start, const Standard_Real Udeb,
|
||||
const Standard_Real Ufin)
|
||||
{
|
||||
Handle(IGESData_IGESEntity) res;
|
||||
if (start.IsNull()) {
|
||||
return res;
|
||||
}
|
||||
|
||||
if (start->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
|
||||
DeclareAndCast(Geom_BSplineCurve, Bspline, start);
|
||||
res = TransferCurve(Bspline, Udeb, Ufin);
|
||||
}
|
||||
else if (start->IsKind(STANDARD_TYPE(Geom_BezierCurve))) {
|
||||
DeclareAndCast(Geom_BezierCurve, Bezier, start);
|
||||
res = TransferCurve(Bezier, Udeb, Ufin);
|
||||
}
|
||||
else if ( start->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
DeclareAndCast(Geom_TrimmedCurve, Trimmed, start);
|
||||
res = TransferCurve(Trimmed, Udeb, Ufin);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//%11 pdn 12.01.98
|
||||
//=============================================================================
|
||||
// Detects if curve lies in some plane and returns normal
|
||||
// IsPlanar
|
||||
//=============================================================================
|
||||
static gp_XYZ GetAnyNormal ( gp_XYZ orig )
|
||||
{
|
||||
gp_XYZ Norm;
|
||||
if ( Abs ( orig.Z() ) < Precision::Confusion() )
|
||||
Norm.SetCoord ( 0, 0, 1 );
|
||||
else {
|
||||
Norm.SetCoord ( orig.Z(), 0, -orig.X() );
|
||||
Standard_Real nrm = Norm.Modulus();
|
||||
if ( nrm < Precision::Confusion() ) Norm.SetCoord ( 0, 0, 1 );
|
||||
else Norm = Norm / nrm;
|
||||
}
|
||||
return Norm;
|
||||
}
|
||||
|
||||
//%11 pdn 12.01.98
|
||||
//=============================================================================
|
||||
// Detects if curve lies in some plane and returns normal
|
||||
// IsPlanar
|
||||
//=============================================================================
|
||||
static Standard_Boolean ArePolesPlanar (const TColgp_Array1OfPnt& Poles,
|
||||
gp_XYZ& Normal)
|
||||
{
|
||||
if(Poles.Length()<3) {
|
||||
Normal = GetAnyNormal(Poles(1).XYZ()-Poles(2).XYZ());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Normal = Poles(Poles.Length()).XYZ() ^ Poles(1).XYZ();
|
||||
Standard_Integer i; // svv Jan 10 2000 : porting on DEC
|
||||
for ( i = 1; i < Poles.Length(); i++)
|
||||
Normal += Poles ( i ).XYZ() ^ Poles ( i + 1 ).XYZ();
|
||||
|
||||
Standard_Real tol = Precision::Confusion();
|
||||
Standard_Real nrm = Normal.Modulus();
|
||||
if ( nrm < tol ) {
|
||||
Normal.SetCoord ( 0, 0, 1 );
|
||||
return Standard_False;
|
||||
}
|
||||
Normal = Normal / nrm;
|
||||
|
||||
Standard_Real scl = Poles(1).XYZ() * Normal;
|
||||
for ( i = 2; i <= Poles.Length(); i++ )
|
||||
if ( Abs ( Poles(i).XYZ() * Normal - scl ) > tol ) return Standard_False;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//%11 pdn 12.01.98
|
||||
//=============================================================================
|
||||
// Detects if curve lies in some plane and returns normal
|
||||
// IsPlanar
|
||||
//=============================================================================
|
||||
static Standard_Boolean IsPlanar(const Handle(Geom_Curve)& curve,
|
||||
gp_XYZ& Normal)
|
||||
{
|
||||
Normal.SetCoord(0,0,0);
|
||||
if ( curve->IsKind(STANDARD_TYPE(Geom_Line))) {
|
||||
DeclareAndCast(Geom_Line, Line, curve);
|
||||
Normal = GetAnyNormal(Line->Position().Direction().XYZ());
|
||||
return Standard_True;
|
||||
}
|
||||
if ( curve->IsKind(STANDARD_TYPE(Geom_Conic))) {
|
||||
DeclareAndCast(Geom_Conic, Conic, curve);
|
||||
Normal = Conic->Axis().Direction().XYZ();
|
||||
return Standard_True;
|
||||
}
|
||||
if ( curve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
DeclareAndCast(Geom_TrimmedCurve, Trimmed, curve);
|
||||
return IsPlanar(Trimmed->BasisCurve(),Normal);
|
||||
}
|
||||
if ( curve->IsKind(STANDARD_TYPE(Geom_OffsetCurve))) {
|
||||
DeclareAndCast(Geom_OffsetCurve, OffsetC, curve);
|
||||
return IsPlanar(OffsetC->BasisCurve(),Normal);
|
||||
}
|
||||
if ( curve->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
|
||||
DeclareAndCast(Geom_BSplineCurve, BSpline, curve);
|
||||
TColgp_Array1OfPnt Poles(1,BSpline->NbPoles());
|
||||
BSpline->Poles(Poles);
|
||||
return ArePolesPlanar(Poles,Normal);
|
||||
}
|
||||
if ( curve->IsKind(STANDARD_TYPE(Geom_BezierCurve))) {
|
||||
DeclareAndCast(Geom_BezierCurve, Bezier, curve);
|
||||
TColgp_Array1OfPnt Poles(1,Bezier->NbPoles());
|
||||
Bezier->Poles(Poles);
|
||||
return ArePolesPlanar(Poles,Normal);
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Transfer des Entites BSplineCurve de Geom vers IGES
|
||||
// TransferCurve
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
|
||||
(const Handle(Geom_BSplineCurve)& start, const Standard_Real Udeb,
|
||||
const Standard_Real Ufin)
|
||||
{
|
||||
Handle(IGESData_IGESEntity) res;
|
||||
if (start.IsNull()) {
|
||||
return res;
|
||||
}
|
||||
|
||||
Handle(Geom_BSplineCurve) mycurve;
|
||||
Standard_Boolean IPlan = Standard_False;
|
||||
gp_XYZ Norm = gp_XYZ(0.,0.,1.);
|
||||
|
||||
// Si la courbe est periodique, on passe par une fonction pour recuperer tous
|
||||
// les parametres necessaires a l`ecriture IGES.
|
||||
|
||||
Standard_Boolean IPerio = start->IsPeriodic();
|
||||
|
||||
if (IPerio) {
|
||||
mycurve = Handle(Geom_BSplineCurve)::DownCast(start->Copy());
|
||||
mycurve->SetNotPeriodic();
|
||||
}
|
||||
else {
|
||||
mycurve = start;
|
||||
}
|
||||
|
||||
Standard_Real Umin = Udeb;
|
||||
Standard_Real Umax = Ufin;
|
||||
if (Precision::IsNegativeInfinite(Udeb)) Umin = -Precision::Infinite();
|
||||
if (Precision::IsPositiveInfinite(Ufin)) Umax = Precision::Infinite();
|
||||
|
||||
//%12 pdn: cut curve for E3
|
||||
Standard_Real First = mycurve->FirstParameter();
|
||||
Standard_Real Last = mycurve->LastParameter();
|
||||
//:l5 abv 14 Jan 99: protect against exceptions in Segment()
|
||||
if ( Umin - First < Precision::PConfusion() ) Umin = First;
|
||||
if ( Last - Umax < Precision::PConfusion() ) Umax = Last;
|
||||
if ( Umin - First > Precision::PConfusion() || Last - Umax > Precision::PConfusion() ) {
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
Handle(Geom_BSplineCurve) bspl = Handle(Geom_BSplineCurve)::DownCast ( mycurve->Copy() );
|
||||
if ( ! bspl.IsNull() ) {
|
||||
bspl->Segment ( Umin, Umax );
|
||||
mycurve = bspl;
|
||||
}
|
||||
}
|
||||
catch ( Standard_Failure ) {
|
||||
#ifdef DEB
|
||||
cout << "Warning: GeomToIGES_GeomCurve: can't trim bspline" << endl;
|
||||
cout << "Warning: Exception in Segment(): " ;
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean IClos = mycurve->IsClosed();
|
||||
// Standard_Boolean IRatio = mycurve->IsRational();
|
||||
Standard_Boolean IPolyn = !(mycurve->IsRational());
|
||||
//Standard_Boolean IPerio = mycurve->IsPeriodic();
|
||||
Standard_Integer Deg = mycurve->Degree();
|
||||
Standard_Integer Nbpoles = mycurve->NbPoles();
|
||||
// Standard_Integer Nbknots = mycurve->NbKnots();
|
||||
Standard_Integer Index = Nbpoles -1;
|
||||
|
||||
|
||||
// Sequence des Knots de [-Deg, Index+1] dans IGESGeom.
|
||||
// et de [1, Nbpoles+Deg+1] dans Geom
|
||||
Standard_Integer Knotindex;
|
||||
Standard_Real rtampon;
|
||||
TColStd_Array1OfReal K(1, Nbpoles+Deg+1);
|
||||
mycurve->KnotSequence(K);
|
||||
Standard_Integer itampon = -Deg;
|
||||
Handle(TColStd_HArray1OfReal) Knots = new TColStd_HArray1OfReal(-Deg,Index+1);
|
||||
for ( Knotindex=K.Lower(); Knotindex<=K.Upper(); Knotindex++) {
|
||||
rtampon = K.Value(Knotindex);
|
||||
Knots->SetValue(itampon, rtampon);
|
||||
itampon++;
|
||||
}
|
||||
|
||||
|
||||
// Tableau Weights de [0,Index]
|
||||
TColStd_Array1OfReal W(1, Nbpoles);
|
||||
mycurve->Weights(W);
|
||||
itampon = 0;
|
||||
Handle(TColStd_HArray1OfReal) Weights = new TColStd_HArray1OfReal(0,Index);
|
||||
for ( Knotindex=W.Lower(); Knotindex<=W.Upper(); Knotindex++) {
|
||||
rtampon = W.Value(Knotindex);
|
||||
Weights->SetValue(itampon, rtampon);
|
||||
itampon++;
|
||||
}
|
||||
|
||||
|
||||
// Tableau Poles de [0,Index]
|
||||
TColgp_Array1OfPnt P(1, Nbpoles);
|
||||
mycurve->Poles(P);
|
||||
Standard_Integer Poleindex;
|
||||
itampon = 0;
|
||||
Standard_Real Xpt, Ypt, Zpt;
|
||||
Handle(TColgp_HArray1OfXYZ) Poles = new TColgp_HArray1OfXYZ(0,Index);
|
||||
for ( Poleindex=P.Lower(); Poleindex<=P.Upper(); Poleindex++) {
|
||||
gp_Pnt ptampon = P.Value(Poleindex);
|
||||
ptampon.Coord(Xpt, Ypt, Zpt);
|
||||
gp_XYZ xyztampon = gp_XYZ (Xpt/GetUnit(), Ypt/GetUnit(), Zpt/GetUnit());
|
||||
Poles->SetValue(itampon, xyztampon);
|
||||
itampon++;
|
||||
}
|
||||
|
||||
// modif mjm du 9/10/97 : mise en place d'une protection.
|
||||
//%12 Standard_Real First = mycurve->FirstParameter();
|
||||
//%12 Standard_Real Last = mycurve->LastParameter();
|
||||
//:l5 if (First > Umin) Umin = First;
|
||||
//:l5 if (Last < Umax) Umax = Last;
|
||||
Handle(IGESGeom_BSplineCurve) BSplineC = new IGESGeom_BSplineCurve;
|
||||
//%11 pdn 13.01.98 computing planar flag and normal
|
||||
IPlan = IsPlanar(start,Norm);
|
||||
if ( Norm.Z() <0 ) Norm.Reverse();
|
||||
BSplineC->Init
|
||||
(Index, Deg, IPlan, IClos, IPolyn, IPerio, Knots, Weights, Poles,
|
||||
Umin, Umax, Norm);
|
||||
|
||||
res = BSplineC;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Transfer des Entites BezierCurve de Geom vers IGES
|
||||
// TransferCurve
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
|
||||
(const Handle(Geom_BezierCurve)& start, const Standard_Real Udeb,
|
||||
const Standard_Real Ufin)
|
||||
{
|
||||
Handle(IGESData_IGESEntity) res;
|
||||
if (start.IsNull()) {
|
||||
return res;
|
||||
}
|
||||
|
||||
Handle(Geom_TrimmedCurve) mycurve3d =
|
||||
new Geom_TrimmedCurve(start, Udeb, Ufin);
|
||||
Handle(Geom_BSplineCurve) Bspline = GeomConvert::CurveToBSplineCurve(mycurve3d,
|
||||
Convert_RationalC1);//#28 rln 19.10.98 UKI60155
|
||||
Standard_Real First = Bspline->FirstParameter();
|
||||
Standard_Real Last = Bspline->LastParameter();
|
||||
res = TransferCurve(Bspline, First, Last);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Transfer des Entites TrimmedCurve de Geom vers IGES
|
||||
// TransferCurve
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
|
||||
(const Handle(Geom_TrimmedCurve)& start, const Standard_Real Udeb,
|
||||
const Standard_Real Ufin)
|
||||
{
|
||||
Handle(IGESData_IGESEntity) res;
|
||||
if (start.IsNull()) {
|
||||
return res;
|
||||
}
|
||||
|
||||
Handle(Geom_Curve) st = start->BasisCurve();
|
||||
if (st->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
DeclareAndCast(Geom_TrimmedCurve, Trimmed, st);
|
||||
Handle(Geom_Curve) st1 = Trimmed->BasisCurve();
|
||||
res = TransferCurve(st1, Udeb, Ufin);
|
||||
}
|
||||
|
||||
res = TransferCurve(st, Udeb, Ufin);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Transfer des Entites Conic de Geom vers IGES
|
||||
// TransferCurve
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
|
||||
(const Handle(Geom_Conic)& start, const Standard_Real Udeb,
|
||||
const Standard_Real Ufin)
|
||||
{
|
||||
Handle(IGESData_IGESEntity) res;
|
||||
if (start.IsNull()) {
|
||||
return res;
|
||||
}
|
||||
|
||||
// conic curve : Ellipse, Circle, Hyperbola, Parabola.
|
||||
// All the conics are planar curves. An axis placement (two axis)
|
||||
// defines the local coordinate system of the conic.
|
||||
// The Location point, the XDirection and the YDirection of this
|
||||
// axis placement define the plane of the conic.
|
||||
// The XDirection defines the origin of the curve's parametrization.
|
||||
// The Direction (main direction) of the axis placement is normal
|
||||
// to the plane of the conic.
|
||||
|
||||
if (start->IsKind(STANDARD_TYPE(Geom_Circle))) {
|
||||
DeclareAndCast(Geom_Circle, Circle, start);
|
||||
res = TransferCurve(Circle, Udeb, Ufin);
|
||||
}
|
||||
else if (start->IsKind(STANDARD_TYPE(Geom_Ellipse))) {
|
||||
DeclareAndCast(Geom_Ellipse, Ellipse, start);
|
||||
res = TransferCurve(Ellipse, Udeb, Ufin);
|
||||
}
|
||||
else if ( start->IsKind(STANDARD_TYPE(Geom_Hyperbola))) {
|
||||
DeclareAndCast(Geom_Hyperbola, Hyperbola, start);
|
||||
res = TransferCurve(Hyperbola, Udeb, Ufin);
|
||||
}
|
||||
else if ( start->IsKind(STANDARD_TYPE(Geom_Parabola))) {
|
||||
DeclareAndCast(Geom_Parabola, Parabola, start);
|
||||
res = TransferCurve(Parabola, Udeb, Ufin);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Transfer des Entites Circle de Geom vers IGES
|
||||
// TransferCurve
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
|
||||
(const Handle(Geom_Circle)& start , const Standard_Real Udeb,
|
||||
const Standard_Real Ufin)
|
||||
{
|
||||
|
||||
Handle(IGESData_IGESEntity) res;
|
||||
if (start.IsNull()) {
|
||||
return res;
|
||||
}
|
||||
Handle(IGESGeom_CircularArc) Circle = new IGESGeom_CircularArc;;
|
||||
IGESConvGeom_GeomBuilder Build;
|
||||
|
||||
Standard_Real U1 = Udeb;
|
||||
Standard_Real U2 = Ufin;
|
||||
if (Abs(Udeb) <= gp::Resolution()) U1 = 0.0;
|
||||
|
||||
// creation du "CircularArc" (#100)
|
||||
// --------------------------------
|
||||
Standard_Real xloc,yloc,zloc;
|
||||
start->Circ().Location().Coord(xloc,yloc,zloc);
|
||||
gp_Pnt Loc;
|
||||
Loc.SetCoord(xloc,yloc,zloc);
|
||||
gp_Ax3 Pos = gp_Ax3(start->Circ().Position());
|
||||
// unusable Standard_Boolean IsDirect = Pos.Direct();
|
||||
Pos.SetLocation(Loc);
|
||||
Build.SetPosition(Pos);
|
||||
|
||||
Standard_Real Xc, Yc, Zc;
|
||||
Standard_Real Xs, Ys, Zs;
|
||||
Standard_Real Xe, Ye, Ze;
|
||||
//gka BUG 6542 1.09.04 BSpline curve was written in the IGES instead circle.
|
||||
gp_Pnt pfirst,plast;
|
||||
start->D0(U1,pfirst);
|
||||
if(Abs (Ufin - Udeb - 2 * PI) <= Precision::PConfusion())
|
||||
plast = pfirst;
|
||||
else
|
||||
start->D0(U2,plast);
|
||||
//
|
||||
Build.EvalXYZ(((start->Circ()).Location()).XYZ(), Xc, Yc, Zc);
|
||||
Build.EvalXYZ(pfirst.XYZ(), Xs, Ys, Zs);
|
||||
Build.EvalXYZ(plast.XYZ(), Xe, Ye, Ze);
|
||||
Circle->Init (Zc/GetUnit(),
|
||||
gp_XY( Xc/GetUnit(), Yc/GetUnit()),
|
||||
gp_XY( Xs/GetUnit(), Ys/GetUnit()),
|
||||
gp_XY( Xe/GetUnit(), Ye/GetUnit()));
|
||||
|
||||
// creation de la Trsf (#124)
|
||||
// il faut tenir compte de l`unite pour la matrice de transformation
|
||||
// (partie translation).
|
||||
|
||||
if (!Build.IsIdentity()){
|
||||
Handle(IGESGeom_TransformationMatrix) TMat =
|
||||
new IGESGeom_TransformationMatrix;
|
||||
TMat = Build.MakeTransformation(GetUnit());
|
||||
Circle->InitTransf(TMat);
|
||||
}
|
||||
|
||||
res = Circle;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Transfer des Entites Ellipse de Geom vers IGES
|
||||
// TransferCurve
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
|
||||
(const Handle(Geom_Ellipse)& start, const Standard_Real Udeb,
|
||||
const Standard_Real Ufin)
|
||||
{
|
||||
|
||||
Handle(IGESData_IGESEntity) res;
|
||||
if (start.IsNull()) {
|
||||
return res;
|
||||
}
|
||||
|
||||
//#35 rln 22.10.98 BUC60391 face 9
|
||||
//Closed Conic Arc is incorrectly oriented when reading back to CAS.CADE
|
||||
if (Abs (Ufin - Udeb - 2 * PI) <= Precision::PConfusion()) {
|
||||
//#53 rln 24.12.98 CCI60005
|
||||
//Trimmed ellipse. To avoid huge weights in B-Spline first rotate it and then convert
|
||||
Handle(Geom_Ellipse) copystart = Handle(Geom_Ellipse)::DownCast (start->Copy());
|
||||
gp_Ax2 pos = copystart->Position();
|
||||
copystart->SetPosition (pos.Rotated (pos.Axis(), gp_Ax3 (pos).Direct() ? Udeb : 2 * PI - Udeb));
|
||||
Handle(Geom_BSplineCurve) Bspline;
|
||||
//:q3 abv 17 Mar 99: use GeomConvert_ApproxCurve for precise conversion
|
||||
GeomConvert_ApproxCurve approx (copystart, Precision::Approximation(),
|
||||
GeomAbs_C1, 100, 6 );
|
||||
if ( approx.HasResult() ) Bspline = approx.Curve();
|
||||
if ( Bspline.IsNull() )
|
||||
GeomConvert::CurveToBSplineCurve (copystart, Convert_QuasiAngular);
|
||||
TColStd_Array1OfReal Knots(1, Bspline->NbKnots());
|
||||
Bspline->Knots (Knots);
|
||||
BSplCLib::Reparametrize (Udeb, Udeb + 2 * PI, Knots);
|
||||
Bspline->SetKnots (Knots);
|
||||
return TransferCurve (Bspline, Udeb, Ufin);
|
||||
}
|
||||
|
||||
Handle(IGESGeom_ConicArc) Conic = new IGESGeom_ConicArc;
|
||||
IGESConvGeom_GeomBuilder Build;
|
||||
Standard_Real U1 = Udeb;
|
||||
Standard_Real U2 = Ufin;
|
||||
if (Abs(Udeb) <= gp::Resolution()) U1 = 0.0;
|
||||
|
||||
// creation du "ConicArc" (#104)
|
||||
// -----------------------------
|
||||
|
||||
Standard_Real xloc,yloc,zloc;
|
||||
start->Elips().Location().Coord(xloc,yloc,zloc);
|
||||
gp_Pnt Loc;
|
||||
Loc.SetCoord(xloc, yloc, zloc);
|
||||
gp_Ax3 Pos = gp_Ax3(start->Elips().Position());
|
||||
Pos.SetLocation(Loc);
|
||||
Build.SetPosition(Pos);
|
||||
|
||||
Standard_Real Xs, Ys, Zs;
|
||||
Standard_Real Xe, Ye, Ze;
|
||||
Build.EvalXYZ((start->Value(U1)).XYZ(), Xs, Ys, Zs);
|
||||
Build.EvalXYZ((start->Value(U2)).XYZ(), Xe, Ye, Ze);
|
||||
gp_Elips2d E2d = gp_Elips2d(gp_Ax22d(gp::Origin2d(), gp::DX2d(), gp::DY2d()),
|
||||
(start->MajorRadius()),
|
||||
(start->MinorRadius()));
|
||||
Standard_Real A, B, C, D, E, F;
|
||||
E2d.Coefficients(A, C, B, D, E, F);//#59 rln 29.12.98 PRO17015 face 67
|
||||
//gp_Elips2d returns 0.5*K not K
|
||||
|
||||
Conic->Init (A, 2 * B, C, 2 * D, 2 * E, F, 0., //#59 rln
|
||||
gp_XY( Xs/GetUnit(), Ys/GetUnit()),
|
||||
gp_XY( Xe/GetUnit(), Ye/GetUnit()));
|
||||
|
||||
|
||||
// creation de la Trsf (#124)
|
||||
// il faut tenir compte de l'unite pour la matrice de transformation
|
||||
// (partie translation).
|
||||
|
||||
if (!Build.IsIdentity()){
|
||||
Handle(IGESGeom_TransformationMatrix) TMat =
|
||||
new IGESGeom_TransformationMatrix;
|
||||
TMat = Build.MakeTransformation(GetUnit());
|
||||
Conic->InitTransf(TMat);
|
||||
}
|
||||
res = Conic;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Transfer des Entites Hyperbola de Geom vers IGES
|
||||
// TransferCurve
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
|
||||
(const Handle(Geom_Hyperbola)& start, const Standard_Real Udeb,
|
||||
const Standard_Real Ufin)
|
||||
{
|
||||
Handle(IGESData_IGESEntity) res;
|
||||
if (start.IsNull()) {
|
||||
return res;
|
||||
}
|
||||
|
||||
Handle(IGESGeom_ConicArc) Conic = new IGESGeom_ConicArc;
|
||||
IGESConvGeom_GeomBuilder Build;
|
||||
Standard_Real U1 = Udeb;
|
||||
Standard_Real U2 = Ufin;
|
||||
if (Precision::IsNegativeInfinite(Udeb)) U1 = -Precision::Infinite();
|
||||
if (Precision::IsPositiveInfinite(Ufin)) U2 = Precision::Infinite();
|
||||
|
||||
// creation du "ConicArc" (#104)
|
||||
// -----------------------------
|
||||
Standard_Real xloc,yloc,zloc;
|
||||
start->Hypr().Location().Coord(xloc,yloc,zloc);
|
||||
gp_Pnt Loc;
|
||||
Loc.SetCoord(xloc, yloc, zloc);
|
||||
gp_Ax3 Pos = gp_Ax3(start->Hypr().Position());
|
||||
Pos.SetLocation(Loc);
|
||||
Build.SetPosition(Pos);
|
||||
|
||||
Standard_Real Xs, Ys, Zs;
|
||||
Standard_Real Xe, Ye, Ze;
|
||||
Build.EvalXYZ((start->Value(U1)).XYZ(), Xs, Ys, Zs);
|
||||
Build.EvalXYZ((start->Value(U2)).XYZ(), Xe, Ye, Ze);
|
||||
gp_Hypr2d H2d = gp_Hypr2d (gp_Ax22d(gp::Origin2d(), gp::DX2d(), gp::DY2d()),
|
||||
(start->MajorRadius()),
|
||||
(start->MinorRadius()));
|
||||
Standard_Real A, B, C, D, E, F;
|
||||
H2d.Coefficients(A, C, B, D, E, F);
|
||||
|
||||
Conic->Init (A, B, C, D, E, F, 0.,
|
||||
gp_XY( Xs/GetUnit(), Ys/GetUnit()),
|
||||
gp_XY( Xe/GetUnit(), Ye/GetUnit()));
|
||||
|
||||
|
||||
// creation de la Trsf (#124)
|
||||
// il faut tenir compte de l'unite pour la matrice de transformation
|
||||
// (partie translation).
|
||||
|
||||
if (!Build.IsIdentity()){
|
||||
Handle(IGESGeom_TransformationMatrix) TMat =
|
||||
new IGESGeom_TransformationMatrix;
|
||||
TMat = Build.MakeTransformation(GetUnit());
|
||||
Conic->InitTransf(TMat);
|
||||
}
|
||||
res = Conic;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Transfer des Entites Parabola de Geom vers IGES
|
||||
// TransferCurve
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
|
||||
(const Handle(Geom_Parabola)& start, const Standard_Real Udeb,
|
||||
const Standard_Real Ufin)
|
||||
{
|
||||
Handle(IGESData_IGESEntity) res;
|
||||
if (start.IsNull()) {
|
||||
return res;
|
||||
}
|
||||
|
||||
Handle(IGESGeom_ConicArc) Conic = new IGESGeom_ConicArc;
|
||||
IGESConvGeom_GeomBuilder Build;
|
||||
Standard_Real U1 = Udeb;
|
||||
Standard_Real U2 = Ufin;
|
||||
if (Precision::IsNegativeInfinite(Udeb)) U1 = -Precision::Infinite();
|
||||
if (Precision::IsPositiveInfinite(Ufin)) U2 = Precision::Infinite();
|
||||
|
||||
// creation du "ConicArc" (#104)
|
||||
// -----------------------------
|
||||
Standard_Real xloc,yloc,zloc;
|
||||
start->Parab().Location().Coord(xloc,yloc,zloc);
|
||||
gp_Pnt Loc;
|
||||
Loc.SetCoord(xloc, yloc, zloc);
|
||||
gp_Ax3 Pos = gp_Ax3(start->Parab().Position());
|
||||
Pos.SetLocation(Loc);
|
||||
Build.SetPosition(Pos);
|
||||
|
||||
Standard_Real Xs, Ys, Zs;
|
||||
Standard_Real Xe, Ye, Ze;
|
||||
Build.EvalXYZ((start->Value(U1)).XYZ(), Xs, Ys, Zs);
|
||||
Build.EvalXYZ((start->Value(U2)).XYZ(), Xe, Ye, Ze);
|
||||
gp_Parab2d P2d = gp_Parab2d (gp_Ax22d(gp::Origin2d(), gp::DX2d(), gp::DY2d()),
|
||||
(start->Focal()*2.));
|
||||
Standard_Real A, B, C, D, E, F;
|
||||
P2d.Coefficients(A, C, B, D, E, F);
|
||||
|
||||
Conic->Init (A, B, C, D, E, F, 0.,
|
||||
gp_XY( Xs/GetUnit(), Ys/GetUnit()),
|
||||
gp_XY( Xe/GetUnit(), Ye/GetUnit()));
|
||||
|
||||
|
||||
// creation de la Trsf (#124)
|
||||
// il faut tenir compte de l'unite pour la matrice de transformation
|
||||
// (partie translation).
|
||||
|
||||
if (!Build.IsIdentity()){
|
||||
Handle(IGESGeom_TransformationMatrix) TMat =
|
||||
new IGESGeom_TransformationMatrix;
|
||||
TMat = Build.MakeTransformation(GetUnit());
|
||||
Conic->InitTransf(TMat);
|
||||
}
|
||||
res = Conic;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Transfer des Entites Line de Geom vers IGES
|
||||
// TransferCurve
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
|
||||
(const Handle(Geom_Line)& start, const Standard_Real Udeb,
|
||||
const Standard_Real Ufin)
|
||||
{
|
||||
Handle(IGESData_IGESEntity) res;
|
||||
if (start.IsNull()) {
|
||||
return res;
|
||||
}
|
||||
|
||||
Handle(IGESGeom_Line) Line = new IGESGeom_Line;
|
||||
Standard_Real U1 = Udeb;
|
||||
Standard_Real U2 = Ufin;
|
||||
if (Precision::IsNegativeInfinite(Udeb)) U1 = -Precision::Infinite();
|
||||
if (Precision::IsPositiveInfinite(Ufin)) U2 = Precision::Infinite();
|
||||
|
||||
// creation du "Line" (#110)
|
||||
// -------------------------
|
||||
|
||||
Standard_Real X1,Y1,Z1,X2,Y2,Z2;
|
||||
start->Value(U1).Coord(X1,Y1,Z1);
|
||||
start->Value(U2).Coord(X2,Y2,Z2);
|
||||
|
||||
Line->Init((gp_XYZ(X1/GetUnit(),Y1/GetUnit(),Z1/GetUnit())),
|
||||
(gp_XYZ(X2/GetUnit(),Y2/GetUnit(),Z2/GetUnit())));
|
||||
res = Line;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Transfer des Entites OffsetCurve de Geom vers IGES
|
||||
// TransferCurve
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
|
||||
(const Handle(Geom_OffsetCurve)& start, const Standard_Real Udeb,
|
||||
const Standard_Real Ufin)
|
||||
{
|
||||
Handle(IGESData_IGESEntity) res;
|
||||
if (start.IsNull()) {
|
||||
return res;
|
||||
}
|
||||
|
||||
Handle(IGESGeom_OffsetCurve) OffsetC = new IGESGeom_OffsetCurve;
|
||||
Standard_Real U1 = Udeb;
|
||||
Standard_Real U2 = Ufin;
|
||||
if (Precision::IsNegativeInfinite(Udeb)) U1 = -Precision::Infinite();
|
||||
if (Precision::IsPositiveInfinite(Ufin)) U2 = Precision::Infinite();
|
||||
|
||||
Handle(Geom_Curve) Curve = start->BasisCurve();
|
||||
Standard_Real Deb = Curve->FirstParameter();
|
||||
Standard_Real Fin = Curve->LastParameter();
|
||||
//%11 pdn 12.01.98 offset curve should be planar
|
||||
gp_XYZ Normal;
|
||||
if (!IsPlanar(Curve,Normal)) {
|
||||
//%11 pdn 12.01.98 protection against exceptions
|
||||
try{
|
||||
OCC_CATCH_SIGNALS
|
||||
res = TransferCurve(GeomConvert::CurveToBSplineCurve(start),U1,U2);
|
||||
return res;
|
||||
}
|
||||
catch(Standard_Failure){
|
||||
#ifdef DEB
|
||||
cout << "writing non-planar offset curve."<<endl;
|
||||
cout << "Warning: GeomConvert::CurveToBSplineCurve raised an exception: ";
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Handle(IGESData_IGESEntity) BaseCurve = TransferCurve(Curve, Deb, Fin);
|
||||
Handle(IGESData_IGESEntity) voident;
|
||||
|
||||
OffsetC->Init( BaseCurve, 1,voident, 0, 0, (start->Offset()/GetUnit()), 0.,
|
||||
(start->Offset()/GetUnit()), 0.,
|
||||
start->Direction().XYZ().Reversed(), U1, U2); //%11 pdn 12.01.99 // valeur (0,0,1) pour l'instant
|
||||
|
||||
res = OffsetC;
|
||||
return res;
|
||||
}
|
51
src/GeomToIGES/GeomToIGES_GeomEntity.cdl
Executable file
51
src/GeomToIGES/GeomToIGES_GeomEntity.cdl
Executable file
@@ -0,0 +1,51 @@
|
||||
-- File: GeomToIGES_GeomEntity.cdl
|
||||
-- Created: Wed Sep 13 14:23:04 1995
|
||||
-- Author: Marie Jose MARTZ
|
||||
-- <mjm@pronox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
class GeomEntity from GeomToIGES
|
||||
|
||||
|
||||
---Purpose : provides methods to transfer Geom entity from CASCADE to IGES.
|
||||
|
||||
uses
|
||||
|
||||
Real from Standard,
|
||||
IGESEntity from IGESData,
|
||||
IGESModel from IGESData
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
returns GeomEntity from GeomToIGES;
|
||||
---Purpose : Creates a tool GeomEntity
|
||||
|
||||
Create(GE : GeomEntity from GeomToIGES)
|
||||
returns GeomEntity from GeomToIGES;
|
||||
---Purpose : Creates a tool ready to run and sets its
|
||||
-- fields as GE's.
|
||||
|
||||
SetModel(me : in out; model : IGESModel from IGESData);
|
||||
---Purpose : Set the value of "TheModel"
|
||||
|
||||
GetModel(me)
|
||||
returns IGESModel from IGESData;
|
||||
---Purpose : Returns the value of "TheModel"
|
||||
|
||||
SetUnit(me: in out; unit: Real);
|
||||
---Purpose : Sets the value of the UnitFlag
|
||||
|
||||
GetUnit(me)
|
||||
returns Real from Standard;
|
||||
---Purpose : Returns the value of the UnitFlag of the header of the model
|
||||
-- in meters.
|
||||
|
||||
fields
|
||||
|
||||
TheModel : IGESModel from IGESData ;
|
||||
|
||||
TheUnitFactor : Real from Standard;
|
||||
|
||||
end GeomEntity;
|
||||
|
77
src/GeomToIGES/GeomToIGES_GeomEntity.cxx
Executable file
77
src/GeomToIGES/GeomToIGES_GeomEntity.cxx
Executable file
@@ -0,0 +1,77 @@
|
||||
// Copyright: Matra-Datavision 1995
|
||||
// File: GeomToIGES_GeomEntity.cxx
|
||||
// Created: Wed Sep 13 14:29:47 1995
|
||||
// Author: Marie Jose MARTZ
|
||||
// <mjm>
|
||||
//rln 06.01.98 new method SetUnit
|
||||
|
||||
|
||||
#include <GeomToIGES_GeomEntity.ixx>
|
||||
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GeomToIGES_GeomEntity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GeomToIGES_GeomEntity::GeomToIGES_GeomEntity()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GeomToIGES_GeomEntity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GeomToIGES_GeomEntity::GeomToIGES_GeomEntity
|
||||
(const GeomToIGES_GeomEntity& other)
|
||||
{
|
||||
TheUnitFactor = other.GetUnit();
|
||||
TheModel = other.GetModel();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetModel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GeomToIGES_GeomEntity::SetModel(const Handle(IGESData_IGESModel)& model)
|
||||
{
|
||||
TheModel = model;
|
||||
Standard_Real unitfactor = TheModel->GlobalSection().UnitValue();
|
||||
TheUnitFactor = unitfactor;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetModel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(IGESData_IGESModel) GeomToIGES_GeomEntity::GetModel() const
|
||||
{
|
||||
return TheModel;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetUnit
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GeomToIGES_GeomEntity::SetUnit(const Standard_Real unit)
|
||||
{
|
||||
TheUnitFactor = unit;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetUnit
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GeomToIGES_GeomEntity::GetUnit() const
|
||||
{
|
||||
return TheUnitFactor;
|
||||
}
|
||||
|
||||
|
47
src/GeomToIGES/GeomToIGES_GeomPoint.cdl
Executable file
47
src/GeomToIGES/GeomToIGES_GeomPoint.cdl
Executable file
@@ -0,0 +1,47 @@
|
||||
-- File: GeomToIGES_GeomPoint.cdl
|
||||
-- Created: Wed Nov 16 14:24:57 1994
|
||||
-- Author: Marie Jose MARTZ
|
||||
-- <mjm@minox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
class GeomPoint from GeomToIGES inherits GeomEntity from GeomToIGES
|
||||
|
||||
---Purpose: This class implements the transfer of the Point Entity from Geom
|
||||
-- to IGES . These are :
|
||||
-- . Point
|
||||
-- * CartesianPoint
|
||||
|
||||
|
||||
uses
|
||||
|
||||
Point from Geom,
|
||||
CartesianPoint from Geom,
|
||||
Point from IGESGeom,
|
||||
GeomEntity from GeomToIGES
|
||||
|
||||
is
|
||||
|
||||
Create returns GeomPoint from GeomToIGES;
|
||||
|
||||
|
||||
Create(GE : GeomEntity from GeomToIGES)
|
||||
returns GeomPoint from GeomToIGES;
|
||||
---Purpose : Creates a tool GeomPoint ready to run and sets its
|
||||
-- fields as GE's.
|
||||
|
||||
TransferPoint (me : in out;
|
||||
start : Point from Geom)
|
||||
returns mutable Point from IGESGeom;
|
||||
---Purpose : Transfert a Point from Geom to IGES. If this
|
||||
-- Entity could not be converted, this member returns a NullEntity.
|
||||
|
||||
TransferPoint (me : in out;
|
||||
start : CartesianPoint from Geom)
|
||||
returns mutable Point from IGESGeom;
|
||||
---Purpose : Transfert a CartesianPoint from Geom to IGES. If this
|
||||
-- Entity could not be converted, this member returns a NullEntity.
|
||||
|
||||
|
||||
end GeomPoint;
|
||||
|
||||
|
80
src/GeomToIGES/GeomToIGES_GeomPoint.cxx
Executable file
80
src/GeomToIGES/GeomToIGES_GeomPoint.cxx
Executable file
@@ -0,0 +1,80 @@
|
||||
// File: GeomToIGES_GeomPoint.cxx
|
||||
|
||||
// modif du 14/09/95 mjm
|
||||
// prise en compte de l'unite choisi par l'utilisateur
|
||||
// pour l'ecriture du fichier IGES.
|
||||
|
||||
#include <GeomToIGES_GeomPoint.ixx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
|
||||
#include <Geom_Point.hxx>
|
||||
|
||||
#include <IGESGeom_Point.hxx>
|
||||
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// GeomToIGES_GeomPoint
|
||||
//=============================================================================
|
||||
|
||||
GeomToIGES_GeomPoint::GeomToIGES_GeomPoint
|
||||
(const GeomToIGES_GeomEntity& GE)
|
||||
:GeomToIGES_GeomEntity(GE)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// GeomToIGES_GeomPoint
|
||||
//=============================================================================
|
||||
|
||||
GeomToIGES_GeomPoint::GeomToIGES_GeomPoint()
|
||||
|
||||
:GeomToIGES_GeomEntity()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Transfer de Point de Geom vers IGES
|
||||
// TranferPoint
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESGeom_Point) GeomToIGES_GeomPoint::TransferPoint
|
||||
( const Handle(Geom_Point)& P)
|
||||
{
|
||||
Handle(IGESGeom_Point) Piges = new IGESGeom_Point;
|
||||
if (P.IsNull()) {
|
||||
return Piges;
|
||||
}
|
||||
|
||||
Standard_Real X,Y,Z;
|
||||
P->Coord (X,Y,Z);
|
||||
Handle(IGESBasic_SubfigureDef) voidsubdef;
|
||||
Piges-> Init(gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()), voidsubdef);
|
||||
return Piges;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Transfer de Point de Geom vers IGES
|
||||
// TranferPoint
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESGeom_Point) GeomToIGES_GeomPoint::TransferPoint
|
||||
( const Handle(Geom_CartesianPoint)& P)
|
||||
{
|
||||
|
||||
Handle(IGESGeom_Point) Piges = new IGESGeom_Point;
|
||||
if (P.IsNull()) {
|
||||
return Piges;
|
||||
}
|
||||
|
||||
Standard_Real X,Y,Z;
|
||||
P->Coord (X,Y,Z);
|
||||
Handle(IGESBasic_SubfigureDef) voidsubdef;
|
||||
Piges-> Init(gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()), voidsubdef);
|
||||
return Piges;
|
||||
}
|
266
src/GeomToIGES/GeomToIGES_GeomSurface.cdl
Executable file
266
src/GeomToIGES/GeomToIGES_GeomSurface.cdl
Executable file
@@ -0,0 +1,266 @@
|
||||
-- File: GeomToIGES_GeomSurface.cdl
|
||||
-- Created: Thu Nov 17 15:30:03 1994
|
||||
-- Author: Marie Jose MARTZ
|
||||
-- <mjm@minox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
class GeomSurface from GeomToIGES inherits GeomEntity from GeomToIGES
|
||||
|
||||
|
||||
---Purpose: This class implements the transfer of the Surface Entity from Geom
|
||||
-- To IGES. These can be :
|
||||
-- . BoundedSurface
|
||||
-- * BSplineSurface
|
||||
-- * BezierSurface
|
||||
-- * RectangularTrimmedSurface
|
||||
-- . ElementarySurface
|
||||
-- * Plane
|
||||
-- * CylindricalSurface
|
||||
-- * ConicalSurface
|
||||
-- * SphericalSurface
|
||||
-- * ToroidalSurface
|
||||
-- . SweptSurface
|
||||
-- * SurfaceOfLinearExtrusion
|
||||
-- * SurfaceOfRevolution
|
||||
-- . OffsetSurface
|
||||
|
||||
|
||||
uses
|
||||
|
||||
Real from Standard,
|
||||
Surface from Geom,
|
||||
BoundedSurface from Geom,
|
||||
BSplineSurface from Geom,
|
||||
BezierSurface from Geom,
|
||||
RectangularTrimmedSurface from Geom,
|
||||
ElementarySurface from Geom,
|
||||
Plane from Geom,
|
||||
CylindricalSurface from Geom,
|
||||
ConicalSurface from Geom,
|
||||
SphericalSurface from Geom,
|
||||
ToroidalSurface from Geom,
|
||||
SweptSurface from Geom,
|
||||
SurfaceOfLinearExtrusion from Geom,
|
||||
SurfaceOfRevolution from Geom,
|
||||
OffsetSurface from Geom,
|
||||
IGESEntity from IGESData,
|
||||
GeomEntity from GeomToIGES
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create returns GeomSurface from GeomToIGES;
|
||||
|
||||
|
||||
Create(GE : GeomEntity from GeomToIGES)
|
||||
returns GeomSurface from GeomToIGES;
|
||||
---Purpose: Creates a tool GeomSurface ready to run and sets its
|
||||
-- fields as GE's.
|
||||
|
||||
TransferSurface (me : in out;
|
||||
start : Surface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
---Purpose: Transfert a GeometryEntity which answer True to the
|
||||
-- member : BRepToIGES::IsGeomSurface(Geometry). If this
|
||||
-- Entity could not be converted, this member returns a NullEntity.
|
||||
|
||||
|
||||
TransferSurface (me : in out;
|
||||
start : BoundedSurface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferSurface (me : in out;
|
||||
start : BSplineSurface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
TransferSurface (me : in out;
|
||||
start : BezierSurface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
TransferSurface (me : in out;
|
||||
start : RectangularTrimmedSurface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferSurface (me : in out;
|
||||
start : ElementarySurface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferSurface (me : in out;
|
||||
start : Plane from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferSurface (me : in out;
|
||||
start : CylindricalSurface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferSurface (me : in out;
|
||||
start : ConicalSurface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferSurface (me : in out;
|
||||
start : SphericalSurface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferSurface (me : in out;
|
||||
start : ToroidalSurface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferSurface (me : in out;
|
||||
start : SweptSurface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferSurface (me : in out;
|
||||
start : SurfaceOfLinearExtrusion from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferSurface (me : in out;
|
||||
start : SurfaceOfRevolution from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferSurface (me : in out;
|
||||
start : OffsetSurface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
-- Methods for translating sufraces in BRep IGES
|
||||
|
||||
|
||||
TransferPlaneSurface (me : in out;
|
||||
start : Plane from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferCylindricalSurface(me : in out;
|
||||
start: CylindricalSurface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferConicalSurface(me : in out;
|
||||
start: ConicalSurface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferSphericalSurface(me : in out;
|
||||
start: SphericalSurface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
|
||||
TransferToroidalSurface(me : in out;
|
||||
start: ToroidalSurface from Geom;
|
||||
Udeb : Real from Standard;
|
||||
Ufin : Real from Standard;
|
||||
Vdeb : Real from Standard;
|
||||
Vfin : Real from Standard)
|
||||
returns mutable IGESEntity from IGESData;
|
||||
|
||||
-- Methods for setting and obtaining fields.
|
||||
|
||||
Length(me) returns Real;
|
||||
---Purpose: Returns the value of "TheLength"
|
||||
|
||||
GetBRepMode(me) returns Boolean from Standard;
|
||||
---Purpose: Returns Brep mode flag.
|
||||
|
||||
SetBRepMode(me: in out; flag: Boolean from Standard);
|
||||
---Purpose: Sets BRep mode flag.
|
||||
|
||||
GetAnalyticMode(me) returns Boolean from Standard;
|
||||
---Purpose: Returns flag for writing elementary surfaces
|
||||
|
||||
SetAnalyticMode(me: in out; flag: Boolean from Standard);
|
||||
---Purpose: Setst flag for writing elementary surfaces
|
||||
|
||||
fields
|
||||
|
||||
TheLength : Real from Standard;
|
||||
myBRepMode: Boolean from Standard;
|
||||
myAnalytic: Boolean from Standard;
|
||||
|
||||
end GeomSurface;
|
1309
src/GeomToIGES/GeomToIGES_GeomSurface.cxx
Executable file
1309
src/GeomToIGES/GeomToIGES_GeomSurface.cxx
Executable file
File diff suppressed because it is too large
Load Diff
53
src/GeomToIGES/GeomToIGES_GeomVector.cdl
Executable file
53
src/GeomToIGES/GeomToIGES_GeomVector.cdl
Executable file
@@ -0,0 +1,53 @@
|
||||
-- File: GeomToIGES_GeomVector.cdl
|
||||
-- Created: Fri Nov 18 11:33:11 1994
|
||||
-- Author: Marie Jose MARTZ
|
||||
-- <mjm@minox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
class GeomVector from GeomToIGES inherits GeomEntity from GeomToIGES
|
||||
|
||||
---Purpose: This class implements the transfer of the Vector from Geom
|
||||
-- to IGES . These can be :
|
||||
-- . Vector
|
||||
-- * Direction
|
||||
-- * VectorWithMagnitude
|
||||
|
||||
uses
|
||||
|
||||
Vector from Geom,
|
||||
VectorWithMagnitude from Geom,
|
||||
Direction from Geom,
|
||||
Direction from IGESGeom,
|
||||
GeomEntity from GeomToIGES
|
||||
|
||||
is
|
||||
|
||||
Create returns GeomVector from GeomToIGES;
|
||||
|
||||
|
||||
Create(GE : GeomEntity from GeomToIGES)
|
||||
returns GeomVector from GeomToIGES;
|
||||
---Purpose : Creates a tool GeomVector ready to run and sets its
|
||||
-- fields as GE's.
|
||||
|
||||
TransferVector (me : in out;
|
||||
start : Vector from Geom)
|
||||
returns mutable Direction from IGESGeom;
|
||||
---Purpose : Transfert a GeometryEntity which answer True to the
|
||||
-- member : BRepToIGES::IsGeomVector(Geometry). If this
|
||||
-- Entity could not be converted, this member returns a NullEntity.
|
||||
|
||||
|
||||
TransferVector (me : in out;
|
||||
start : VectorWithMagnitude from Geom)
|
||||
returns mutable Direction from IGESGeom;
|
||||
|
||||
|
||||
TransferVector (me : in out;
|
||||
start : Direction from Geom)
|
||||
returns mutable Direction from IGESGeom;
|
||||
|
||||
|
||||
end GeomVector;
|
||||
|
||||
|
115
src/GeomToIGES/GeomToIGES_GeomVector.cxx
Executable file
115
src/GeomToIGES/GeomToIGES_GeomVector.cxx
Executable file
@@ -0,0 +1,115 @@
|
||||
// File: GeomToIGES_GeomVector.cxx
|
||||
|
||||
// modif du 14/09/95 mjm
|
||||
// prise en compte de l'unite choisi par l'utilisateur
|
||||
// pour l'ecriture du fichier IGES.
|
||||
|
||||
#include <GeomToIGES_GeomVector.ixx>
|
||||
|
||||
#include <Geom_Vector.hxx>
|
||||
#include <Geom_VectorWithMagnitude.hxx>
|
||||
#include <Geom_Direction.hxx>
|
||||
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_GTrsf.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESData_ToolLocation.hxx>
|
||||
|
||||
#include <IGESGeom_CopiousData.hxx>
|
||||
#include <IGESGeom_Line.hxx>
|
||||
#include <IGESGeom_Point.hxx>
|
||||
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// GeomToIGES_GeomVector
|
||||
//=============================================================================
|
||||
|
||||
GeomToIGES_GeomVector::GeomToIGES_GeomVector()
|
||||
:GeomToIGES_GeomEntity()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// GeomToIGES_GeomVector
|
||||
//=============================================================================
|
||||
|
||||
GeomToIGES_GeomVector::GeomToIGES_GeomVector
|
||||
(const GeomToIGES_GeomEntity& GE)
|
||||
:GeomToIGES_GeomEntity(GE)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Transfer des Entites Vector de Geom vers IGES
|
||||
// TransferVector
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESGeom_Direction) GeomToIGES_GeomVector::TransferVector
|
||||
(const Handle(Geom_Vector)& start)
|
||||
{
|
||||
Handle(IGESGeom_Direction) res;
|
||||
if (start.IsNull()) {
|
||||
return res;
|
||||
}
|
||||
|
||||
if (start->IsKind(STANDARD_TYPE(Geom_VectorWithMagnitude))) {
|
||||
DeclareAndCast(Geom_VectorWithMagnitude, VMagn, start);
|
||||
res = TransferVector(VMagn);
|
||||
}
|
||||
else if (start->IsKind(STANDARD_TYPE(Geom_Direction))) {
|
||||
DeclareAndCast(Geom_Direction, Direction, start);
|
||||
res = TransferVector(Direction);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Transfer des Entites VectorWithMagnitude de Geom vers IGES
|
||||
// TransferVector
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESGeom_Direction) GeomToIGES_GeomVector::TransferVector
|
||||
(const Handle(Geom_VectorWithMagnitude)& start)
|
||||
{
|
||||
Handle(IGESGeom_Direction) Dir = new IGESGeom_Direction;
|
||||
if (start.IsNull()) {
|
||||
return Dir;
|
||||
}
|
||||
|
||||
Standard_Real X,Y,Z;
|
||||
start->Coord(X,Y,Z);
|
||||
Standard_Real M = start->Magnitude();
|
||||
Dir->Init(gp_XYZ(X/(M*GetUnit()),Y/(M*GetUnit()),Z/(M*GetUnit())));
|
||||
return Dir;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Transfer des Entites Direction de Geom vers IGES
|
||||
// TransferVector
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESGeom_Direction) GeomToIGES_GeomVector::TransferVector
|
||||
(const Handle(Geom_Direction)& start)
|
||||
{
|
||||
Handle(IGESGeom_Direction) Dir = new IGESGeom_Direction;
|
||||
if (start.IsNull()) {
|
||||
return Dir;
|
||||
}
|
||||
|
||||
Standard_Real X,Y,Z;
|
||||
start->Coord(X,Y,Z);
|
||||
Dir->Init(gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()));
|
||||
return Dir;
|
||||
}
|
Reference in New Issue
Block a user