]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkStlWriter.cxx
#3251 creaVtk Feature New Normal - STL read write and Mesh_reduction
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkStlWriter.cxx
1 //===== 
2 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
3 //===== 
4 #include "bbcreaVtkStlWriter.h"
5 #include "bbcreaVtkPackage.h"
6
7 #include "vtkSTLWriter.h"
8 namespace bbcreaVtk
9 {
10
11 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,StlWriter)
12 BBTK_BLACK_BOX_IMPLEMENTATION(StlWriter,bbtk::AtomicBlackBox);
13 //===== 
14 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
15 //===== 
16 void StlWriter::Process()
17 {
18
19 // THE MAIN PROCESSING METHOD BODY
20 //   Here we simply set the input 'In' value to the output 'Out'
21 //   And print out the output value
22 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
23 //    void bbSet{Input|Output}NAME(const TYPE&)
24 //    const TYPE& bbGet{Input|Output}NAME() const 
25 //    Where :
26 //    * NAME is the name of the input/output
27 //      (the one provided in the attribute 'name' of the tag 'input')
28 //    * TYPE is the C++ type of the input/output
29 //      (the one provided in the attribute 'type' of the tag 'input')
30
31 //    bbSetOutputOut( bbGetInputIn() );
32 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
33   
34         if ((bbGetInputIn()!=NULL) && (bbGetInputFileName()!=""))
35         {
36                 vtkSTLWriter *writer = vtkSTLWriter::New();
37                 if (bbGetInputAscii()==true)
38                 {
39                         writer->SetFileTypeToASCII();
40                 } else {
41                         writer->SetFileTypeToBinary();
42                 }  // if Ascii
43                 writer->SetInputData( bbGetInputIn() );
44                 writer->SetFileName( bbGetInputFileName().c_str() );
45                 writer->Write();
46                 writer->Delete();
47         } // if In Filename
48
49 }
50 //===== 
51 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
52 //===== 
53 void StlWriter::bbUserSetDefaultValues()
54 {
55
56 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
57 //    Here we initialize the input 'In' to 0
58    bbSetInputIn(NULL);
59    bbSetInputFileName("");
60    bbSetInputAscii(true);
61   
62 }
63 //===== 
64 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
65 //===== 
66 void StlWriter::bbUserInitializeProcessing()
67 {
68
69 //  THE INITIALIZATION METHOD BODY :
70 //    Here does nothing 
71 //    but this is where you should allocate the internal/output pointers 
72 //    if any 
73
74   
75 }
76 //===== 
77 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
78 //===== 
79 void StlWriter::bbUserFinalizeProcessing()
80 {
81
82 //  THE FINALIZATION METHOD BODY :
83 //    Here does nothing 
84 //    but this is where you should desallocate the internal/output pointers 
85 //    if any
86   
87 }
88 }
89 // EO namespace bbcreaVtk
90
91