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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
//--------------------------------------------------------------------
//
// File Name : IGESSolid_Block.cxx
// Date :
// Author : CKY / Contract Toubro-Larsen
// Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------
#include <IGESSolid_ToolBlock.ixx>
#include <IGESData_ParamCursor.hxx>
#include <gp_XYZ.hxx>
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <IGESData_Dump.hxx>
IGESSolid_ToolBlock::IGESSolid_ToolBlock () { }
void IGESSolid_ToolBlock::ReadOwnParams
(const Handle(IGESSolid_Block)& ent,
const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
{
gp_XYZ tempSize, tempCorner, tempXAxis, tempZAxis;
Standard_Real tempreal;
//Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
PR.ReadXYZ(PR.CurrentList(1, 3), "Size of Block", tempSize); //szv#4:S4163:12Mar99 `st=` not needed
if (PR.DefinedElseSkip())
{
//st = PR.ReadReal(PR.Current(), "Corner Point (X)", tempreal); //szv#4:S4163:12Mar99 moved in if
if (PR.ReadReal(PR.Current(), "Corner Point (X)", tempreal))
tempCorner.SetX(tempreal);
}
else tempCorner.SetX(0.0);
if (PR.DefinedElseSkip())
{
//st = PR.ReadReal(PR.Current(), "Corner Point (Y)", tempreal); //szv#4:S4163:12Mar99 moved in if
if (PR.ReadReal(PR.Current(), "Corner Point (Y)", tempreal))
tempCorner.SetY(tempreal);
}
else tempCorner.SetY(0.0);
if (PR.DefinedElseSkip())
{
//st = PR.ReadReal(PR.Current(), "Corner Point (Z)", tempreal); //szv#4:S4163:12Mar99 moved in if
if (PR.ReadReal(PR.Current(), "Corner Point (Z)", tempreal))
tempCorner.SetZ(tempreal);
}
else tempCorner.SetZ(0.0);
if (PR.DefinedElseSkip())
{
//st = PR.ReadReal(PR.Current(), "Local X axis (I)", tempreal); //szv#4:S4163:12Mar99 moved in if
if (PR.ReadReal(PR.Current(), "Local X axis (I)", tempreal))
tempXAxis.SetX(tempreal);
}
else tempXAxis.SetX(1.0);
if (PR.DefinedElseSkip())
{
//st = PR.ReadReal(PR.Current(), "Local X axis (J)", tempreal); //szv#4:S4163:12Mar99 moved in if
if (PR.ReadReal(PR.Current(), "Local X axis (J)", tempreal))
tempXAxis.SetY(tempreal);
}
else tempXAxis.SetY(0.0);
if (PR.DefinedElseSkip())
{
//st = PR.ReadReal(PR.Current(), "Local X axis (K)", tempreal); //szv#4:S4163:12Mar99 moved in if
if (PR.ReadReal(PR.Current(), "Local X axis (K)", tempreal))
tempXAxis.SetZ(tempreal);
}
else tempXAxis.SetZ(0.0);
if (PR.DefinedElseSkip())
{
//st = PR.ReadReal(PR.Current(), "Local Z axis (I)", tempreal); //szv#4:S4163:12Mar99 moved in if
if (PR.ReadReal(PR.Current(), "Local Z axis (I)", tempreal))
tempZAxis.SetX(tempreal);
}
else tempZAxis.SetX(0.0);
if (PR.DefinedElseSkip())
{
//st = PR.ReadReal(PR.Current(), "Local Z axis (J)", tempreal); //szv#4:S4163:12Mar99 moved in if
if (PR.ReadReal(PR.Current(), "Local Z axis (J)", tempreal))
tempZAxis.SetY(tempreal);
}
else tempZAxis.SetY(0.0);
if (PR.DefinedElseSkip())
{
//st = PR.ReadReal(PR.Current(), "Local Z axis (K)", tempreal); //szv#4:S4163:12Mar99 moved in if
if (PR.ReadReal(PR.Current(), "Local Z axis (K)", tempreal))
tempZAxis.SetZ(tempreal);
}
else tempZAxis.SetZ(1.0);
DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
ent->Init(tempSize, tempCorner, tempXAxis, tempZAxis);
Standard_Real eps = 1.E-05;
if (!tempXAxis.IsEqual(ent->XAxis().XYZ(),eps)) PR.AddWarning
("XAxis poorly unitary, normalized");
if (!tempZAxis.IsEqual(ent->ZAxis().XYZ(),eps)) PR.AddWarning
("ZAxis poorly unitary, normalized");
}
void IGESSolid_ToolBlock::WriteOwnParams
(const Handle(IGESSolid_Block)& ent, IGESData_IGESWriter& IW) const
{
IW.Send(ent->Size().X());
IW.Send(ent->Size().Y());
IW.Send(ent->Size().Z());
IW.Send(ent->Corner().X());
IW.Send(ent->Corner().Y());
IW.Send(ent->Corner().Z());
IW.Send(ent->XAxis().X());
IW.Send(ent->XAxis().Y());
IW.Send(ent->XAxis().Z());
IW.Send(ent->ZAxis().X());
IW.Send(ent->ZAxis().Y());
IW.Send(ent->ZAxis().Z());
}
void IGESSolid_ToolBlock::OwnShared
(const Handle(IGESSolid_Block)& /* ent */, Interface_EntityIterator& /* iter */) const
{
}
void IGESSolid_ToolBlock::OwnCopy
(const Handle(IGESSolid_Block)& another,
const Handle(IGESSolid_Block)& ent, Interface_CopyTool& /* TC */) const
{
ent->Init(another->Size(), another->Corner().XYZ(),
another->XAxis().XYZ(), another->ZAxis().XYZ());
}
IGESData_DirChecker IGESSolid_ToolBlock::DirChecker
(const Handle(IGESSolid_Block)& /* ent */ ) const
{
IGESData_DirChecker DC(150, 0);
DC.Structure (IGESData_DefVoid);
DC.LineFont (IGESData_DefAny);
DC.Color (IGESData_DefAny);
DC.UseFlagRequired (0);
return DC;
}
void IGESSolid_ToolBlock::OwnCheck
(const Handle(IGESSolid_Block)& ent,
const Interface_ShareTool& , Handle(Interface_Check)& ach) const
{
Standard_Real eps = 1.E-04;
Standard_Real prosca = ent->XAxis() * ent->ZAxis();
if (prosca < -eps || prosca > eps)
ach->AddFail("Local Z axis : Not orthogonal to X axis");
if (ent->Size().X() <= 0. || ent->Size().Y() <= 0. || ent->Size().Z() <= 0.)
ach->AddFail("Size : Not positive lengths");
}
void IGESSolid_ToolBlock::OwnDump
(const Handle(IGESSolid_Block)& ent, const IGESData_IGESDumper& /* dumper */,
const Handle(Message_Messenger)& S, const Standard_Integer level) const
{
S << "IGESSolid_Block" << endl;
S << "Size : ";
IGESData_DumpXYZ(S, ent->Size());
S << endl << "Corner : ";
IGESData_DumpXYZL(S,level, ent->Corner(), ent->Location());
S << endl << "XAxis : ";
IGESData_DumpXYZL(S,level, ent->XAxis(), ent->VectorLocation());
S << endl << "ZAxis : ";
IGESData_DumpXYZL(S,level, ent->ZAxis(), ent->VectorLocation());
S << endl;
}
|