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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
// File: StepToTopoDS_TranslateVertex.cxx
// Created: Tue Jan 3 15:00:17 1995
// Author: Frederic MAUPAS
// <fma@stylox>
//: gka 09.04.99: S4136: eliminate BRepAPI::Precision()
#include <StepToTopoDS_TranslateVertex.ixx>
#include <StepToGeom_MakeCartesianPoint.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <BRep_Builder.hxx>
//#include <BRepAPI.hxx>
#include <StepGeom_Point.hxx>
#include <StepGeom_CartesianPoint.hxx>
#include <StepShape_VertexPoint.hxx>
#include <StepShape_Vertex.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Precision.hxx>
// For I-DEAS-like processing (ssv; 15.11.2010)
#include <TCollection_HAsciiString.hxx>
// ============================================================================
// Method : StepToTopoDS_TranslateVertex::StepToTopoDS_TranslateVertex
// Purpose : Empty Constructor
// ============================================================================
StepToTopoDS_TranslateVertex::StepToTopoDS_TranslateVertex()
{
done = Standard_False;
}
// ============================================================================
// Method : StepToTopoDS_TranslateVertex::StepToTopoDS_TranslateVertex
// Purpose : Constructor with a Vertex and a Tool
// ============================================================================
StepToTopoDS_TranslateVertex::StepToTopoDS_TranslateVertex(const Handle(StepShape_Vertex)& V,
StepToTopoDS_Tool& T,
StepToTopoDS_NMTool& NMTool)
{
Init(V, T, NMTool);
}
// ============================================================================
// Method : Init
// Purpose : Init with a Vertex and a Tool
// ============================================================================
void StepToTopoDS_TranslateVertex::Init(const Handle(StepShape_Vertex)& aVertex,
StepToTopoDS_Tool& aTool,
StepToTopoDS_NMTool& NMTool)
{
if (!aTool.IsBound(aVertex)) {
// [BEGIN] Proceed with non-manifold topology (ssv; 14.11.2010)
if ( NMTool.IsActive() && NMTool.IsBound(aVertex) ) {
myResult = NMTool.Find(aVertex);
myError = StepToTopoDS_TranslateVertexDone;
done = Standard_True;
return;
}
// [END] Proceed with non-manifold topology (ssv; 14.11.2010)
// [BEGIN] Proceed with I-DEAS-like STP (ssv; 15.11.2010)
const Handle(TCollection_HAsciiString) aVName = aVertex->Name();
if ( NMTool.IsActive() && NMTool.IsIDEASCase() &&
!aVName.IsNull() && !aVName->IsEmpty() && NMTool.IsBound(aVName->String()) ) {
myResult = NMTool.Find(aVName->String());
myError = StepToTopoDS_TranslateVertexDone;
done = Standard_True;
return;
}
// [END] Proceed with I-DEAS-like STP (ssv; 15.11.2010)
//:S4136 Standard_Real preci = BRepAPI::Precision();
const Handle(StepShape_VertexPoint) VP = Handle(StepShape_VertexPoint)::DownCast(aVertex);
const Handle(StepGeom_Point) P = VP->VertexGeometry();
const Handle(StepGeom_CartesianPoint) P1 = Handle(StepGeom_CartesianPoint)::DownCast(P);
Handle(Geom_CartesianPoint) P2;
StepToGeom_MakeCartesianPoint::Convert(P1,P2);
BRep_Builder B;
TopoDS_Vertex V;
B.MakeVertex(V, P2->Pnt(), Precision::Confusion()); //:S4136: preci
aTool.Bind(aVertex,V);
// Register Vertex in NM tool (ssv; 14.11.2010)
if ( NMTool.IsActive() ) {
NMTool.Bind(aVertex, V);
if ( NMTool.IsIDEASCase() && !aVName.IsNull() && !aVName->IsEmpty() )
NMTool.Bind(aVName->String(), V);
}
myResult = V;
}
else {
myResult = TopoDS::Vertex(aTool.Find(aVertex));
}
myError = StepToTopoDS_TranslateVertexDone;
done = Standard_True;
}
// ============================================================================
// Method : Value
// Purpose : Return the mapped Shape
// ============================================================================
const TopoDS_Shape& StepToTopoDS_TranslateVertex::Value() const
{
StdFail_NotDone_Raise_if(!done,"");
return myResult;
}
// ============================================================================
// Method : Error
// Purpose : Return the TranslateVertex Error Code
// ============================================================================
StepToTopoDS_TranslateVertexError StepToTopoDS_TranslateVertex::Error() const
{
return myError;
}
|