1 // Created on: 1993-06-16
2 // Created by: Martine LANGLOIS
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Geom_Axis2Placement.hxx>
19 #include <GeomToStep_MakeAxis2Placement3d.hxx>
20 #include <GeomToStep_MakeCartesianPoint.hxx>
21 #include <GeomToStep_MakeDirection.hxx>
24 #include <gp_Trsf.hxx>
25 #include <StdFail_NotDone.hxx>
26 #include <StepGeom_Axis2Placement3d.hxx>
27 #include <StepGeom_CartesianPoint.hxx>
28 #include <StepGeom_Direction.hxx>
29 #include <TCollection_HAsciiString.hxx>
31 static Handle(StepGeom_Axis2Placement3d) MakeAxis2Placement3d
32 (const gp_Pnt& O, const gp_Dir& D, const gp_Dir& X, const Standard_CString nom)
34 Handle(StepGeom_Axis2Placement3d) Axe;
35 Handle(StepGeom_CartesianPoint) P;
36 Handle(StepGeom_Direction) D1, D2;
38 GeomToStep_MakeCartesianPoint MkPoint(O);
39 GeomToStep_MakeDirection MkDir1(D);
40 GeomToStep_MakeDirection MkDir2(X);
46 Axe = new StepGeom_Axis2Placement3d;
49 Axe->SetRefDirection(D2);
50 Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(nom);
55 //=============================================================================
56 // Creation d' un axis2_placement_3d a l origine
57 //=============================================================================
59 GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d ( )
61 gp_Ax2 A (gp_Pnt(0.,0.,0.), gp_Dir (0.,0.,1.), gp_Dir (1.,0.,0.));
64 Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d
65 (A.Location(), A.Direction(), A.XDirection(), "");
66 theAxis2Placement3d = Axe;
70 //=============================================================================
71 // Creation d' un axis2_placement_3d de prostep a partir d' un Ax2 de gp
72 //=============================================================================
74 GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d( const gp_Ax2&
77 Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d
78 (A.Location(), A.Direction(), A.XDirection(), "");
79 theAxis2Placement3d = Axe;
83 //=============================================================================
84 // Creation d' un axis2_placement_3d de prostep a partir d' un Ax3 de gp
85 //=============================================================================
87 GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d
90 Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d
91 (A.Location(), A.Direction(), A.XDirection(), "");
92 theAxis2Placement3d = Axe;
96 //=============================================================================
97 // Creation d' un axis2_placement_3d de prostep a partir d' un Trsf de gp
98 //=============================================================================
100 GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d
103 gp_Ax2 A (gp_Pnt(0.,0.,0.), gp_Dir (0.,0.,1.), gp_Dir (1.,0.,0.));
107 Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d
108 (A.Location(), A.Direction(), A.XDirection(), "");
109 theAxis2Placement3d = Axe;
110 done = Standard_True;
113 //=============================================================================
114 // Creation d' un axis2_placement_3d de prostep a partir d' un Axis2Placement
116 //=============================================================================
118 GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d
119 ( const Handle(Geom_Axis2Placement)& Axis2)
124 Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d
125 (A.Location(), A.Direction(), A.XDirection(), "");
126 theAxis2Placement3d = Axe;
127 done = Standard_True;
130 //=============================================================================
131 // renvoi des valeurs
132 //=============================================================================
134 const Handle(StepGeom_Axis2Placement3d) &
135 GeomToStep_MakeAxis2Placement3d::Value() const
137 StdFail_NotDone_Raise_if(!done == Standard_True,"");
138 return theAxis2Placement3d;