Microflow 3D  v1.0
MF::RW::STLReaderTyti Class Reference

The object of STLReaderTyti class reads the .stl surface grid. More...

#include <STLReader.h>

Public Member Functions

 STLReaderTyti (const std::string &FileName, bool verbose=false)
 
 ~STLReaderTyti ()=default
 
std::pair< tyti::stl::basic_solid< float >, bool > & getSTLGrid_ref ()
 

Detailed Description

The object of STLReaderTyti class reads the .stl surface grid.

If verbose mode is true, prints the content of file on the console.

Definition at line 23 of file STLReader.h.

Constructor & Destructor Documentation

◆ STLReaderTyti()

MF::RW::STLReaderTyti::STLReaderTyti ( const std::string &  FileName,
bool  verbose = false 
)
explicit

Definition at line 13 of file STLReader.cpp.

13  {
14 
15  // Check the file existence
16  std::ifstream isFile(FileName);
17  if (!isFile.good())
18  throw std::runtime_error(FileName + " - File not found!");
19  // Reading .stl file.
20  stlGrid = tyti::stl::read<float>(FileName);
21  std::cout << "Grid from " << FileName << " has been read successfully ----> " << stlGrid.first.header << std::endl;
22  // If verbose is true, the stl file content is displayed
23  if (verbose) {
24  std::cout << "solid " << stlGrid.first.header << std::endl;
25  for (size_t i = 0; i < stlGrid.first.normals.size(); ++i) {
26  std::cout << "\tfacet normal "
27  << " " << stlGrid.first.normals[i].data[0] << " "
28  << " " << stlGrid.first.normals[i].data[1] << " "
29  << " " << stlGrid.first.normals[i].data[2] << " "
30  << "\n";
31 
32  std::cout << "\t\touter loop\n";
33  for (int j : {0, 1, 2}) {
34  std::cout << "\t\t\tvertex"
35  << " " << stlGrid.first.vertices[3 * i + j].data[0] << " "
36  << " " << stlGrid.first.vertices[3 * i + j].data[1] << " "
37  << " " << stlGrid.first.vertices[3 * i + j].data[2] << " "
38  << "\n";
39  }
40  std::cout << "\t\tendloop\n"
41  << "\tendfacet\n";
42  }
43  std::cout << "endsolid " << stlGrid.first.header << "\n";
44  }
45 }

◆ ~STLReaderTyti()

MF::RW::STLReaderTyti::~STLReaderTyti ( )
default

Member Function Documentation

◆ getSTLGrid_ref()

std::pair<tyti::stl::basic_solid<float>, bool>& MF::RW::STLReaderTyti::getSTLGrid_ref ( )
inline

Definition at line 29 of file STLReader.h.

29 {return stlGrid;}

The documentation for this class was generated from the following files: