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)
4 #include "bbcreaVtkBooleanOperationPolyDataFilter.h"
5 #include "bbcreaVtkPackage.h"
7 #include "vtkBooleanOperationPolyDataFilter.h"
8 #include "vtkCleanPolyData.h"
9 #include "vtkTriangleFilter.h"
14 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,BooleanOperationPolyDataFilter)
15 BBTK_BLACK_BOX_IMPLEMENTATION(BooleanOperationPolyDataFilter,bbtk::AtomicBlackBox);
17 // 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)
19 void BooleanOperationPolyDataFilter::Process()
22 // THE MAIN PROCESSING METHOD BODY
23 // Here we simply set the input 'In' value to the output 'Out'
24 // And print out the output value
25 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
26 // void bbSet{Input|Output}NAME(const TYPE&)
27 // const TYPE& bbGet{Input|Output}NAME() const
29 // * NAME is the name of the input/output
30 // (the one provided in the attribute 'name' of the tag 'input')
31 // * TYPE is the C++ type of the input/output
32 // (the one provided in the attribute 'type' of the tag 'input')
33 // bbSetOutputOut( bbGetInputIn() );
34 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
36 if ((bbGetInputIn1()!=NULL) && (bbGetInputIn2()!=NULL) )
39 printf("EED Warnning BooleanOperationPolyDataFilter::Process Put this code at the end of CreateMesh.. or create 2 new boxes\n");
40 printf("EED Warnning BooleanOperationPolyDataFilter::Process Put this code at the end of CreateMesh.. or create 2 new boxes\n");
41 printf("EED Warnning BooleanOperationPolyDataFilter::Process Put this code at the end of CreateMesh.. or create 2 new boxes\n");
42 printf("EED Warnning BooleanOperationPolyDataFilter::Process Put this code at the end of CreateMesh.. or create 2 new boxes\n");
43 printf("EED Warnning BooleanOperationPolyDataFilter::Process Put this code at the end of CreateMesh.. or create 2 new boxes\n");
44 printf("EED Warnning BooleanOperationPolyDataFilter::Process Put this code at the end of CreateMesh.. or create 2 new boxes\n");
45 printf("EED Warnning BooleanOperationPolyDataFilter::Process Put this code at the end of CreateMesh.. or create 2 new boxes\n");
46 printf("EED Warnning BooleanOperationPolyDataFilter::Process Put this code at the end of CreateMesh.. or create 2 new boxes\n");
47 vtkCleanPolyData *clean1 = vtkCleanPolyData::New();
48 vtkCleanPolyData *clean2 = vtkCleanPolyData::New();
49 clean1->SetInputData( bbGetInputIn1() );
50 clean2->SetInputData( bbGetInputIn2() );
53 vtkTriangleFilter *triangle1 = vtkTriangleFilter::New();
54 vtkTriangleFilter *triangle2 = vtkTriangleFilter::New();
55 triangle1->SetInputData( clean1->GetOutput() );
56 triangle2->SetInputData( clean2->GetOutput() );
60 vtkBooleanOperationPolyDataFilter *booleanOperation = vtkBooleanOperationPolyDataFilter::New();
61 booleanOperation->SetInputData(0, triangle1->GetOutput() );
62 booleanOperation->SetInputData(1, triangle2->GetOutput() );
64 if (bbGetInputOperation()==0 )
66 booleanOperation->SetOperationToUnion();
68 if (bbGetInputOperation()==1 )
70 booleanOperation->SetOperationToIntersection();
72 if (bbGetInputOperation()==2 )
74 booleanOperation->SetOperationToDifference();
76 booleanOperation->Update();
77 bbSetOutputOut( booleanOperation->GetOutput() );
79 printf("EED Warnning! BooleanOperationPolyDataFilter::Process vtkPolyData In1 or In2 is EMPTY\n");
80 } // if In1 In2 != NULL
83 // 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)
85 void BooleanOperationPolyDataFilter::bbUserSetDefaultValues()
88 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
89 // Here we initialize the input 'In' to 0
92 bbSetInputOperation(0);
96 // 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)
98 void BooleanOperationPolyDataFilter::bbUserInitializeProcessing()
101 // THE INITIALIZATION METHOD BODY :
103 // but this is where you should allocate the internal/output pointers
109 // 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)
111 void BooleanOperationPolyDataFilter::bbUserFinalizeProcessing()
114 // THE FINALIZATION METHOD BODY :
116 // but this is where you should desallocate the internal/output pointers
121 // EO namespace bbcreaVtk