1
/***************************************************************************
2
* Copyright (c) 2005 Imetric 3D GmbH *
4
* This file is part of the FreeCAD CAx development system. *
6
* This library is free software; you can redistribute it and/or *
7
* modify it under the terms of the GNU Library General Public *
8
* License as published by the Free Software Foundation; either *
9
* version 2 of the License, or (at your option) any later version. *
11
* This library is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU Library General Public License for more details. *
16
* You should have received a copy of the GNU Library General Public *
17
* License along with this library; see the file COPYING.LIB. If not, *
18
* write to the Free Software Foundation, Inc., 59 Temple Place, *
19
* Suite 330, Boston, MA 02111-1307, USA *
21
***************************************************************************/
27
#include "MeshKernel.h"
28
#include <Base/Vector3D.h>
29
#include <App/Material.h>
41
* The MeshInput class is able to read a mesh object from a input stream
44
class MeshExport MeshInput
47
MeshInput (MeshKernel &rclM): _rclMesh(rclM){};
48
virtual ~MeshInput (void) { }
50
/// Loads the file, decided by extension
51
bool LoadAny(const char* FileName);
52
/** Loads an STL file either in binary or ASCII format.
53
* Therefore the file header gets checked to decide if the file is binary or not.
55
bool LoadSTL (std::istream &rstrIn);
56
/** Loads an ASCII STL file. */
57
bool LoadAsciiSTL (std::istream &rstrIn);
58
/** Loads a binary STL file. */
59
bool LoadBinarySTL (std::istream &rstrIn);
60
/** Loads an OBJ Mesh file. */
61
bool LoadOBJ (std::istream &rstrIn);
62
/** Loads the mesh object from an XML file. */
63
void LoadXML (Base::XMLReader &reader);
64
/** Loads a node from an OpenInventor file. */
65
bool LoadMeshNode (std::istream &rstrIn);
66
/** Loads an OpenInventor file. */
67
bool LoadInventor (std::istream &rstrIn);
68
/** Loads a Nastran file. */
69
bool LoadNastran (std::istream &rstrIn);
70
/** Loads a Cadmould FE file. */
71
bool LoadCadmouldFE (std::ifstream &rstrIn);
74
MeshKernel &_rclMesh; /**< reference to mesh data structure */
78
* The MeshOutput class is able to write a mesh object to an ouput stream
81
class MeshExport MeshOutput
97
MeshOutput (const MeshKernel &rclM): _rclMesh(rclM){};
98
virtual ~MeshOutput (void) { }
99
/// Saves the file, decided by extension if not explicitly given
100
bool SaveAny(const char* FileName, Format f=Undefined) const;
102
/** Saves the mesh object into an ASCII STL file. */
103
bool SaveAsciiSTL (std::ostream &rstrOut) const;
104
/** Saves the mesh object into a binary STL file. */
105
bool SaveBinarySTL (std::ostream &rstrOut) const;
106
/** Saves the mesh object into an OBJ file. */
107
bool SaveOBJ (std::ostream &rstrOut) const;
108
/** Saves the mesh object into an XML file. */
109
void SaveXML (Base::Writer &writer) const;
110
/** Saves a node to an OpenInventor file. */
111
bool SaveMeshNode (std::ostream &rstrIn);
112
/** Writes an OpenInventor file. */
113
bool SaveInventor (std::ostream &rstrOut) const;
114
/** Writes a VRML file. */
115
bool SaveVRML (std::ostream &rstrOut, const App::Material &rclMat) const;
116
/** Writes a Nastran file. */
117
bool SaveNastran (std::ostream &rstrOut) const;
118
/** Writes a Cadmould FE file. */
119
bool SaveCadmouldFE (std::ostream &rstrOut) const;
120
/** Writes a python module which creates a mesh */
121
bool SavePython (std::ostream &rstrOut) const;
124
const MeshKernel &_rclMesh; /**< reference to mesh data structure */
127
struct MeshExport VRMLViewpointData
129
Base::Vector3f clVRefPln;
130
Base::Vector3f clVRefUp;
131
Base::Vector3f clVRefPt;
132
Base::Vector3f clPRefPt;
141
struct MeshExport VRMLInfo
143
std::string _clFileName;
144
std::string _clAuthor;
146
std::string _clCompany;
147
std::string _clAnnotation;
148
std::string _clPicFileName;
150
bool _bSaveViewPoints;
152
std::vector<std::string> _clComments;
153
std::vector<VRMLViewpointData> _clViewpoints;
157
} // namespace MeshCore