1 // File: StepToTopoDS_TranslateShell.cxx
2 // Created: Tue Jan 3 14:01:53 1995
3 // Author: Frederic MAUPAS
5 //: gka 09.04.99: S4136: improving tolerance management
7 #include <StepToTopoDS_TranslateShell.ixx>
9 #include <StepToTopoDS_TranslateFace.hxx>
11 #include <StepShape_FaceSurface.hxx>
13 #include <BRep_Builder.hxx>
15 #include <TopoDS_Shell.hxx>
16 #include <TopoDS_Face.hxx>
17 #include <Transfer_TransientProcess.hxx>
19 #include <Message_ProgressIndicator.hxx>
20 #include <Message_ProgressSentry.hxx>
22 // ============================================================================
23 // Method : StepToTopoDS_TranslateShell::StepToTopoDS_TranslateShell
24 // Purpose : Empty Constructor
25 // ============================================================================
27 StepToTopoDS_TranslateShell::StepToTopoDS_TranslateShell()
29 done = Standard_False;
32 // ============================================================================
33 // Method : StepToTopoDS_TranslateShell::StepToTopoDS_TranslateShell()
34 // Purpose : Constructor with a ConnectedFaceSet and a Tool
35 // ============================================================================
37 StepToTopoDS_TranslateShell::StepToTopoDS_TranslateShell
38 (const Handle(StepShape_ConnectedFaceSet)& CFS, StepToTopoDS_Tool& T, StepToTopoDS_NMTool& NMTool)
43 // ============================================================================
45 // Purpose : Init with a ConnectedFaceSet and a Tool
46 // ============================================================================
48 void StepToTopoDS_TranslateShell::Init
49 (const Handle(StepShape_ConnectedFaceSet)& CFS, StepToTopoDS_Tool& aTool, StepToTopoDS_NMTool& NMTool)
55 if (!aTool.IsBound(CFS)) {
58 Handle(Transfer_TransientProcess) TP = aTool.TransientProcess();
60 Standard_Integer NbFc = CFS->NbCfsFaces();
65 Handle(StepShape_Face) StepFace;
67 StepToTopoDS_TranslateFace myTranFace;
68 myTranFace.SetPrecision(Precision()); //gka
69 myTranFace.SetMaxTol(MaxTol());
71 Message_ProgressSentry PS ( TP->GetProgress(), "Face", 0, NbFc, 1 );
72 for (Standard_Integer i=1; i<=NbFc && PS.More(); i++, PS.Next()) {
74 cout << "Processing Face : " << i << endl;
76 StepFace = CFS->CfsFacesValue(i);
77 Handle(StepShape_FaceSurface) theFS =
78 Handle(StepShape_FaceSurface)::DownCast(StepFace);
79 if (!theFS.IsNull()) {
80 myTranFace.Init(theFS, aTool, NMTool);
81 if (myTranFace.IsDone()) {
82 S = myTranFace.Value();
86 else { // Warning only + add FaceSurface file Identifier
87 TP->AddWarning(theFS," a Face from Shell not mapped to TopoDS");
90 else { // Warning : ajouter identifier
91 TP->AddWarning(StepFace," Face is not of FaceSurface Type; not mapped to TopoDS");
95 aTool.Bind(CFS, myResult);
96 myError = StepToTopoDS_TranslateShellDone;
100 myResult = TopoDS::Shell(aTool.Find(CFS));
101 myError = StepToTopoDS_TranslateShellDone;
102 done = Standard_True;
106 // ============================================================================
108 // Purpose : Return the mapped Shape
109 // ============================================================================
111 const TopoDS_Shape& StepToTopoDS_TranslateShell::Value() const
113 StdFail_NotDone_Raise_if(!done,"");
117 // ============================================================================
119 // Purpose : Return the TranslateShell Error code
120 // ============================================================================
122 StepToTopoDS_TranslateShellError StepToTopoDS_TranslateShell::Error() const