summaryrefslogtreecommitdiff
path: root/src/IGESSolid/IGESSolid_ToolSolidOfLinearExtrusion.cxx
blob: 93c01c30bfe979aae61a768021d31b5edf51859e (plain)
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
//--------------------------------------------------------------------
//
//  File Name : IGESSolid_SolidOfLinearExtrusion.cxx
//  Date      :
//  Author    : CKY / Contract Toubro-Larsen
//  Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------

#include <IGESSolid_ToolSolidOfLinearExtrusion.ixx>
#include <IGESData_ParamCursor.hxx>
#include <IGESData_IGESEntity.hxx>
#include <gp_XYZ.hxx>
#include <IGESData_Dump.hxx>
#include <Interface_Macros.hxx>


IGESSolid_ToolSolidOfLinearExtrusion::IGESSolid_ToolSolidOfLinearExtrusion ()
      {  }


void  IGESSolid_ToolSolidOfLinearExtrusion::ReadOwnParams
  (const Handle(IGESSolid_SolidOfLinearExtrusion)& ent,
   const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
{
  Handle(IGESData_IGESEntity) tempEntity;
  gp_XYZ tempDirection;
  Standard_Real tempLength;
  Standard_Real tempreal;
  //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed

  PR.ReadEntity(IR, PR.Current(), "Curve Entity", tempEntity); //szv#4:S4163:12Mar99 `st=` not needed

  PR.ReadReal(PR.Current(), "Length of extrusion", tempLength); //szv#4:S4163:12Mar99 `st=` not needed

  if (PR.DefinedElseSkip())
    {
      //st = PR.ReadReal(PR.Current(), "Extrusion direction (I)", tempreal); //szv#4:S4163:12Mar99 moved in if
      if (PR.ReadReal(PR.Current(), "Extrusion direction (I)", tempreal))
	tempDirection.SetX(tempreal);
    }
  else  tempDirection.SetX(0.0);

  if (PR.DefinedElseSkip())
    {
      //st = PR.ReadReal(PR.Current(), "Extrusion direction (J)", tempreal); //szv#4:S4163:12Mar99 moved in if
      if (PR.ReadReal(PR.Current(), "Extrusion direction (J)", tempreal))
	tempDirection.SetY(tempreal);
    }
  else  tempDirection.SetY(0.0);

  if (PR.DefinedElseSkip())
    {
      //st = PR.ReadReal(PR.Current(), "Extrusion direction (K)", tempreal); //szv#4:S4163:12Mar99 moved in if
      if (PR.ReadReal(PR.Current(), "Extrusion direction (K)", tempreal))
	tempDirection.SetZ(tempreal);
    }
  else  tempDirection.SetZ(1.0);

  DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
  ent->Init(tempEntity, tempLength, tempDirection);
  Standard_Real eps = 1.E-05;
  if (!tempDirection.IsEqual(ent->ExtrusionDirection().XYZ(),eps))
    PR.AddWarning("Extrusion Direction poorly unitary, normalized");
}

void  IGESSolid_ToolSolidOfLinearExtrusion::WriteOwnParams
  (const Handle(IGESSolid_SolidOfLinearExtrusion)& ent, IGESData_IGESWriter& IW) const
{
  IW.Send(ent->Curve());
  IW.Send(ent->ExtrusionLength());
  IW.Send(ent->ExtrusionDirection().X());
  IW.Send(ent->ExtrusionDirection().Y());
  IW.Send(ent->ExtrusionDirection().Z());
}

void  IGESSolid_ToolSolidOfLinearExtrusion::OwnShared
  (const Handle(IGESSolid_SolidOfLinearExtrusion)& ent, Interface_EntityIterator& iter) const
{
  iter.GetOneItem(ent->Curve());
}

void  IGESSolid_ToolSolidOfLinearExtrusion::OwnCopy
  (const Handle(IGESSolid_SolidOfLinearExtrusion)& another,
   const Handle(IGESSolid_SolidOfLinearExtrusion)& ent, Interface_CopyTool& TC) const
{
  DeclareAndCast(IGESData_IGESEntity, tempEntity,
		 TC.Transferred(another->Curve()));
  Standard_Real tempLength = another->ExtrusionLength();
  gp_XYZ tempDirection = another->ExtrusionDirection().XYZ();
  ent->Init(tempEntity, tempLength, tempDirection);
}

IGESData_DirChecker  IGESSolid_ToolSolidOfLinearExtrusion::DirChecker
  (const Handle(IGESSolid_SolidOfLinearExtrusion)& /* ent */ ) const
{
  IGESData_DirChecker DC(164, 0);

  DC.Structure  (IGESData_DefVoid);
  DC.LineFont   (IGESData_DefAny);
  DC.Color      (IGESData_DefAny);

  DC.UseFlagRequired (0);
  DC.HierarchyStatusIgnored ();
  return DC;
}

void  IGESSolid_ToolSolidOfLinearExtrusion::OwnCheck
  (const Handle(IGESSolid_SolidOfLinearExtrusion)& ent,
   const Interface_ShareTool& , Handle(Interface_Check)& ach) const
{
  if (ent->ExtrusionLength() <= 0.0)
    ach->AddFail("Length of extrusion : Not Positive");
}

void  IGESSolid_ToolSolidOfLinearExtrusion::OwnDump
  (const Handle(IGESSolid_SolidOfLinearExtrusion)& ent, const IGESData_IGESDumper& dumper,
   const Handle(Message_Messenger)& S, const Standard_Integer level) const
{
  S << "IGESSolid_SolidOfLinearExtrusion" << endl;

  S << "Curve entity        : ";
  dumper.Dump(ent->Curve(),S, (level <= 4) ? 0 : 1);
  S << endl;
  S << "Extrusion length    : " << ent->ExtrusionLength() << endl;
  S << "Extrusion direction : ";
  IGESData_DumpXYZL(S,level, ent->ExtrusionDirection(), ent->VectorLocation());
  S << endl;
}