1 // Created on: 1999-02-16
2 // Created by: Andrey BETENEV
3 // Copyright (c) 1999-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.
17 // sln 23.10.2001. CTS23496: If problems with creation of direction occur default direction is used (StepToGeom_MakeTransformation3d(...) function)
19 #include <Geom_CartesianPoint.hxx>
20 #include <Geom_Direction.hxx>
22 #include <gp_Trsf.hxx>
23 #include <StepGeom_CartesianPoint.hxx>
24 #include <StepGeom_CartesianTransformationOperator3d.hxx>
25 #include <StepGeom_Direction.hxx>
26 #include <StepToGeom_MakeCartesianPoint.hxx>
27 #include <StepToGeom_MakeDirection.hxx>
28 #include <StepToGeom_MakeTransformation3d.hxx>
30 //=======================================================================
31 //function : StepToGeom_MakeTransformation3d
33 //=======================================================================
34 Standard_Boolean StepToGeom_MakeTransformation3d::Convert (const Handle(StepGeom_CartesianTransformationOperator3d)& SCTO, gp_Trsf& CT)
36 Handle(Geom_CartesianPoint) CP;
37 if (StepToGeom_MakeCartesianPoint::Convert(SCTO->LocalOrigin(),CP))
39 const gp_Pnt Pgp = CP->Pnt();
41 // sln 23.10.2001. CTS23496: If problems with creation of direction occur default direction is used
43 const Handle(StepGeom_Direction) A1 = SCTO->Axis1();
45 Handle(Geom_Direction) D;
46 if (StepToGeom_MakeDirection::Convert(A1,D))
51 const Handle(StepGeom_Direction) A2 = SCTO->Axis2();
53 Handle(Geom_Direction) D;
54 if (StepToGeom_MakeDirection::Convert(A2,D))
58 Standard_Boolean isDefaultDirectionUsed = Standard_True;
60 const Handle(StepGeom_Direction) A3 = SCTO->Axis3();
62 Handle(Geom_Direction) D;
63 if(StepToGeom_MakeDirection::Convert(A3,D)) {
65 isDefaultDirectionUsed = Standard_False;
68 if(isDefaultDirectionUsed)
71 const gp_Ax3 result(Pgp,D3,D1);
72 CT.SetTransformation(result);
73 CT = CT.Inverted(); //:n8 abv 16 Feb 99: tr8_as2_db.stp: reverse for accordance with LV tool
76 return Standard_False;