[vtkusers] Window like Decimate.tcl for unstructuredgrid data
alexandre gouaillard
alexandre.gouaillard at insa-lyon.fr
Tue May 2 05:40:37 EDT 2000
if you're using decimate as interface, upgrading it to accept other types is
quite easy :
just take a look at the source code, especially the procedure "OpenFile",
and you will have to add three to four codes lines for each new file type
(if this type is allready known by vtk, i.e. if the appropriate reader is
available) . typically here are what those lines looks like:
[...]
} elseif { [string match *.zzz $filename] } {
vtkZZZReader reader
reader SetFileName $filename
[...]
The filename defined in the interface is put in the "filename" variable, and
all the code will use "reader" as variable for vizualization.
Your problem is a bit more complex as your file will have a known extension
(.vtk).
so you should add a test within the list. If the file's extension is .vtk,
use vtkDataReader 's methods to determine what kind of data you're working
with. Here is the list of the method , look in source for more infos :
// Description:
// Is the file a valid vtk file of the passed dataset type ?
// The dataset type is passed as a lower case string.
int IsFileValid(const char *dstype);
int IsFileStructuredPoints() {
return this->IsFileValid("structured_points");};
int IsFilePolyData() {
return this->IsFileValid("polydata");};
int IsFileStructuredGrid() {
return this->IsFileValid("structured_grid");};
int IsFileUnstructuredGrid() {
return this->IsFileValid("unstructured_grid");};
int IsFileRectilinearGrid() {
return this->IsFileValid("rectilinear_grid");};
hope this will help .
If you manage to get something working, would you mind to send me the
source?
alex.
More information about the vtkusers
mailing list