// #include "vtkBooleanOperationPolyDataFilter.h"
#include "vtkPolyDataBooleanFilter.h"
+#include "vtkPoints.h"
#include "vtkCleanPolyData.h"
#include "vtkTriangleFilter.h"
-
namespace bbcreaVtk
{
// bbSetOutputOut( bbGetInputIn() );
// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+ printf("EED BooleanOperationPolyDataFilter::Process Start In1=%p In2=%p\n", bbGetInputIn1(), bbGetInputIn2() );
+
+
+
if ((bbGetInputIn1()!=NULL) && (bbGetInputIn2()!=NULL) )
{
+ vtkPoints *points1 = bbGetInputIn1()->GetPoints();
+ vtkPoints *points2 = bbGetInputIn2()->GetPoints();
+ printf("EED BooleanOperationPolyDataFilter::Process Number of points 1 %ld\n", points1->GetNumberOfPoints() );
+ printf("EED BooleanOperationPolyDataFilter::Process Number of points 2 %ld\n", points2->GetNumberOfPoints() );
+
+
printf("EED Warnning BooleanOperationPolyDataFilter::Process Put this code at the end of CreateMesh.. or create 2 new boxes\n");
printf("EED Warnning BooleanOperationPolyDataFilter::Process Put this code at the end of CreateMesh.. or create 2 new boxes\n");
printf("EED Warnning BooleanOperationPolyDataFilter::Process Put this code at the end of CreateMesh.. or create 2 new boxes\n");
}
*/
- booleanOperation->Update();
- bbSetOutputOut( booleanOperation->GetOutput() );
+ booleanOperation->Update();
+ vtkPoints *points = booleanOperation->GetOutput()->GetPoints();
+ if (points!=NULL)
+ {
+ bbSetOutputOut( booleanOperation->GetOutput() );
+ } else {
+ bbSetOutputOut( NULL );
+ } // if points!=NULL
} else {
+ bbSetOutputOut( NULL );
printf("EED Warnning! BooleanOperationPolyDataFilter::Process vtkPolyData In1 or In2 is EMPTY\n");
} // if In1 In2 != NULL
+
+ printf("EED BooleanOperationPolyDataFilter::Process End \n" );
}
//=====
std::vector<double> lstY = bbGetInputLstY();
std::vector<double> lstZ = bbGetInputLstZ();
std::vector<int> lstIndexs = bbGetInputLstIndexs();
+
+ printf("CreateMeshFromPoints::Process: sizeX %d \n", lstX.size() );
+ printf("CreateMeshFromPoints::Process: sizeY %d \n", lstY.size() );
+ printf("CreateMeshFromPoints::Process: sizeZ %d \n", lstZ.size() );
+ printf("CreateMeshFromPoints::Process: lstIndexs %d \n", lstIndexs.size() );
+
if ( (lstIndexs.size()<=1) || (lstX.size()==0) || (lstX.size()!=lstY.size()) || (lstY.size()!=lstZ.size()) )
{
printf("Warnning! CreateMeshFromPoints::Process: List of points X Y Z and LstIndexes is not correct\n");
int iSeg1,iSeg2;
int iGeneral = 0;
int sizeLstIdexes=lstIndexs.size();
- for (i=0; i<sizeLstIdexes-1;i++)
+ for (i=0; i<sizeLstIdexes-1; i++ )
{
sizeSegment1 = lstIndexs[i];
sizeSegment2 = lstIndexs[i+1];
triangleStrip->GetPointIds()->SetId(ii*2+1,iSeg2);
iSeg1++;
iSeg2++;
- if (iSeg1>=maxSegment1) iSeg1=maxSegment1-1;
- if (iSeg2>=maxSegment2) iSeg2=maxSegment2-1;
+ if (iSeg1>=maxSegment1) { iSeg1=maxSegment1-1; }
+ if (iSeg2>=maxSegment2) { iSeg2=maxSegment2-1; }
} // for ii
iGeneral=iGeneral+sizeSegment1;
cells->InsertNextCell(triangleStrip);
// See example in:
// https://kitware.github.io/vtk-examples/site/Cxx/VisualizationAlgorithms/Cutter/
- if (bbGetInputIn()!=NULL)
+ printf("EED Cutter::Process start this=%p ImFu=%p \n ", this, bbGetInputImplicitFunction() );
+ if ( (bbGetInputActive()==true) && (bbGetInputIn()!=NULL) )
{
vtkCutter *cutter;
cutter = vtkCutter::New();
} else {
bbSetOutputOut( NULL );
}
+
+ printf("EED Cutter::Process end\n ");
}
//=====
// 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)
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
// bbSetInputIn(NULL);
+ bbSetInputActive( true );
bbSetOutputOut( NULL );
}
//=====
//=====
// 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)
//=====
+ BBTK_DECLARE_INPUT(Active,bool);
BBTK_DECLARE_INPUT(In,vtkPolyData*);
BBTK_DECLARE_INPUT(ImplicitFunction,vtkImplicitFunction*);
BBTK_DECLARE_OUTPUT(Out,vtkPolyData*);
BBTK_DESCRIPTION("vtkCutter");
BBTK_CATEGORY("empty");
+ BBTK_INPUT(Cutter,Active,"(default true) Active true/false)",bool,"");
BBTK_INPUT(Cutter,In,"vtkPolyData input",vtkPolyData*,"");
BBTK_INPUT(Cutter,ImplicitFunction,"vtkImpliciteFunction ex.: vtkBox, vtkCone, vtkCylender, vtkPlane, vtkSphere(s), vtkQuadric, ETC.",vtkImplicitFunction*,"");
namespace bbcreaVtk
{
+MeshManagerModel_Box::MeshManagerModel_Box( MeshManager *box )
+{
+ mBox=box;
+}
+
+MeshManagerModel_Box::~MeshManagerModel_Box( )
+{
+}
+
+void MeshManagerModel_Box::RefreshOutputs( )
+{
+ mBox->bbSetOutputMeshBase( GetMeshBase() );
+ mBox->bbSetOutputMeshTemp( GetMeshTemp() );
+ mBox->bbSignalOutputModification();
+}
+
+
BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,MeshManager)
BBTK_BLACK_BOX_IMPLEMENTATION(MeshManager,bbtk::AtomicBlackBox);
//=====
// (the one provided in the attribute 'type' of the tag 'input')
// bbSetOutputOut( bbGetInputIn() );
// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
- if (meshManagerModel==NULL)
+
+ if (meshManagerModel_Box==NULL)
{
- meshManagerModel = new MeshManagerModel();
- meshManagerModel->SetMeshBase( bbGetInputMesh() );
- bbSetOutputMeshBase( meshManagerModel->GetMeshBase() );
- bbSetOutputMeshTemp( meshManagerModel->GetMeshTemp() );
- bbSetOutputMeshManagerModel( meshManagerModel );
- }
+ meshManagerModel_Box = new MeshManagerModel_Box(this);
+ meshManagerModel_Box->SetMeshBase( bbGetInputMesh() );
+ meshManagerModel_Box->RefreshOutputs();
+ bbSetOutputMeshManagerModel( meshManagerModel_Box );
+ } // if meshManagerModel_Box
}
//=====
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
// bbSetInputIn(0);
- meshManagerModel = NULL;
+ meshManagerModel_Box = NULL;
bbSetInputMesh(NULL);
}
namespace bbcreaVtk
{
+class MeshManagerModel_Box;
+
class bbcreaVtk_EXPORT MeshManager
:
public bbtk::AtomicBlackBox
BBTK_PROCESS(Process);
void Process();
- MeshManagerModel *meshManagerModel;
+ MeshManagerModel_Box *meshManagerModel_Box;
//=====
// 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)
//=====
};
+class MeshManagerModel_Box : public MeshManagerModel
+{
+public :
+ MeshManagerModel_Box(MeshManager *box);
+ ~MeshManagerModel_Box();
+ virtual void RefreshOutputs();
+protected:
+private:
+ MeshManager *mBox;
+};
+
+
+
BBTK_BEGIN_DESCRIBE_BLACK_BOX(MeshManager,bbtk::AtomicBlackBox);
BBTK_NAME("MeshManager");
BBTK_AUTHOR("InfoDev");
// bbSetOutputOut( bbGetInputIn() );
// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
- if (bbGetInputTool()==1) // Undo
+ if (bbGetInputMeshManagerModel()!=NULL)
{
- printf("EED Warning! MeshManager_tool Undo Not implemented.\n");
- }
- if (bbGetInputTool()==2) // Redo
- {
- printf("EED Warning! MeshManager_tool Redo Not implemented.\n");
- }
+ if (bbGetInputTool()==10) // Undo
+ {
+ printf("EED Warning! MeshManager_tool Undo Not implemented.\n");
+ } // if Tool 10 Undo
+
+ if (bbGetInputTool()==20) // Redo
+ {
+ printf("EED Warning! MeshManager_tool Redo Not implemented.\n");
+ } // if Tool 20 Redo
-
- if (bbGetInputTool()==3) // Set
- {
- bbGetInputMeshManagerModel()->SetMeshBase( bbGetInputMesh() );
- }
+ if (bbGetInputTool()==30) // Set
+ {
+ printf("EED MeshManager_tool::Process Set\n");
+ if (bbGetInputMesh()!=NULL){
+ vtkPoints *points = bbGetInputMesh()->GetPoints();
+ if (points!=NULL)
+ {
+ bbGetInputMeshManagerModel()->SetMeshBase( bbGetInputMesh() );
+ } // if points!=NULL
+ } // Mesh!=NULL
+ } // if Tool 30 Set
- if (bbGetInputTool()==4) // Reset
- {
- printf("EED Warning! MeshManager_tool Reset Not implemented.\n");
- }
+ if (bbGetInputTool()==40) // Reset
+ {
+ printf("EED Warning! MeshManager_tool Reset Not implemented.\n");
+ } // if Tool 40 Reset
+ } else {
+ printf("EED Warning! MeshManager_tool : MeshManagerModel not defined. \n");
+ }// if MeshManagerModel != NULL
}
//=====
bbSetInputMesh(NULL);
bbSetInputMeshManagerModel(NULL);
}
+
//=====
// 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)
//=====
void MeshManager_tool::bbUserInitializeProcessing()
{
-
// THE INITIALIZATION METHOD BODY :
// Here does nothing
// but this is where you should allocate the internal/output pointers
-// if any
-
-
+// if any
}
//=====
// 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)
//=====
void MeshManager_tool::bbUserFinalizeProcessing()
{
-
// THE FINALIZATION METHOD BODY :
// Here does nothing
// but this is where you should desallocate the internal/output pointers
// if any
-
}
-}
-// EO namespace bbcreaVtk
+
+} // EO namespace bbcreaVtk
BBTK_DESCRIPTION("No Description.");
BBTK_CATEGORY("empty");
- BBTK_INPUT(MeshManager_tool,Tool,"(default 0) 0:Nothing 1:Undo 2:ReDo 3:Set 4:Reset",int,"");
+ BBTK_INPUT(MeshManager_tool,Tool,"(default 0) 0:Nothing 10:Undo 20:ReDo 30:Set 40:Reset",int,"");
BBTK_INPUT(MeshManager_tool,Mesh,"Mesh",vtkPolyData*,"");
BBTK_INPUT(MeshManager_tool,MeshManagerModel,"Mesh Manager Model",MeshManagerModel*,"");
void MeshManagerModel::SetMeshBase(vtkPolyData* mesh)
{
- _meshBase = mesh;
- if (_meshTemp!=NULL)
+ if (mesh!=NULL)
{
- _meshTemp->Delete();
- } // if
- _meshTemp = vtkPolyData::New();
- _meshTemp->DeepCopy(_meshBase);
+ _meshBase = mesh;
+ if (_meshTemp!=NULL)
+ {
+ _meshTemp->Delete();
+ } // if
+ _meshTemp = vtkPolyData::New();
+ _meshTemp->DeepCopy(_meshBase);
+ RefreshOutputs();
+ } // if mesh
}
vtkPolyData* MeshManagerModel::GetMeshBase()
{
return _meshTemp;
}
+
+void MeshManagerModel::RefreshOutputs() // virtula
+{
+}
void SetMeshBase(vtkPolyData* mesh);
vtkPolyData* GetMeshBase();
vtkPolyData* GetMeshTemp();
+ virtual void RefreshOutputs();
//--Method template----------------------------
// void FunctionName(int& parameterA);