1 // Created on: 1999-02-12
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 //#4 szv S4163: optimization
18 //: abv 07.04.99 S4136: turn off fixing intersection of non-adjacent edges
20 #include <BRep_Builder.hxx>
21 #include <BRepBuilderAPI_MakeFace.hxx>
22 #include <Geom_BoundedSurface.hxx>
23 #include <Precision.hxx>
24 #include <ShapeAlgo.hxx>
25 #include <ShapeAlgo_AlgoContainer.hxx>
26 #include <StepGeom_BoundaryCurve.hxx>
27 #include <StepGeom_BSplineSurface.hxx>
28 #include <StepGeom_CurveBoundedSurface.hxx>
29 #include <StepGeom_HArray1OfSurfaceBoundary.hxx>
30 #include <StepToGeom.hxx>
31 #include <StepToTopoDS_TranslateCompositeCurve.hxx>
32 #include <StepToTopoDS_TranslateCurveBoundedSurface.hxx>
34 #include <TopoDS_Edge.hxx>
35 #include <TopoDS_Face.hxx>
36 #include <Transfer_TransientProcess.hxx>
38 //=======================================================================
39 //function : StepToTopoDS_TranslateCurveBoundedSurface
41 //=======================================================================
42 StepToTopoDS_TranslateCurveBoundedSurface::StepToTopoDS_TranslateCurveBoundedSurface ()
46 //=======================================================================
47 //function : StepToTopoDS_TranslateCurveBoundedSurface
49 //=======================================================================
51 StepToTopoDS_TranslateCurveBoundedSurface::StepToTopoDS_TranslateCurveBoundedSurface (
52 const Handle(StepGeom_CurveBoundedSurface) &CBS,
53 const Handle(Transfer_TransientProcess) &TP)
58 //=======================================================================
61 //=======================================================================
63 Standard_Boolean StepToTopoDS_TranslateCurveBoundedSurface::Init (
64 const Handle(StepGeom_CurveBoundedSurface) &CBS,
65 const Handle(Transfer_TransientProcess) &TP)
68 if ( CBS.IsNull() ) return Standard_False;
70 // translate basis surface
71 Handle(StepGeom_Surface) S = CBS->BasisSurface();
72 Handle(Geom_Surface) Surf = StepToGeom::MakeSurface (S);
75 TP->AddFail ( CBS, "Basis surface not translated" );
76 return Standard_False;
79 // abv 30.06.00: trj4_k1_geo-tu.stp #108: do as in TranslateFace
80 // pdn to force bsplsurf to be periodic
81 Handle(StepGeom_BSplineSurface) sgbss = Handle(StepGeom_BSplineSurface)::DownCast(S);
82 if (!sgbss.IsNull()) {
83 Handle(Geom_Surface) periodicSurf = ShapeAlgo::AlgoContainer()->ConvertToPeriodic(Surf);
84 if (!periodicSurf.IsNull()) {
85 TP->AddWarning(S, "Surface forced to be periodic");
92 B.MakeFace ( myFace, Surf, Precision::Confusion() );
94 // add natural bound if implicit
95 if ( CBS->ImplicitOuter() ) {
96 if ( Surf->IsKind(STANDARD_TYPE(Geom_BoundedSurface)) ) {
97 BRepBuilderAPI_MakeFace mf (Surf, Precision::Confusion());
100 else TP->AddWarning ( CBS, "Cannot make natural bounds on infinite surface" );
103 // translate boundaries
104 Handle(StepGeom_HArray1OfSurfaceBoundary) bnd = CBS->Boundaries();
105 Standard_Integer nb = bnd->Length();
106 for ( Standard_Integer i=1; i <= nb; i++ ) {
107 Handle(StepGeom_CompositeCurve) cc = bnd->Value ( i ).BoundaryCurve();
108 if ( cc.IsNull() ) continue;
109 StepToTopoDS_TranslateCompositeCurve TrCC ( cc, TP, S, Surf );
110 if ( ! TrCC.IsDone() ) {
111 TP->AddWarning ( CBS, "Boundary not translated" );
114 B.Add ( myFace, TrCC.Value() );
117 done = ! myFace.IsNull();
121 //=======================================================================
124 //=======================================================================
126 const TopoDS_Face &StepToTopoDS_TranslateCurveBoundedSurface::Value () const