1 // Created on: 1995-01-03
2 // Created by: Frederic MAUPAS
3 // Copyright (c) 1995-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 //: gka 09.04.99: S4136: improving tolerance management
19 #include <StepToTopoDS_TranslateShell.ixx>
21 #include <StepToTopoDS_TranslateFace.hxx>
23 #include <StepShape_FaceSurface.hxx>
25 #include <BRep_Builder.hxx>
27 #include <TopoDS_Shell.hxx>
28 #include <TopoDS_Face.hxx>
29 #include <Transfer_TransientProcess.hxx>
31 #include <Message_ProgressIndicator.hxx>
32 #include <Message_ProgressSentry.hxx>
34 // ============================================================================
35 // Method : StepToTopoDS_TranslateShell::StepToTopoDS_TranslateShell
36 // Purpose : Empty Constructor
37 // ============================================================================
39 StepToTopoDS_TranslateShell::StepToTopoDS_TranslateShell()
41 done = Standard_False;
44 // ============================================================================
45 // Method : StepToTopoDS_TranslateShell::StepToTopoDS_TranslateShell()
46 // Purpose : Constructor with a ConnectedFaceSet and a Tool
47 // ============================================================================
49 StepToTopoDS_TranslateShell::StepToTopoDS_TranslateShell
50 (const Handle(StepShape_ConnectedFaceSet)& CFS, StepToTopoDS_Tool& T, StepToTopoDS_NMTool& NMTool)
55 // ============================================================================
57 // Purpose : Init with a ConnectedFaceSet and a Tool
58 // ============================================================================
60 void StepToTopoDS_TranslateShell::Init
61 (const Handle(StepShape_ConnectedFaceSet)& CFS, StepToTopoDS_Tool& aTool, StepToTopoDS_NMTool& NMTool)
67 if (!aTool.IsBound(CFS)) {
70 Handle(Transfer_TransientProcess) TP = aTool.TransientProcess();
72 Standard_Integer NbFc = CFS->NbCfsFaces();
77 Handle(StepShape_Face) StepFace;
79 StepToTopoDS_TranslateFace myTranFace;
80 myTranFace.SetPrecision(Precision()); //gka
81 myTranFace.SetMaxTol(MaxTol());
83 Message_ProgressSentry PS ( TP->GetProgress(), "Face", 0, NbFc, 1 );
84 for (Standard_Integer i=1; i<=NbFc && PS.More(); i++, PS.Next()) {
85 #ifdef STEPTOTOPODS_DEB
86 cout << "Processing Face : " << i << endl;
88 StepFace = CFS->CfsFacesValue(i);
89 Handle(StepShape_FaceSurface) theFS =
90 Handle(StepShape_FaceSurface)::DownCast(StepFace);
91 if (!theFS.IsNull()) {
92 myTranFace.Init(theFS, aTool, NMTool);
93 if (myTranFace.IsDone()) {
94 S = myTranFace.Value();
98 else { // Warning only + add FaceSurface file Identifier
99 TP->AddWarning(theFS," a Face from Shell not mapped to TopoDS");
102 else { // Warning : ajouter identifier
103 TP->AddWarning(StepFace," Face is not of FaceSurface Type; not mapped to TopoDS");
106 Sh.Closed (BRep_Tool::IsClosed (Sh));
108 aTool.Bind(CFS, myResult);
109 myError = StepToTopoDS_TranslateShellDone;
110 done = Standard_True;
113 myResult = TopoDS::Shell(aTool.Find(CFS));
114 myError = StepToTopoDS_TranslateShellDone;
115 done = Standard_True;
119 // ============================================================================
121 // Purpose : Return the mapped Shape
122 // ============================================================================
124 const TopoDS_Shape& StepToTopoDS_TranslateShell::Value() const
126 StdFail_NotDone_Raise_if(!done,"");
130 // ============================================================================
132 // Purpose : Return the TranslateShell Error code
133 // ============================================================================
135 StepToTopoDS_TranslateShellError StepToTopoDS_TranslateShell::Error() const