1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
// File: TopoDSToStep_MakeManifoldSolidBrep.cxx
// Created: Fri Jul 23 15:31:00 1993
// Author: Martine LANGLOIS
// <mla@mastox>
#include <TopoDSToStep_MakeManifoldSolidBrep.ixx>
#include <StdFail_NotDone.hxx>
#include <TopoDSToStep.hxx>
#include <TopoDSToStep_Builder.hxx>
#include <TopoDSToStep_Tool.hxx>
#include <BRepTools.hxx>
#include <Transfer_FinderProcess.hxx>
#include <TransferBRep_ShapeMapper.hxx>
#include <TCollection_HAsciiString.hxx>
#include <StepShape_ClosedShell.hxx>
#include <StepShape_OpenShell.hxx>
#include <StepShape_HArray1OfFace.hxx>
static Handle(StepShape_ManifoldSolidBrep) MakeManifoldSolidBrep (const TopoDS_Shell& aShell,
const Handle(Transfer_FinderProcess)& FP)
{
Handle(StepShape_ManifoldSolidBrep) theManifoldSolidBrep;
MoniTool_DataMapOfShapeTransient aMap;
TopoDSToStep_Tool aTool(aMap, Standard_False);
TopoDSToStep_Builder StepB(aShell, aTool, FP);
TopoDSToStep::AddResult(FP, aTool);
if (StepB.IsDone()) {
Handle(StepShape_ClosedShell) aCShell = Handle(StepShape_ClosedShell)::DownCast(StepB.Value());
// si OPEN on le force a CLOSED mais que c est une honte !
if (aCShell.IsNull()) {
Handle(StepShape_OpenShell) aOShell = Handle(StepShape_OpenShell)::DownCast(StepB.Value());
if (aOShell.IsNull()) return theManifoldSolidBrep;
else {
aCShell = new StepShape_ClosedShell;
aCShell->Init(aOShell->Name(),aOShell->CfsFaces());
}
}
theManifoldSolidBrep = new StepShape_ManifoldSolidBrep();
Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString("");
theManifoldSolidBrep->Init(aName, aCShell);
}
return theManifoldSolidBrep;
}
//=============================================================================
// Create a ManifoldSolidBrep of StepShape from a Shell of TopoDS
//=============================================================================
TopoDSToStep_MakeManifoldSolidBrep::
TopoDSToStep_MakeManifoldSolidBrep(const TopoDS_Shell& aShell,
const Handle(Transfer_FinderProcess)& FP)
{
theManifoldSolidBrep = MakeManifoldSolidBrep(aShell, FP);
done = !theManifoldSolidBrep.IsNull();
if (!done) {
Handle(TransferBRep_ShapeMapper) errShape = new TransferBRep_ShapeMapper(aShell);
FP->AddWarning(errShape, " Closed Shell not mapped to ManifoldSolidBrep");
}
}
//=============================================================================
// Create a ManifoldSolidBrep of StepShape from a Solid of TopoDS containing
// only one closed shell
//=============================================================================
TopoDSToStep_MakeManifoldSolidBrep::
TopoDSToStep_MakeManifoldSolidBrep(const TopoDS_Solid& aSolid,
const Handle(Transfer_FinderProcess)& FP)
{
TopoDS_Shell aOuterShell = BRepTools::OuterShell(aSolid);
if (!aOuterShell.IsNull()) {
theManifoldSolidBrep = MakeManifoldSolidBrep(aOuterShell, FP);
done = !theManifoldSolidBrep.IsNull();
if (!done) {
Handle(TransferBRep_ShapeMapper) errShape = new TransferBRep_ShapeMapper(aOuterShell);
FP->AddWarning(errShape, " Outer Shell of Solid not mapped to ManifoldSolidBrep");
}
}
else {
Handle(TransferBRep_ShapeMapper) errShape = new TransferBRep_ShapeMapper(aOuterShell);
FP->AddWarning(errShape, " Outer Shell is null; not mapped to ManifoldSolidBrep ");
done = Standard_False;
}
}
//=============================================================================
// renvoi des valeurs
//=============================================================================
const Handle(StepShape_ManifoldSolidBrep) &
TopoDSToStep_MakeManifoldSolidBrep::Value() const
{
StdFail_NotDone_Raise_if(!done,"");
return theManifoldSolidBrep;
}
|